[Math] Evaluation of complete elliptic integral of second kind

elliptic integralsnumerical-calculuswolfram alpha

I am currently working to try and solve the integral:

$$\int_{0}^{\frac{\pi}{2}} \sqrt{1-a^2\cos(x)^2} = \sqrt{1-a^2} \; E\left ( 1+\frac{1}{-1+a^2} \right )$$

where $E(m)$ is the complete elliptic integral of second kind with the parameter $m=k^2$ and $0<a<1$.

This is the soultion I found using WolframAlpha

In this case $m$ is always smaller then $0$, yet $m$ is supposed to be the square of some $k$.

The implementation I found in NumericalRecipies seems to only accept $k$ as argument, evident through a test, plotting values of the positive argument-branch and comparing them with WolframAlphas elliptic function.

However, the NR implementation doesn't use any sort of complex variables (therefor, won't accept them as input).

Do I need another implementation, am I completely off with this.

I am very confused and uncertain about this.

Help would be greatly appreciated, Thanks.

Best Answer

What do you mean by solving such integral? Such integral is what it is, i.e. a complete elliptic integral of the second kind. Efficient algorithms for the numerical evaluation are given by the relations between $E,K$ and the AGM mean. If you are fine with algorithms with a linear (instead of a quadratic, or even faster) convergence speed, you may simply exploit the identities

$$\sqrt{1-x}=\sum_{n\geq 0}\frac{1}{4^n}\binom{2n}{n}\frac{x^n}{1-2n} \tag{1} $$ $$ \int_{0}^{\pi/2}\left(\cos\theta\right)^{2n}\,d\theta = \frac{\pi}{2}\cdot\frac{1}{4^n}\binom{2n}{n}\tag{2}$$ leading to

$$ \int_{0}^{\pi/2}\sqrt{1-a^2\cos^2\theta}\,d\theta = \frac{\pi}{2}\sum_{n\geq 0}\left[\frac{1}{4^n}\binom{2n}{n}\right]^2\frac{a^{2n}}{1-2n} \tag{3} $$ where $$ \left[\frac{1}{4^n}\binom{2n}{n}\right]^2 \approx \frac{1}{\pi\left(n+\frac{1}{4}\right)}.\tag{4}$$ The complete elliptic integral of the second kind is related to the perimeter of an ellipse, and a very good algebraic approximation is due to Ramanujan, besides weaker inequalities such as $$ 2\pi \left(\frac{a^{3/2}+b^{3/2}}{2}\right)^{2/3}\leq L(a,b)\leq 2\pi\sqrt{\frac{a^2+b^2}{2}}.\tag{5}$$ Other info are contained in the chapter of these notes about elliptic integrals.

Related Question