# Elliptic Integrals of the First and Second Kind

Author:
Ryan Hirst
Proposition: Develop a set of formulas for efficient calculation of the Complete and Incomplete Elliptic Integrals of the First and Second kind. Briefly, we take the following approach:
1. Begin with the Integral of the First Kind. - From Gauss, we have a method for transforming the Complete integral to a more rapidly convergent integral in the same form. - Generalize this method to the Incomplete integral - We may iterate as many times as we please.
2. We now address the integral of the second kind - From Legendre and Cayley, we have a set of equations relating the Complete and Incomplete integrals of the First and Second kind. - Introduce the iterated integral into these equations, and carry out the indicated operations.
3. Develop a reverse integral - By bringing both parameters (k, sinθ) near 1, we can make the forward integral nearly as inconvenient as we please. We expend an ever-increasing number of calculations on a vanishing arc. Hence, we - For the Complete integrals, we begin with Cayley's formula for k' very small, and apply steps 1 and 2 above. - For the Incomplete integrals, we rewrite the integrals centered at the other end of the curve (θ = π /2), and choose a substitution of variables which allows the new equation to be expanded and then integrated. We then repeat steps 1 and 2. - the result is a set of integrals which converge more and more rapidly as the two parameters approach 1.
The general problem of calculating an integral of the First or Second kind is thus solved. All steps are described and demonstrated. The formulas are worked out symbolically, but I pay special attention to numerical implementation. All cases of possible subtractive cancellation and divisions by zero are dealt with; the results are exact without the need for extended precision in intermediate calculations. To illustrate the gain in efficiency, I will include an example recipe for the general case: double precision results with at most two (sequential) iterations of the parameter and angle, and a maximum series expansion order of 4. We can always trade a shorter expansion order for another iteration of the parameter. I will provide a takeaway list at the end for those seeking a clear numerical recipe, and no fuss. A word of Caution I emphasize that this is not a new result. Although many of the steps are laborious, and the approach is not obvious until it is done, the steps carried out here are purely mechanical. There seems to be some confusion upon this point in the mathematical community, so let me be clear. By way of an example: Let there be given an equation , where E and F are continuous, differentiable function of θ and k. Now. If, on an exam in first year Calculus, we give this formula to a student, along with the function F, and say, "give me E, free of differentials", I suspect we all agree that the thing to be done is to -in fact- differentiate F, and that it would be nonsense for the student to claim she had obtained a "new" formula simply because she carried out the indicated differentiation, no matter how laborious. And yet this is precisely the matter at hand. The formula above for E is from Cayley, and the function F from Gauss. Though the work here is entirely my own, it should be plain upon examination that all I have done is carried out the instructions left by others. Attribution The material here is free for anyone to use, for any purpose; all that is required under Creative Commons is that you not claim the work as your own if it is not.