6

I've been playing around with elliptic integrals lately and I came across Legendre's relation, relating the complete integrals of the first and second kind, $K(k)$ and $E(k)$ respectively:

$E(k)K(\sqrt{1-k^{2}})+E(\sqrt{1-k^{2}})K(k)-K(k)K(\sqrt{1-k^2})=\frac{\pi}{2}$.

To verify this, I tried plotting the left hand relation with respect to $k\in[0,1]$ in Mathematica and found that this only seems to be true at the boundaries! What gives? There seems to be quite a lot of literature on the mathematical proof of the relation, so I'm inclined to think this fault is on Mathematica's end. Does anyone know? Thanks in advance for your help.

Here's the code if you want to have a play yourself:

Plot[{EllipticE[k]*EllipticK[Sqrt[1 - k^2]] + EllipticE[Sqrt[1 -k^2]]*EllipticK[k] - EllipticK[k]*EllipticK[Sqrt[1 - k^2]], Pi/2}, {k, 0, 1},  AxesLabel -> {k}]

Michael E2
  • 235,386
  • 17
  • 334
  • 747

1 Answers1

6

So it appears Mathematica uses a rather unusual convention for elliptical integrals; the functions are defined in terms of an elliptic parameter $m$ rather than the elliptic modulus $k$ and these are related by $m=k^{2}$. So, Mathematica's function should be thought of as EllipticK[$m$] $\equiv$ EllipticK[$k^{2}$] rather than what I previously thought Elliptic[k].

In light of that, Legendre's relation in Mathematica should read:

Plot[{EllipticE[k^2]*EllipticK[1 - k^2] + EllipticE[1 -k^2]*EllipticK[k^2] - EllipticK[k^2]*EllipticK[1 - k^2], Pi/2}, {k, 0, 1},  AxesLabel -> {k}]

and that will give you the desired result. Problem solved!