# Elliptic Integrals

 Function Library Home Elliptic Integrals

## Table of Available Elliptic Integrals

### Legendre's Elliptic Integral of the First Kind

Legendre's elliptic integral of the first kind is defined as
F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ.
The upper limit, φ, is called the amplitude and the parameter k is called the modulus. The integral is even in k and odd in φ. When k = 0 or | k | = 1 the integral can be readily evaluated, otherwise it must be approximated.
The arguments of the elliptic integral of the first kind are also given as F(φ \ α) or F(φ | m) where the angle α, called the modular angle, satisfies k = sin(α) and the argument m = k² is simply called the parameter. In terms of these arguments F(φ \ α) = F(φ, sin( α )) and F(φ | m) = F(φ, √ m ). The parameter k' = √(1 - k²) is called the complementary modulus.
If φ = π / 2, the integral as a function of the modulus k, modular angle α, or parameter m is called the complete elliptic integral of the first kind.
If the modulus k = 0 or equivalently if the modular angle α = 0 or the parameter m = 0
F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ = ∫0φ   dθ = φ.

If the modulus | k | = 1 or equivalently if the modular angle α = ± π / 2 or the parameter m = 1 then if | φ | < π / 2 then
F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2  dθ = ∫0φ( 1 - sin2θ) -1/2  dθ = sgn(φ) ln( tan( π / 4 - | &phi | / 2 ) ).
and if | φ | ≥ π / 2 then
F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2  dθ = ∫0φ( 1 - sin2θ) -1/2  dθ = sgn(φ) ∞.

If the modulus | k | > 1 or equivalently if the parameter m > 1 then if | sin(φ) | < 1 / | k | then the integral is real and
F(φ,k) = F(arcsin( | k | sin φ ), 1 / k) / | k |.

If the parameter m < 0 or equivalently if the modulus is purely imaginary then setting the modulus to ik and letting k' = √(1 - (ik)²) be the complementary modulus
F(φ,ik) = [ K( k / k' ) - F(π / 2 - φ ), k / k') ] / k'.

#### Function List

• double Legendre_Elliptic_Integral_First_Kind( double amplitude, char arg, double x )

This function returns either F(φ, x) or F(φ\ x) or F(φ | x) depending on whether arg = 'k' or arg = 'a' or arg = 'm' respectively, where φ is given by the argument amplitude in radians. If arg = 'a' then x is measured in radians.
If arg = 'k' and | x | = 1 or if arg = 'm' and x = 1, then if amplitude = ± M_PI / 2, where M_PI is the value of π as given in float.h, then sgn(amplitude) DBL_MAX is returned. ( Note that π is irrational and cannot be stored exactly as a type double, therefore it is assumed that the value stored in amplitude is the approximation to the exact value of π / 2.)
If arg = 'k' and | x | > 1 or if arg = 'm' and x > 1, then the returned value is Re F(φ, x) or Re F(φ | x) respectively.

#### Source Code

C source code is available for this routine:

### Legendre's Elliptic Integral of the Second Kind

Legendre's elliptic integral of the second kind is defined as
E(φ,k) = ∫0φ ( 1 - k2 sin2θ) 1/2   dθ.
The upper limit, φ, is called the amplitude and the parameter k is called the modulus. The integral is even in k and odd in φ. When k = 0 or | k | = 1 the integral can be readily evaluated, otherwise it must be approximated.
The arguments of the elliptic function of the second kind are also given as E(φ \ α) or E(φ | m) where the angle α, called the modular angle, satisfies k = sin(α) and the argument m = k² is simply called the parameter. In terms of these arguments E(φ \ α) = E(φ, sin( α )) and E(φ | m) = E(φ, √ m ). The parameter k' = √(1 - k²) is called the complementary modulus.
If φ = π / 2, the integral as a function of the modulus k, modular angle α, or parameter m is called the complete elliptic integral of the second kind.
If the modulus k = 0 or equivalently if the modular angle α = 0 or the parameter m = 0
E(φ,k) = ∫0φ ( 1 - k2 sin2θ) 1/2   dθ = ∫0φ   dθ = φ.

If the modulus | k | = 1 or equivalently if the modular angle α = ± π / 2 or the parameter m = 1 then if | φ | < π / 2 then
E(φ,k) = ∫0φ ( 1 - k2 sin2θ) 1/2  dθ = ∫0φ( 1 - sin2θ) 1/2  dθ = ∫0φ| cos θ | dθ = sin φ.
and if | φ | ≥ π / 2 then
E(φ,k) = ∫0φ ( 1 - k2 sin2θ) 1/2  dθ = ∫0φ| cos θ | dθ = sgn(φ) [ n + sin(φ - n π) ],
where n = [ ( | φ | - π / 2 ) / π ].
If the modulus | k | > 1 or equivalently if the parameter m > 1 then if | sin(φ) | < 1 / | k | then the integral is real and
E(φ,k) = |k| E(arcsin( | k | sin φ ), 1 / k) + ( 1 / | k | - | k | ) F(arcsin( | k | sin φ ), 1 / k).

If the parameter m < 0 or equivalently if the modulus is purely imaginary then setting the modulus to ik and letting k' = √(1 - (ik)²) be the complementary modulus
E(φ,ik) = k' [ E( k / k' ) - E(π / 2 - φ ), k / k') ].

For the routine programmed below, the amplitude, φ, must satisfy the condition
| φ | ≤ π / 2.

#### Function List

• double Legendre_Elliptic_Integral_Second_Kind(double amplitude, char arg, double x)

This function returns either E(φ, x) or E(φ\ x) or E(φ | x) depending on whether arg = 'k' or arg = 'a' or arg = 'm' respectively, where φ is given by the argument amplitude in radians. If arg = 'a' then x is measured in radians.
If arg = 'k' and | x | > 1 or if arg = 'm' and x > 1, then the returned value is Re E(φ, x) or Re E(φ | x) respectively.
The magnitude of the amplitude must be less than or equal to π / 2.

#### Source Code

C source code is available for this routine:

### Complete Elliptic Integral of the First Kind

The complete elliptic integral of the first kind is defined as
K(k) = ∫0π / 2 ( 1 - k2 sin2θ) -1/2   dθ.
The parameter k is called the modulus. The integral is even in k. When k = 0 or | k | = 1 the integral can be readily evaluated, otherwise it must be approximated.
The arguments of the elliptic function of the first kind are also given as K(α) or K(m) where the angle α, called the modular angle, satisfies k = sin(α) and the argument m = k² is simply called the parameter. In terms of these arguments K(α) = K(sin( α )) and K(m) = K(√ m ). The parameter k' = √(1 - k²) is called the complementary modulus.
If the modulus k = 0 or equivalently if the modular angle α = 0 or the parameter m = 0
K(k) = ∫0π / 2 ( 1 - k2 sin2θ) -1/2   dθ = ∫0π / 2   dθ = π / 2.

If the modulus | k | = 1 or equivalently if the modular angle α = ± π / 2 or the parameter m = 1 then
K(k) = ∫0π / 2 ( 1 - k2 sin2θ) -1/2  dθ = ∫0π / 2( 1 - sin2θ) -1/2  dθ → ∞.

If the modulus | k | > 1 or equivalently if the parameter m > 1 then the integral is not defined.
If the parameter m < 0 or equivalently if the modulus is purely imaginary then setting the modulus to ik and letting k' = √(1 - (ik)²) be the complementary modulus
K(ik) = K( k / k' ) / k'.

#### Function List

• double Complete_Elliptic_Integral_First_Kind(char arg,double x)

This function returns K(x) where the interpretation of x depends on the value of the argument arg. If arg = 'k', then x is interpreted as the modulus, if arg = 'a', then x is interpreted as the modular angle in radians, or if arg = 'm' then x is interpreted as the parameter.
The argument x is restricted to those values for which 0 ≤ m ≤ 1, i.e. if arg = 'k', then
| x | ≤ 1 and if arg = 'm', then 0 ≤ x ≤ 1. If arg = 'k' and | x | = 1 or if arg = 'm' and x = 1, then DBL_MAX is returned.

#### Source Code

C source code is available for this routine:

### Complete Elliptic Integral of the Second Kind

The complete elliptic integral of the second kind is defined as
E(k) = ∫0π / 2 ( 1 - k2 sin2θ) 1/2   dθ.
The parameter k is called the modulus. The integral is even in k. When k = 0 or | k | = 1 the integral can be readily evaluated, otherwise it must be approximated.
The arguments of the elliptic function of the second kind are also given as E(α) or E(m) where the angle α, called the modular angle, satisfies k = sin(α) and the argument m = k² is simply called the parameter. In terms of these arguments E( α) = E(sin( α )) and
E(m) = E( √ m ). The parameter k' = √(1 - k²) is called the complementary modulus.
If the modulus k = 0 or equivalently if the modular angle α = 0 or the parameter m = 0
E(k) = ∫0π / 2 ( 1 - k2 sin2θ) 1/2   dθ = ∫0π / 2   dθ = π / 2.

If the modulus | k | = 1 or equivalently if the modular angle α = ± π / 2 or the parameter m = 1 then if | φ | < π / 2 then
E(k) = ∫0π / 2 ( 1 - k2 sin2θ) 1/2  dθ
E(±1) = ∫0π / 2( 1 - sin2θ) 1/2  dθ = ∫0π / 2 cos θ  dθ = sin( π / 2 ) = 1.

If the modulus | k | > 1 or equivalently if the parameter m > 1 then the integral is complex valued.
If the parameter m < 0 or equivalently if the modulus is purely imaginary then setting the modulus to ik and letting k' = √(1 - (ik)²) be the complementary modulus
E(ik) = k' E( k / k' ) .

#### Function List

• double Complete_Elliptic_Integral_Second_Kind(char arg, double x)

This function returns E(x) where the interpretation of x depends on the value of the argument arg. If arg = 'k', then x is interpreted as the modulus, if arg = 'a', then x is interpreted as the modular angle in radians, or if arg = 'm' then x is interpreted as the parameter.
The argument x is restricted to those values for which 0 ≤ m ≤ 1, i.e. if arg = 'k', then
| x | ≤ 1 and if arg = 'm', then 0 ≤ x ≤ 1.

#### Source Code

C source code is available for this routine:

### Elliptic Integrals of the First and Second Kind

The Legendre elliptic integral of the first kind, the complete elliptic integral of the first kind, Legendre elliptic integral of the second kind. and the complete elliptic integral of the second kind are described above.

#### Function List

• void Legendre_Elliptic_Integrals(double amplitude, char arg, double x, double* F, double* K, double* E, double* Ek)

This function returns F(φ,x), K(x), E(φ,x), and E(x) where the interpretation of x depends on the value of the argument arg. If arg = 'k', then x is interpreted as the modulus, if arg = 'a', then x is interpreted as the modular angle in radians, or if
arg = 'm' then x is interpreted as the parameter. F(φ,x) is returned in F, K(x) is returned in K, E(φ,x) is returned in E, and E(x) is returned in Ek.
The argument x is restricted to those values for which 0 ≤ m ≤ 1, i.e. if arg = 'k', then
| x | ≤ 1 and if arg = 'm', then 0 ≤ x ≤ 1.

#### Source Code

C source code is available for this routine:

### The file, Complete Elliptic Integrals of the First and Second Kind

The complete elliptic integral of the first kind and the complete elliptic integral of the second kind are described above.

#### Function List

• void Complete_Elliptic_Integrals(char arg, double x, double* Fk, double* Ek)

This function returns K(x) and E(x) where the interpretation of x depends on the value of the argument arg. If arg = 'k', then x is interpreted as the modulus, if arg = 'a', then x is interpreted as the modular angle in radians, or if arg = 'm' then x is interpreted as the parameter. K(x) is returned in Fk and E(x) is returned in Ek.
The argument x is restricted to those values for which 0 ≤ m ≤ 1, i.e. if arg = 'k', then
| x | ≤ 1 and if arg = 'm', then 0 ≤ x ≤ 1.

#### Source Code

C source code is available for this routine:

### Heuman's Lambda Naught

Heuman's lambda naught function is defined as
Λ0(&phi,k) = (2 / π) { K(k) E(&phi,k') - [K(k) - E(k)] F(φ,k') }

#### Function List

• double Heumans_Lambda_Naught(double amplitude, double modular_angle )

This function returns the Heuman's lambda naught function given above for
φ = amplitude and k = sin α where α = modular_angle. Both the amplitude and modular_angle are measured in radians.

#### Source Code

C source code is available for this routine:
• The file, heumans_lambda_naught.c, contains the function Heumans_Lambda_Naught( ).

Dependencies: In addition to the file heumans_lambda_naught.c, the function Heumans_Lambda_Naught() requires the following files:

### Jacobi's Zeta Function

Jacobi's zeta function is defined as
Z(φ,k) = E(φ,k) - E(k) F(φ,k) / K(k)

#### Function List

• double Jacobi_Zeta_Function(double amplitude, char arg, double x )

This function returns Z(φ, x) given above for φ = amplitude, in radians, and where the interpretation of x depends on the value of the argument arg. If arg = 'k', then x is interpreted as the modulus, if arg = 'a', then x is interpreted as the modular angle in radians, or if arg = 'm' then x is interpreted as the parameter.
The argument x is restricted to those values for which 0 ≤ m ≤ 1, i.e. if arg = 'k', then
| x | ≤ 1 and if arg = 'm', then 0 ≤ x ≤ 1.

#### Source Code

C source code is available for this routine:
• The file, jacobi_zeta_function.c, contains the function Jacobi_Zeta_Function( ).

Dependencies: No external dependencies.