π(PI) and the AGM: Evaluating Elliptic Integrals

Complete Elliptic Integrals of First Kind

In my earlier post I described the method for calculating complete elliptic integrals of first kind namely $K(k)$ and $I(a, b)$. To summarize the results we have
$$K(k) = \int_{0}^{\pi / 2}\frac{d\theta}{\sqrt{1 - k^{2}\sin^{2}\theta}} = \frac{\pi}{2M(1, \sqrt{1 - k^{2}})} = \frac{\pi}{2M(1, k^{\prime})}$$ $$I(a, b) = \int_{0}^{\pi / 2}\frac{d\theta}{\sqrt{a^{2}\cos^{2}\theta + b^{2}\sin^{2}\theta}} = \frac{\pi}{2M(a, b)}$$ where $M(a, b)$ denotes the Arithmetic-Geometric Mean of two numbers $a$ and $b$ and $k^{\prime}$ is the complementary modulus related to $k$ by the following relation $$k^{2} + k^{\prime 2} = 1$$ Here we shall discuss the problem of evaluating the complete elliptic integrals of second kind, i.e. $E(k)$ or $J(a, b)$. This is a hard problem compared to that of evaluating $K(k)$ and involves a somewhat complicated formula although it is also based on the ever important concept of AGM.

Arithmetic-Geometric Mean Sequences

To begin with we have to focus not only on the AGM concept but also the associated AGM sequences. So let's assume two positive numbers $a$ and $b$ with $a > b$ and form the sequences $\{a_{n}\}, \{b_{n}\}, \{c_{n}\}$ as follows $$a_{0} = a,\,\, b_{0} = b,\,\, c_{1} = \frac{a - b}{2}$$ $$a_{n+1} = \frac{a_{n} + b_{n}}{2},\,\, b_{n + 1} = \sqrt{a_{n}b_{n}},\,\, c_{n + 1} = \frac{a_{n} - b_{n}}{2}$$ Also note that the sequence $\{c_{n}\}$ starts with $n = 1$ (this can be remedied by defining the sequences in reverse direction with negative indexes, but we can do without that stuff). Then it has been already established (see the post linked above) that sequences $\{a_{n}\}$ and $\{b_{n}\}$ tend to a common limit $M(a, b)$ and the sequence $\{c_{n}\}$ therefore tends to $0$.

The sequence $\{c_{n}\}$ is important in evaluating the elliptic integrals of second kind and hence it is better to list its common properties
1. $a_{n} = a_{n + 1} + c_{n + 1}$
2. $b_{n} = a_{n + 1} - c_{n + 1}$
3. $c_{n}^{2} = a_{n}^{2} - b_{n}^{2}\,\,$ (this defines $c_{0}$)
4. $a_{n}c_{n} = \dfrac{c_{n - 1}^{2}}{4}\,\,$ (this can define $c_{n}$ for negative $n$).
The above properties can be established easily from the given definitions. Armed with the basics of AGM sequences we can move on to consider the Landen Transformation which is the key in evaluation of elliptic integrals.

Landen Transformation

Landen Transformation is a susbtitution formula used to effect a change of variables in the elliptic integrals to transform the integral into simpler and more amenable form. These transformations were discovered by a somewhat obscure mathematician John Landen in 18th century. Landen transformation is central to the numerical evaluation of elliptic integrals and is intimately related to the AGM, however Landen did not forsee them and it was left for Legendre and Gauss to build up on these transformations and devise equivalent transformations needed to evaluate elliptic integrals.

It also needs to be noted that none of these transformations is simple in terms of the algebraic manipulations involved, but the end result is very simple, beautiful and striking. The following Landen's transformation $$\sin(2\phi - \theta) = k\sin\theta\tag{1}$$ leads to the beautiful result $$K(k) = \frac{1}{1 + k}K\left(\frac{2\sqrt{k}}{1 + k}\right)\tag{2}$$ which is equivalent to the simple property of AGM given by \begin{align}M(1 + x, 1 - x) &= (1 + x)M\left(1, \frac{1 - x}{1 + x}\right)\notag\\ &= (1 + x)M\left(1 + \frac{2\sqrt{x}}{1 + x}, 1 - \frac{2\sqrt{x}}{1 + x}\right)\notag\end{align} To prove that this is so we start with the Landen transformation to get $$\sin(2\phi) \cos\theta - \cos(2\phi) \sin\theta = k\sin\theta$$ $$\Rightarrow \tan\theta = \frac{\sin(2\phi)}{k + \cos(2\phi)}\tag{3}$$ and then we have \begin{align}\cos\theta &= \frac{1}{\sqrt{1 + \tan^{2}\theta}}\notag\\ &= \frac{k + \cos(2\phi)}{\sqrt{(k + \cos(2\phi))^{2} + \sin^{2}(2\phi)}}\notag\\ &= \frac{k + \cos(2\phi)}{\sqrt{1 + k^{2} + 2k\cos(2\phi)}}\notag\end{align} Similarly $$\sin\theta = \tan\theta \cdot \cos\theta = \frac{\sin(2\phi)}{\sqrt{1 + k^{2} + 2k\cos(2\phi)}}$$ and therefore \begin{align}\cos(2\phi - \theta) &= \cos(2\phi) \cos\theta + \sin(2\phi) \sin\theta\notag\\ &= \frac{\cos(2\phi) (k + \cos(2\phi)) + \sin^{2}(2\phi)}{\sqrt{1 + k^{2} + 2k\cos(2\phi)}}\notag\\ &= \frac{1 + k\cos(2\phi)}{\sqrt{1 + k^{2} + 2k\cos(2\phi)}}\notag\end{align} Finally differentiating $(3)$ we get \begin{align}\frac{d\theta}{d\phi} &= \cos^{2}\theta \cdot \frac{2(k + \cos(2\phi))\cos(2\phi) + 2\sin^{2}(2\phi)}{(k + \cos(2\phi))^{2}}\notag\\ &= \frac{2(1 + k\cos(2\phi))}{1 + k^{2} + 2k\cos(2\phi)}\notag\end{align} Now with all the substitution formulas in place we have \begin{align}K(k) &= \int_{0}^{\pi / 2}\frac{d\theta}{\sqrt{1 - k^{2}\sin^{2}\theta}} = \frac{1}{2}\int_{0}^{\pi}\frac{d\theta}{\sqrt{1 - k^{2}\sin^{2}\theta}}\notag\\ &= \frac{1}{2}\int_{0}^{\pi / 2}\frac{\sqrt{1 + k^{2} + 2k\cos(2\phi)}}{1 + k\cos(2\phi)}\frac{2(1 + k\cos(2\phi))}{1 + k^{2} + 2k\cos(2\phi)}\,d\phi\notag\\ &= \int_{0}^{\pi / 2}\frac{d\phi}{\sqrt{1 + k^{2} + 2k - 4k\sin^{2}\phi}}\notag\\ &= \int_{0}^{\pi / 2}\frac{d\phi}{\sqrt{(1 + k)^{2} - 4k\sin^{2}\phi}}\notag\\ &= \frac{1}{1 + k}\int_{0}^{\pi / 2}\dfrac{d\phi}{\sqrt{1 - \dfrac{4k}{(1 + k)^{2}}\sin^{2}\phi}}\notag\\ &= \frac{1}{1 + k}\int_{0}^{\pi / 2}\dfrac{d\phi}{\sqrt{1 - \left(\dfrac{2\sqrt{k}}{1 + k}\right)^{2}\sin^{2}\phi}}\notag\\ &= \frac{1}{1 + k}K\left(\frac{2\sqrt{k}}{1 + k}\right)\notag\end{align} With the above prologue on Landen transformations it is time to apply them on the elliptic integrals of second kind. That is the goal of the next post.

13 comments :: π(PI) and the AGM: Evaluating Elliptic Integrals

1. hi :
it’s very good of your blog , i have a question about your prove of the landen’s transformation at the equation after “Now with all the substitution formulas in place we have” .
i want to know why the upper bound of the integral by Φ is π/2 (half of the upper bound of integral by θ)

2. Hi alpha,
The relation between $\phi$ and $\theta$ is given by $\sin(2\phi - \theta) = k\sin\theta$ and on further analysis of this relation it follows that $\phi$ increases with $\theta$ (you can check that $d\theta / d\phi > 0$) and also $\theta / 2 \leq \phi \leq \theta$ for $0 \leq \theta \leq \pi / 2$ and $\theta / 2 \leq \phi \leq \pi / 2$ for $\pi / 2 \leq \theta \leq \pi$. In that case if we put $\theta = \pi$ the suitable value of $\phi$ turns out to be $\pi / 2$.

3. @paramanand

i got it, thanks very much

4. Hi,
I'm confused about how to get $\frac{d\theta}{d\phi} &=$ from the equations at hand. Actually, I don't even know quite how to approach it with having function with $\theta$ and $\phi$ on one side of the equation and a different function with just $\phi$ on the other side. You don't have to work it out in detail, just if you have time give me a hint of where to go to learn this kind of thing. I'm probably missing something fairly fundamental and hopefully pretty simple.
We'll see if the LateX works. The preview doesn't show it, and I don't know if I'm doing the syntax wrong or if it just doesn't work in the preview.
Thanks, --gjk
Thanks, --Glenn Keller

5. @Glenn Keller,
First of all your latex stuff works (although you have a minor syntax error in first latex code so it does not show up). Also it will not be shown in preview. There is an online latex editor which gives preview as you type. please have a look at http://www.codecogs.com/latex/eqneditor.php

Now we come to the derivative $\dfrac{d\theta}{d\phi}$. We have the relation $$\tan \theta = \frac{\sin 2\phi}{k + \cos 2\phi}$$ and we need to differentiate this with respect to $\phi$. Clearly this will require the use of chain rule (and quotient rule too) and we get $$\sec^{2}\theta\frac{d\theta}{d\phi} = \dfrac{(k + \cos 2\phi)\dfrac{d}{d\phi}(\sin 2\phi) - \sin 2\phi\dfrac{d}{d\phi}(k + \cos 2\phi)}{(k + \cos 2\phi)^{2}}$$ After some simplification you can get the value of $d\theta/d\phi$.

Regards,
Paramanand

6. Hi, Paramanand,
Thanks again for your help getting unstuck. It seems so obvious now. I had to pick the eqn with only $\theta$ on the left and only $\phi$ on the right.

I found it helped my understanding on the first set of equations that the goal was to calculate the series backwards :
$a_n, b_n, c_n = f(a_{n+1},b_{n+1},c_{n+1})$

with a reminder from previous posts:
$(a_n, b_n) = (a_{n+1} + \sqrt{a_{n+1}^{2} - b_{n+1}^{2}},a_{n+1} - \sqrt{a_{n+1}^{2} - b_{n+1}^{2}})$

Please check if I got this correct. I am very new with LateX.

Best Regards, --Glenn Keller

8. @Glenn Keller,
Good to know that you are learning Latex. Your first comment looks OK (as you can see). However the syntax for handling multiline equations in MathJax latex is bit complicated. You should use $\$\\\begin\{aligned\} multiline equation with lines separated by double backslash \\end\{aligned\}\\$$for the same. This will put your multiline equation in center. Since blogger does not allow editing of comments, I will have to delete your last two comments (they are difficult to read because of the errors, but don't worry you will learn all the tricks of latex soon) and fix the errors there and publish on your behalf. Regards, Paramanand 9. The following comment was posted posted by Glenn Keller and had some latex errors hence corrected and reposted. Hello again, Thanks ! I got through all the algebra on that page but am still confused about the limits. The substitution at \pi worked ok, k \sin(\pi) = \sin(2\phi - \pi), 0 = \sin(2\phi - \pi) = 2\phi - \pi, \phi = \pi / 2 but I got lost looking at \pi/2 & the ratios & ranges. I must be missing something. It probably will be obvious to you. See below: I look at k = 1 :$$\begin{aligned} \sin(\theta) = \sin(2\phi - \theta) \\ \theta = 2\phi - \theta, 2\theta = 2\phi \end{aligned}$$This doesn't match your \theta / 2 \leq \phi \leq \theta for 0 \leq \theta \leq \pi / 2 . I'm confused. I think the function has a mirror symmetry about \theta = \pi / 2 . At this point:$$\begin{aligned} k\sin(\pi / 2) = \sin(2\phi - \pi / 2) \\ \arcsin(k) = 2\phi - \pi / 2 \\ 2\phi = \arcsin(k) + \pi / 2 \\ k = 0 , 1, \arcsin(k) = 0 , \pi / 2, \phi = \pi / 2 , \pi / 4 \end{aligned}$$Due to the mirroring, I would expect \phi to always be within this range. Therefore, depending on k , there could be some range of 0 , \pi / 2 not covered by \phi . Maybe I'm thinking about some aspect of the mirroring incorrectly. Please let me know what I'm missing. Thanks, --gjk 10. This comment was posted by Glenn Keller and has been reposted after fixing latex errors. I think I figured it out. \phi is NOT symmetrical: The case for \theta = 3\pi / 2 is as follows:$$\begin{aligned} k\sin(3\pi / 2) = \sin(2\phi - 3\pi / 2) \\ \arcsin(k / \sqrt(2)) = 2\phi - 3\pi / 2 \\ 2\phi = \arcsin(k / \sqrt(2)) + 3\pi / 2 \end{aligned}$As$ \theta $approaches$ \pi $the$ \sin, 1 / \sqrt(2) $above, gets smaller and approaches 0. So does the$ \arcsin() $. Meantime, the$ 3 \pi / 2 $approaches$ pi $, and :$ 2 \phi = \pi, \phi = \pi / 2 $just like you said. Sometimes I have to work through this with very small steps. Best Regards, --gjk 11. @Glenn Keller, I am glad that you fixed the issues of relation between$\theta$and$\phi$yourself. Also the relation between$a_{n}, b_{n}$and$a_{n + 1}, b_{n + 1}$is also correct. You are on right track. Regards, Paramanand 12. Hi, Thanks for fixing my mistakes with the LateX. I'll follow your suggestions. The web site you gave doesn't accept the same syntax for multiline eqns. I'll look for some others later. I've been thinking about the$ \theta $to$ \phi $correspondence a bit more:$ \phi = \frac{\arcsin(k\sin(\theta))+\theta)}{2} $At k near 0,$ \phi $slope is about$ \theta / 2 $, slightly more for$ \theta = 0 : \pi /2 $, less for$ \pi / 2 : \pi $. At k near 1,$ \phi $slope is about$ \theta $for$ 0 : \pi / 2 $and drops abruptly to near 0 for$ \pi/2 : \pi $. The closer to$ k = 1 $, the closer the initial slope to 1 and the faster the drop to 0 above$ \pi / 2 $. Initially I couldn't understand the behavior near$ k = 1 \$, but now it makes sense.

Sorry if there are any LateX errors, I haven't been able to check my syntax as the site has stopped working this morning.

Best Regards, --gjk

13. @Glenn Keller,
Your reasoning and Latex looks good. You should try to ask/answer questions at http://math.stackexchange.com It uses the same Latex and Mathjax syntax as my blog and hence you will have a lot of practice there. Plus it has the live preview of whatever latex you type. I also have a profile at stack exchange http://math.stackexchange.com/users/72031/paramanand-singh

Regards,
Paramanand