Complex incomplete elliptic integral of the second kind

Posted on January 30, 2020 by Stéphane Laurent

The incomplete elliptic integral of the second kind is usually defined by \[ E(\phi \mid k) = \int_0^\phi \sqrt{1 - k^2\sin^2t}\,\mathrm{d}t \] for \(-\frac{\pi}{2} \leqslant \phi \leqslant \frac{\pi}{2}\) and \(k^2 \leqslant \frac{1}{\sin^2\phi}\).

It can be evaluated in R with the gsl package:

That said, this elliptic integral is more generally defined by \[ E(\phi \mid m) = \int_0^\phi \sqrt{1 - m\sin^2t}\,\mathrm{d}t \] for \(-\frac{\pi}{2} \leqslant \phi \leqslant \frac{\pi}{2}\) and \(-\infty < m \leqslant \frac{1}{\sin^2\phi}\).

Evaluation of \(E(\phi \mid m)\)

Thus, gsl allows to evaluate \(E(\phi \mid m)\) for a positive value of the parameter \(m\) only, with the ellint_E function. However it is possible to use gsl to evaluate \(E(\phi \mid m)\) for a negative parameter \(m\), with the help of the Carlson elliptic integrals \(R_F\) and \(R_D\). These elliptic integrals are evaluated in gsl by the functions ellint_RF and ellint_RD.

Let’s try it:

You can compare with EllipticE[1,-5] on WolframAlpha.

Here is how the function looks like for a fixed value of \(\phi\):

Extending \(E(\phi \mid m)\) to arbitrary real \(\phi\)

There is a continuous extension of \(E(\phi \mid m)\). It is given by the formula \[ E(\phi + k\pi \mid m) = 2 k E\Bigl(\frac{\pi}{2} \mid m\Bigr) + E(\phi \mid m) \] for any \(k \in \mathbb{Z}\).

Let’s try it:

and compare with EllipticE[7,-5] on WolframAlpha.

Extending \(E(\phi \mid m)\) to complex \(\phi\) and \(m\)

Now we will construct the analytical continuation of \(E(\phi \mid m)\).

I found a nice implementation of the Carlson elliptic integrals here, which can easily be generalized to complex values of the parameters:

An important note. In the link I gave above, the author takes \[ \lambda = \sqrt{xy} + \sqrt{yz} + \sqrt{zx} \] whereas I take \[ \lambda = \sqrt{x}\sqrt{y} + \sqrt{y}\sqrt{z} + \sqrt{z}\sqrt{x}. \] This is important: the square root of a product is not equal to the product of the square roots in general, for complex numbers!

Now here is the implementation of the incomplete elliptic integral of the second kind allowing complex values of \(\phi\) and \(m\):

Let’s try it:

and compare with EllipticE[7+2I,-5] on WolframAlpha.

I also find the same results as the ones of WolframAlpha when \(\phi\) and \(m\) are complex.

Resorting to the Appell function

As a sanity check, let’s propose another way.

This way consists in using the relation between the incomplete elliptic integral of the second kind and the first Appell hypergeometric function: \[ E(\phi, m) = \sin\phi \times F_1\Bigl(\frac12, \frac12, -\frac{3}{2}, \sin^2\phi, m\sin^2\phi\Bigr), \] for \(-\frac{\pi}{2} \leqslant \Re(\phi) \leqslant \frac{\pi}{2}\).

Unfortunately there’s no available R implementation of \(F_1\) allowing complex values of the variables. Then we will use the Euler integral representation \[ F_1\Bigl(\frac12, \frac12, -\frac{3}{2}, z_1, z_2\Bigr) = \frac12\int_0^1 \frac{\sqrt{1-z_2t}}{\sqrt{t}\sqrt{1-z_1t}}\,\mathrm{d}t. \]

The slight differences are due to the numerical integrations. The previous way is preferable.