Need help with an integral need help with calculating this:
$$\int_{0}^{2\pi}\frac{1-x\cos\phi}{(1+x^2-2x\cos\phi)^{\frac{3}{2}}}d\phi$$
Thanks in advance!
 A: Let's assume $-1<x<1$, for simplicity.
Changing integration variable $\phi \to 2 \phi$, and using $\cos(2\phi) = 1- 2 \sin^2(\phi)$ we get:
$$\begin{eqnarray}
   \int_0^{2\pi} \frac{1-x \cos(\phi)}{\left(1+x^2-2x \cos(\phi)\right)^{3/2}}\mathrm{d} \phi  &=& 2 \int_0^{\pi} \frac{1-x \cos(2\phi)}{\left(1+x^2-2x \cos(2\phi)\right)^{3/2}}\mathrm{d} \phi \\
 &=& 4 \int_0^{\pi/2} \frac{1-x + 2 x \sin^2(\phi)}{\left((1-x)^2 + 4 x \sin^2(\phi)\right)^{3/2}} \mathrm{d} \phi \\ 
  &=& \frac{4}{(1-x)^2} \int_0^{\pi/2} \frac{1 + \frac{2 x}{1-x} \sin^2(\phi)}{\left(1 + \frac{4 x}{(1-x)^2} \sin^2(\phi)\right)^{3/2}} \mathrm{d} \phi
\end{eqnarray}
$$
Letting $m=-\frac{4 x}{(1-x)^2}$ and $a= \frac{2x}{1-x}$:
$$\begin{eqnarray}
   \int_0^{\pi/2}\frac{1 + a \cdot \sin^2(\phi)}{\left(1-m \cdot \sin^2(\phi)\right)^{3/2}} \mathrm{d}\phi &\stackrel{t = \sin^2(\phi)}{=}& \int_0^1 \frac{1+a t}{(1-m t)^{3/2}} \frac{\mathrm{d}t}{2\sqrt{t(1-t)}}\\
\end{eqnarray}
$$
Using 
$$
 \frac{1+a t}{(1-m t)^{3/2}} \frac{1}{2\sqrt{t(1-t)}}= \frac{\mathrm{d}}{\mathrm{d} t}\left(\frac{a+m}{1-m} \frac{\sqrt{t(1-t)}}{\sqrt{1-m t}}\right) + \frac{a+m}{2m(1-m)} \frac{\sqrt{1-m t}}{\sqrt{t(1-t)}} - \frac{a}{2m} \frac{1}{\sqrt{t(1-t)}\sqrt{1-m t}}
$$
we arrive at 
$$
 \int_0^1 \frac{1+a t}{(1-m t)^{3/2}} \frac{\mathrm{d}t}{2\sqrt{t(1-t)}} = \frac{a+m}{m(1-m)} E(m)  - \frac{a}{m} K(m)
$$ 
Substituting $m = -\frac{4x}{(1-x)^2}$ and $a=\frac{2x}{1-x}$ and combining terms:
$$
  \int_0^{2\pi} \frac{1-x \cos(\phi)}{\left(1+x^2-2x \cos(\phi)\right)^{3/2}}\mathrm{d} \phi = \frac{2}{1+x} \operatorname{E}\left(\frac{-4x}{(1-x)^2}\right) + \frac{2}{1-x} \operatorname{K}\left(\frac{-4x}{(1-x)^2}\right)
$$
Here is a numerical check with Mathematica:
In[27]:= With[{x = 0.78}, {NIntegrate[(
   1 - x Cos[a])/(1 + x^2 - 2 x Cos[a])^(3/2), {a, 0, 2 Pi}],
   2 EllipticE[-4 x/(1 - x)^2]/(1 + x) + 
   2 EllipticK[-4 x/(1 - x)^2]/(1 - x)}]

Out[27]= {13.2161, 13.2161}

