Elliptical Integrals I was trying to figure out the length of the arc in a single cycle of a sinusoidal curve and I used the curve length formula to arrive at $$\int_0^{2\pi}\sqrt{1+\cos^2x}\ dx,$$ which I am fairly certain is correct. However,  I have no idea how to evaluate this integral and when I looked it up, Mathematica said to use something called an elliptical integral. What is the formula for elliptical integration, and how would I compute the indefinite integral for something like this?
 A: You can always just expand the integrand into its binomial series, and then switch the order of summation and integration. Knowledge of Wallis' integrals will also come in handy. You'll have 
$$$$
$$\int_0^{2\pi}\sqrt{1+\cos^2x}~dx~=~4\int_0^{\frac\pi2}\sqrt{1+\cos^2x}~dx~=~4\int_0^{\frac\pi2}\Big(1+\cos^2x\Big)^\frac12~dx~=$$
$$=~4\int_0^{\frac\pi2}\sum_{n=0}^\infty{\frac12\choose n}\cos^{2n}x~dx~=~4\sum_{n=0}^\infty{\frac12\choose n}\int_0^{\frac\pi2}\cos^{2n}x~dx~=$$
$$=~4\sum_{n=0}^\infty\bigg[(-1)^{n+1}\cdot\frac{(2n-3)!!}{(2n)!!}\bigg]\cdot\bigg[\frac{(2n-1)!!}{(2n)!!}\cdot\frac\pi2\bigg]~=~4\sum_{n=0}^\infty(-1)^{n+1}\cdot\frac\pi{4n-2}\cdot\frac{\displaystyle{2n\choose n}^2}{16^n}$$
$$$$
Using the fact that $\displaystyle{2n+2\choose n+1}=\frac{4n+2}{n+1}\cdot{2n\choose n}$, we can turn this very easily into a simple code or computer program in the programming language of one's choosing. By summing the first five terms, we have an error of less than $1$%, and the sixth gives an accuracy of two exact decimals.
A: First, the specific result is $$\int_0^{2\pi} \sqrt{1+\cos^2{x}}\,dx = 4\sqrt{2}\, E\left(\dfrac{1}{2}\right) \approx 7.64040$$ where $E(m)=\int_0^{\pi/2} (1-m \sin^2 x)^{1/2}\,dx$ is the elliptic integral of the second kind. (To see this, note that the quarter-intervals in $[0,2\pi]$ contribute equally and that the integrand can be written as $\sqrt{2}\sqrt{1-1/2 \sin^2 x}.$)
The question is, how to numerically find $E(1/2)\approx 1.35$? A series expansion in $m$ would suffice but is likely equivalent to @Lucian's answer. An approach which uses 'elliptic' technology starts from Legendre's relation: $$E(m)K(1-m)+E(1-m)K(m)-K(m)K(1-m)=\frac{\pi}{2}$$ where $K(m)=\int_0^{\pi/2}  (1-m \sin^2 x)^{-1/2}\,dx$ is the elliptic integral of the first kind. This is particularly nice in the $m=1/2$ case, yielding 
$$E\left(\frac{1}{2}\right)=\frac{\pi}{4K(1/2)}+\frac{1}{2}K(1/2).$$
At this point it may seem like we've traded one elliptic integral for another. But $K(m)$ can be computed by way of the arithmetic-geometric mean (see Wikipedia link for details) using the identity $$K\left(\left(\frac{a-b}{a+b}\right)^2\right)=\frac{\pi(a+b)/4}{\text{agm}(a,b)}.$$ In the case of $m=1/2$, we may take $(a,b)=(1-1/\sqrt{2},1+\sqrt{2})$ to obtain
$$K(1/2) = \frac{\pi/2}{\text{agm}(1-1/\sqrt{2},1+1/\sqrt{2})}= \frac{\pi/2}{\text{agm}(1,1/\sqrt{2})}= \frac{\pi/\sqrt{2}}{\text{agm}(1,\sqrt{2})}.$$ (In the second equality we have used the fact that $\text{agm}(a,b)=\text{agm}((a+b)/2,\sqrt{a b})$, and in the third equality that $\text{agm}(ra,rb)=r\,\text{agm}(a,b)).$)
So approximation of $K(1/2)$, and therefore of $E(1/2)$, essentially reduces to computing Gauss's constant $G=1/\text{agm}(1,\sqrt{2})\approx 0.835$. One iteration towards the arithmetic-geometric mean gives the bounds
$$\frac{1}{(1+\sqrt{2)/2}}=0.828\ldots \leq G \leq \frac{1}{\sqrt{1\cdot \sqrt{2}}} \approx 0.841\ldots$$ A second iteration improves these bounds to $$0.834638\ldots \leq G = 0.834626\ldots \leq 0.834615\ldots$$
Returning to the original result $$4\sqrt{2}E(1/2)= \frac{\pi \sqrt{2}}{K(1/2)}+2\sqrt{2}K(1/2) = 2\pi G+\frac{2}{G},$$ we conclude that its value must lie between 7.64044 and 7.64036 (which it indeed does). Note that both these bounds can be easily computed on a hand calculator, and that the convergence is rapid (each iteration of means approximately doubles the number of correct digits.)
