Elliptic integrals originally arose from the problem of elliptical arc length calculation. Now, elliptic integral is any function having the following form:

where *R(x,y)* is a rational bivariate function, *P(t)* is the square root of a polynomial of degree 3 or 4 with distinct roots, and *c* is a constant. In general, elliptic integrals cannot be expressed in terms of elementary functions. However, with the appropriate reduction formula, every elliptic integral can be brought into a form that involves integrals over rational functions and the three canonical forms (i.e. the elliptic integrals of the first, second and third kind). This module contains subroutines that calculate elliptic integrals of the first and second kind).

Incomplete elliptic integral of the first kind has the following form:

It is calculated by using the **IncompleteEllipticIntegralK** subroutine.

The important special case of incomplete elliptic integral is the complete elliptic integral of the first kind:

It is calculated by using the EllipticIntegralK subroutine.

It should be noted that there is a singularity in *m=1*. In the neighborhood of this point (neighborhood diameter is comparable to machine precision) the calculation accuracy decreases. At the same time, in the neighborhood of 0, numbers are represented with high precision. Therefore, if we need high precision in the neighborhood of singularity, we can use the **EllipticIntegralKHighPrecision** subroutine which calculates not *K(m)*, but *K(1-m)*. This moves singularity in the point *m=0*.

Incomplete elliptic integral of the second kind has the following form:

It is calculated by using the **IncompleteEllipticIntegralE** subroutine.

The important special case of incomplete elliptic integral is the complete elliptic integral of the second kind:

It is calculated by using the EllipticIntegralE subroutine.

*This article is intended for personal use only.*

C# source.

C++ source.

C++ source. MPFR/GMP is used.

GMP source is available from gmplib.org. MPFR source is available from www.mpfr.org.

FreePascal version.

Delphi version.

VB.NET version.

VBA version.

Python version (CPython and IronPython are supported).

ALGLIB® - numerical analysis library, 1999-2017.

ALGLIB is a registered trademark of the ALGLIB Project.

Policies for this site: privacy policy, trademark policy.

ALGLIB is a registered trademark of the ALGLIB Project.

Policies for this site: privacy policy, trademark policy.