# Elliptic integrals with parameter outside $0<m<1$

I'm attempting to implement an equation (for calculating magnetic forces between coils, eqs (22–24) in the linked paper) that requires the use of elliptic integrals.

Unfortunately these equations require the evaluation of the elliptic integrals far outside their standard parameter range of $0\le m\le 1$ and the numerical implementations I have available to evaluate them give inconsistent results.

I believe that Mathematica is correct in its answer:

EllipticF[ArcSin[Sqrt[1/c5]], c5] //. c5 -> 817.327
=> 0.054961 - 1.17196*10^-17 i


mfun('EllipticF',asin(sqrt(1/817.327)),sqrt(817.327))
=> 0.054961 - 0.000707i


(Mma's function takes parameter $m=k^2$ whereas MuPad takes modulus $k$, explaining the sqrt) While I can use Mathematica for my own work, my colleagues only have Matlab available and I'd like them to be able to use this code.

I'm a pretty unfamiliar with the theory behind elliptic integrals, but Baker's ‘Elliptic Functions’ says

We shall see later on that the quantity $k^2$ [...] can always be considered real and less than unity.

Which leads me to ask: can the arguments to these elliptic integrals be re-stated in terms of an input of $k>1$, such as I seem to require above?

-
...and if I may make a slightly gauche suggestion, it might be profitable to re-express the whole mess in terms of the Carlson integrals, which are less finicky about argument restrictions. –  Guess who it is. Oct 31 '10 at 3:56
Lest people become confused with terminology: $k$ is a modulus, while $m$ is a parameter. –  Guess who it is. Oct 31 '10 at 8:10
I had a look at that paper you linked to; a lot of their elliptic integral expressions are a baroque mess, and I suspect they only wrote what Mathematica spat out without even pausing to look at what can be simplified. –  Guess who it is. Oct 31 '10 at 10:40
Thanks for the nudge on getting my naming straight. I edited the question slightly to improve my terminology there. Regarding the elliptic integrals, I'm sure you're right unfortunately; I'm actually having some further issues (my question only addresses one term of the equations, as you will have seen in the paper) but I need to get my head straight before I keep asking for help. Thanks again in the mean time! –  Will Robertson Oct 31 '10 at 14:18

What you seem to require here are the so-called "reciprocal-modulus transformations".

In your specific case, upon applying the reciprocal-modulus transformation, your elliptic integral can actually be simplified to

$$\frac1{\sqrt{c_5}}F\left(\frac{\pi}{2}\vert \frac1{c_5}\right)=\frac1{\sqrt{c_5}}K\left(\frac1{c_5}\right)$$.

where $K(m)$ is the complete elliptic integral of the first kind with parameter $m$ (though I understand MuPAD uses $k=\sqrt{m}$ as argument, in which case you seem to know the conversion formulae already).

There are similar formulae for the elliptic integrals of the second and third kinds, and I direct you to the DLMF link I gave above for them.

-
For a Mathematica demonstration: With[{c5 = 817.327}, {EllipticK[1/c5]/Sqrt[c5], EllipticF[ArcSin[1/Sqrt[c5]], c5]}] // Chop –  Guess who it is. Oct 31 '10 at 3:54
Fantastic, thanks! This both fixes my Matlab code and makes the equation nicer. One of the downsides of equation derivation by a CAS, I suppose. I suspect there are some more simplifications that can then be made in the overall equation. –  Will Robertson Oct 31 '10 at 4:34