<s>[INST] Is there a way to find value for this integral? I am trying to solve this integral by hand and here are my steps for doing that.
The integral is:
$$A=\int_0^{2 \pi} \frac{\cos(\theta)}{\sqrt{1 - a \cos(\theta)}} d\theta$$
Using the trigonometry trick: $\cos(\theta)  = 1- 2 \sin\left(\frac{\theta}{2}\right)^{2}$ and the fact that when I plot the graph, the area from $0$ to $\pi$ is the same as the area from $\pi$ to $2\pi$.
Therefore, $$A=2\int_0^{ \pi} \frac{\cos(\theta)}{\sqrt{1 - a \cos(\theta)}} d\theta$$
$$= 4 \int_0^{\frac{\pi}{2}} \frac{\cos(2t)}{\sqrt{1 - a + 2a \sin(t)^{2}}} dt$$
$$= \frac{4}{\sqrt{1-a}} \int_0^{\frac{\pi}{2}} \frac{1 -2 \sin(t)^{2}}{\sqrt{1 + \frac{2a}{1-a} \sin(t)^{2}}} dt$$
Set $x = \sqrt{\frac{2a}{1-a}} \sin(t)$
$\to dx =  \sqrt{\frac{2a}{1-a}} \cos(t) dt$
$\leftrightarrow dt = \frac{1}{\sqrt{\frac{2a}{1-a}} \cos(t)} dx$
$\leftrightarrow dt = \frac{1}{\sqrt{\frac{2a}{1-a}} \sqrt{1- \sin(t)^{2}}} dx$
$\leftrightarrow dt = \frac{1}{\sqrt{1-x^2}} dx$
As $x = \sqrt{\frac{2a}{1-a}} \sin(t)$:
$\sin(t) = \frac{x}{ \sqrt{\frac{2a}{1-a}}}$
$$\to A = \frac{4}{\sqrt{1-a}} \int_0^{\sqrt{\frac{2a}{1-a}}} \frac{1 - \frac{1-a}{a} x^2}{\sqrt{1+x^2} \sqrt{1-x^2}} dx$$
$$ \leftrightarrow A = \frac{4}{\sqrt{1-a}} \int_0^{\sqrt{\frac{2a}{1-a}}} \frac{1 - \frac{1-a}{a} x^2}{\sqrt{1-x^4}} dx$$
Set $x = u \sqrt{\frac{2a}{1-a}}$
$\to u = x \sqrt{\frac{1-a}{2a}}$
$\leftrightarrow du = \sqrt{\frac{1-a}{2a}} dx$
$$\to A =  \frac{4}{\sqrt{1-a}} \sqrt{\frac{2a}{1-a}}
\int_0^{1} \frac{1 - 2 u^2}{\sqrt{1- \left(\frac{2a}{1-a}\right)^2 u^4}} du$$
I don't really know the way to go from here. Can you help me to get the value for this integral? Thank you so much!
 [/INST] Let us assume $|a|< 1$ and exploit
$$ \frac{1}{\sqrt{1-z}}=\sum_{n\geq 0}\frac{1}{4^n}\binom{2n}{n}z^n \qquad \text{for }|z|<1. $$
This gives
$$ I(a)=\int_{0}^{2\pi}\frac{\cos\theta}{\sqrt{1-a\cos\theta}}\,d\theta=\sum_{n\geq 0}\frac{a^n}{4^n}\binom{2n}{n}\int_{0}^{2\pi}\left(\cos\theta\right)^{n+1}\,d\theta $$
where the even values of $n$ do not really contribute to the series. We are left with
$$ I(a)=\sum_{m\geq 0}\frac{a^{2m+1}}{4^{2m+1}}\binom{4m+2}{2m+1}\int_{0}^{\pi}(\cos\theta)^{2m+2}\,d\theta=2\pi\sum_{m\geq 0}\frac{a^{2m+1}}{4^{3m+2}}\binom{4m+2}{2m+1}\binom{2m+2}{m+1} $$
where the RHS is a hypergeometric function related to the complete elliptic integrals of the first and second kind:
$$ I(a) = \frac{\pi a}{2}\cdot\phantom{}_2 F_1\left(\frac{3}{4},\frac{5}{4};2;a^2\right)=\frac{4}{a\sqrt{1-a}}\left(K\left(\frac{2a}{a-1}\right)-(1-a)E\left(\frac{2a}{a-1}\right)\right).$$
Here $E$ and $K$ are denoted according to Mathematica's notation, so their argument is the elliptic modulus.
For $a=\pm\frac{1}{3}$ the integral can be expressed in terms of $\pi$ and $\Gamma\left(\frac{1}{4}\right)$ (see Chapter $12$ of my notes):
$$ I\left(\pm\tfrac{1}{3}\right) = \pm\sqrt{\frac{3}{4\pi}}\left(\Gamma\left(\tfrac{1}{4}\right)^2-\frac{(4\pi)^2}{\Gamma\left(\frac{1}{4}\right)^2}\right).$$
</s>