TITLE: Elliptical Integrals
QUESTION [4 upvotes]: 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?

REPLY [1 votes]: 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.)
{"set_name": "stack_exchange", "score": 4, "question_id": 800874}