# Boundary Condition for Elliptic Integral $|k| > 1$

I was calculating a problem and came across elliptic integrals (complete, first and second kind) no problem here as I have dealt with these before. Once I achieved my final solution I moved the answer over into C++ and here I had an error pop up. So I went back and looked at my argument, $k$, inside of my elliptic integral function and there were times when it became smaller than -1.

If you plot the elliptic complete functions you will see that they can take values less than -1. My understanding, and what I've read concludes that the argument that goes inside must be $|k| < 1$ which can be understood just by looking at part of the integral for both first and second, $$\sqrt{1-k^2 \sin\theta}.$$

So my question is, why am I allowed to have $k<-1$? (I'm hoping that a complete understanding of this will help my overall problem).

Thanks!

• "So my question is, why am I allowed to have $k<−1$?" - because Mathematica, as much as possible, tries to define its special functions so that they work for complex arguments in general. In the specific case of elliptic integrals, most computing environments need their modulus $k$ to be in $(-1,1)$. – J. M. is away Nov 13 '17 at 23:50

## 2 Answers

This is not a Mathematica answer, but more a mathematics one. Elliptic integrals with negative $k$ can be rewritten as Elliptic integrals with parameter (see e.g. Abramowitz and Stegun eqs. 17.4.17 and 17.4.18)

$$\frac{-k}{1-k}$$ which is between 0 and 1 for any negative $k$. Hence Elliptic integrals can be evaluated for any negative $k$.

I have found it best to convert Mathematica's negative k results. For example

SetOptions[Integrate,GenerateConditions->False];

int=Integrate[Cos[phi]/Sqrt[a-b Cos[phi]],{phi,0,2Pi}]
(* (4 a EllipticK[-((2 b)/(a-b))]-4 (a-b) EllipticE[-((2 b)/(a-b))])/(b Sqrt[a-b]) *)


Set up some rules to convert the negative arguments.

Krule = EllipticK[k_] -> EllipticK[k/(k - 1)]/Sqrt[1 - k];

Erule = EllipticE[k_] -> Sqrt[1 - k] EllipticE[k/(k - 1)];

int /. {Krule, Erule} // Simplify // PowerExpand // FullSimplify
(* (4 a EllipticK[(2 b)/(a+b)]-4 (a+b) EllipticE[(2 b)/(a+b)])/(b Sqrt[a+b]) *)


Your c++ code will probably like this better.

If you have an expression with both positive and negative arguments, you will need to apply the rules to the appropriate parts of the expression rather than to all of it.