How do I evaluate the definite integral? I have the following definite integral:
$$
I = \int_{0}^{2\pi}{\sqrt{1+2a\cos{x}+a^2}\,\mathrm dx}
$$
I have tried several techniques to evaluate it without success. I have tried also using Wolframalpha but it fails (standard computation time exceeded).
Is there a way to evaluate this integral?
I appreciate your help
 A: the integral $$\int\sqrt{2a\cos\left(x\right)+a^2+1}\:\:dx$$
Re-writing this as
$$\int\sqrt{a^2+2a+1}\sqrt{1-\frac{4a\operatorname{sin}^2\left(\frac{x}{2}\right)}{a^2+2a+1}}\:\:dx$$
Let $u=\frac{x}2\implies dx=2du$ Our integral becomes
$$2\sqrt{a^2+2a+1}\int\sqrt{1-\frac{4a\operatorname{sin}^2u}{a^2+2a+1}}\:\:du$$ The integral above is the famous Elliptic integral of second kind:
It is equal to $$2\sqrt{a^2+2a+1}E\left(u\middle|\,\frac{4a}{a^2+2a+1}\right)$$
$$=2\sqrt{a^2+2a+1}E\left(\frac{x}{2}\middle|\,\frac{4a}{a^2+2a+1}\right)$$
$$=2\left|a+1\right|\operatorname{E}\left(\dfrac{x}{2}\,\middle|\,\dfrac{4a}{\left(a+1\right)^2}\right)$$
For the limits, just put $0$ and $2\pi$ and subtract them (just show the syntax, you don't need to do actual subtraction).
A: Well, we are trying to solve:
$$\mathcal{I}_\text{n}\left(\text{k},x\right):=\int\sqrt{\text{k}+\text{n}\cos\left(x\right)}\space\text{d}x\tag1$$
I let you prove that we can rewrite the integrand in the following way:
$$\sqrt{\text{k}+\text{n}\cos\left(x\right)}=\sqrt{\text{k}+\text{n}}\cdot\sqrt{1-\frac{2\text{n}\sin^2\left(\frac{x}{2}\right)}{\text{k}+\text{n}}}\tag2$$
So, we get:
$$\mathcal{I}_\text{n}\left(\text{k},x\right)=\sqrt{\text{k}+\text{n}}\int\sqrt{1-\frac{2\text{n}\sin^2\left(\frac{x}{2}\right)}{\text{k}+\text{n}}}\space\text{d}x\tag3$$
Now, substitute $\text{u}=\frac{x}{2}$:
$$\mathcal{I}_\text{n}\left(\text{k},x\right)=2\sqrt{\text{k}+\text{n}}\int\sqrt{1-\frac{2\text{n}\sin^2\left(\text{u}\right)}{\text{k}+\text{n}}}\space\text{du}\tag4$$
Now, we notice that the integral is given by:
$$\int\sqrt{1-\frac{2\text{n}\sin^2\left(\text{u}\right)}{\text{k}+\text{n}}}\space\text{du}=\text{E}\left(\text{u}\space\left.\right\vert\space\frac{2\text{n}}{\text{k}+\text{n}}\right)\tag5$$
Where $\text{E}\left(\cdot\space\left.\right\vert\space\cdot\right)$ is the incomplete elliptic integral of the second kind.
