# Elliptic Functions

 Function Library Home Elliptic Functions

## Table of Available Elliptic Functions

### Elliptic Amplitude Function

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 φ. The arguments of the elliptic function 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.
The elliptic amplitude function for fixed modulus k, modular angle α, or parameter m is the inverse function of Legendre's elliptic function of the first kind F(φ,k) i.e. if
u = F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ.
then
am(u,k) = φ.

#### Function List

• double Jacobi_am(double u, char arg, double x)

This function returns either am(u, x) or am(u \ x) or am(u | x) depending on whether
arg = 'k' or arg = 'a' or arg = 'm' respectively. If arg = 'a' then x is measured in radians. The returned amplitude is given in units of radians.

#### Source Code

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

Dependencies: No external dependencies.

### Sinus Amplitudinis Function - sn

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 φ. The arguments of the elliptic function 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.
The elliptic amplitude function for fixed modulus k, modular angle α, or parameter m is the inverse function of Legendre's elliptic function of the first kind F(φ,k) i.e. if
u = F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ.
then
am(u,k) = φ.

The sinus amplitudinis function sn is defined as
sn(u,k) = sin(am(u,k)) = sin φ.

#### Function List

• double Jacobi_sn(double u, char arg, double x)

This function returns either sn(u, x) or sn(u \ x) or sn(u | 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.

#### Source Code

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

Dependencies: In addition to the file jacobi_sn.c, the function Jacobi_sn() requires the following file:

### Cosinus Amplitudinis Function - cn

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 φ. The arguments of the elliptic function 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.
The elliptic amplitude function for fixed modulus k, modular angle α, or parameter m is the inverse function of Legendre's elliptic function of the first kind F(φ,k) i.e. if
u = F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ.
then
am(u,k) = φ.

The cosinus amplitudinis function cn is defined as
nobr>cn(u,k) = cos(am(u,k)) = cos φ.

#### Function List

• double Jacobi_cn(double u, char arg, double x)

This function returns either cn(u, x) or cn(u \ x) or cn(u | 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.

#### Source Code

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

Dependencies: In addition to the file jacobi_cn.c, the function Jacobi_cn() requires the following file:

### Delta Amplitudinis Function - dn

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 φ. The arguments of the elliptic function 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.
The elliptic amplitude function for fixed modulus k, modular angle α, or parameter m is the inverse function of Legendre's elliptic function of the first kind F(φ,k) i.e. if
u = F(φ,k) = ∫0φ ( 1 - k2 sin2θ) -1/2   dθ.
then
am(u,k) = φ.

The delta amplitudinis function dn is defined as
dn(u,k) = √(1-k²sin(am(u,k))) = √(1-k²sn((u,k)).

#### Function List

• double Jacobi_dn(double u, char arg, double x)

This function returns either dn(u, x) or dn(u \ x) or dn(u | 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.

#### Source Code

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

Dependencies: In addition to the file jacobi_dn.c, the function Jacobi_dn() requires the following file:

### Copolar Triplets

The Jacobi elliptic functions sn, cn, dn are said to be a copolar triplet of type n. After defining nn to be the function identically equal to 1, one can construct 3 additional sets of copolar triplets, namely:
the copolar triplet of type s,
 cs(u,k) = cn(u,k) / sn(u,k) = cot(am(u,x)). ds(u,k) = dn(u,k) / sn(u,k) = √(1-k²sin(am(u,k))) / sin(am(u,k). ns(u,k) = 1 / sn(u,k) = csc(am(u,k))).
the copolar triplet of type c,
 sc(u,k) = sn(u,k) / cn(u,k) = tan(am(u,x)). dc(u,k) = dn(u,k) / cn(u,k) = √(1-k²sin(am(u,k))) / cos(am(u,k). nc(u,k) = 1 / cn(u,k) = sec(am(u,k))).
the copolar triplet of type d,
 sd(u,k) = sn(u,k) / dn(u,k) = sin(am(u,k) / √(1-k²sin(am(u,k))). cd(u,k) = cn(u,k) / dn(u,k) = cos(am(u,k) / √(1-k²sin(am(u,k))). nd(u,k) = 1 / dn(u,k) = 1 / √(1-k²sin(am(u,k))).

#### Function List

• void Jacobi_sn_cn_dn(double u, char arg, double x, double* sn, double* cn, double* dn)

This function returns either the n-type copolar triplet sn(u,x),cn(u,x),dn(u,x), or
sn(u \ x),cn(u \ x),dn(u \ x) or sn(u | x),cn(u | x),dn(u | x) depending on whether
arg = 'k' or arg = 'a' or arg = 'm' respectively. sn(u,x) is returned in sn, cn(u,x) is returned in cn, and dn(u,x) is returned in dn.

• void Jacobi_cs_ds_ns(double u, char arg, double x, double* cs, double* ds, double* ns)

This function returns either the s-type copolar triplet cs(u,x),ds(u,x),ns(u,x), or
cs(u \ x),ds(u \ x),ns(u \ x) or cs(u | x),ds(u | x),ns(u | x) depending on whether
arg = 'k' or arg = 'a' or arg = 'm' respectively. cs(u,x) is returned in cs, ds(u,x) is returned in ds, and ns(u,x) is returned in ns.

• void Jacobi_sc_dc_nc(double u, char arg, double x, double* sc, double* dc, double* nc)

This function returns either the c-type copolar triplet sc(u,x),dc(u,x),nc(u,x), or
sc(u \ x),dc(u \ x),nc(u \ x) or sc(u | x),dc(u | x),nc(u | x) depending on whether
arg = 'k' or arg = 'a' or arg = 'm' respectively. sc(u,x) is returned in sc, dc(u,x) is returned in dc, and nc(u,x) is returned in nc.

• void Jacobi_sd_cd_nd(double u, char arg, double x, double* sd, double* cd, double* nd)

This function returns either the d-type copolar triplet sd(u,x),cd(u,x),nd(u,x), or
sd(u \ x),cd(u \ x),nd(u \ x) or sd(u | x),cd(u | x),nd(u | x) depending on whether
arg = 'k' or arg = 'a' or arg = 'm' respectively. sd(u,x) is returned in sd, cd(u,x) is returned in cd, and nd(u,x) is returned in nd.

#### Source Code

C source code is available for these routines:
• The file, jacobi_elliptic_functions.c, contains the functions Jacobi_sn_cn_dn( ), Jacobi_cs_ds_ns( ), Jacobi_sc_dc_nc( ), and Jacobi_sd_cd_nd( ).

Dependencies: In addition to the file jacobi_elliptic_functions.c, the functions Jacobi_sn_cn_dn( ), Jacobi_cs_ds_ns( ), Jacobi_sc_dc_nc( ), and Jacobi_sd_cd_nd( ) require the following file:

### Inverse Elliptic Functions

The Jacobi elliptic functions sn() and cn() are periodic with period 2K and the elliptic function dn() is periodic with period K where K is the complete elliptic integral of the first kind. Therefore, if K is finite, the inverse elliptic functions are multi-valued and only the principal values are calculated. In general the domain and range of the inverse of the elliptic functions depend on the modulus, modular angle, or parameter.
For the inverse sn() function:
If k = 0, then
 sn -1(*,0): [-1,1] → [-π / 2, π / 2] sn -1(x,0) = asin(x)
If 0 < | k | < 1, then
 sn -1(*,0): [-1,1] → [-K,K] sn -1(x,0) = F(asin(x),k)
If | k | = 1, then
 sn -1(*,k): (-1,1) → R sn -1(x,k) = atanh(x)
If | k | > 1, then
 sn -1(*,k): [-1 / | k |,1 / | k |] → [-K(1 / k) / | k |,K(1 / k) / | k |] sn -1(x,k) = sn -1(k x, 1 / k) / k
If m < 0, then
 sn -1(*,ik): [-1,1] → [-K(k / k') / k',K(k / k') / k'] sn -1(x,ik) = sd -1(k' x, k / k') / k'
For the inverse cn() function:
If k = 0, then
 cn -1(*,0): [-1,1] → [0,π] cn -1(x,0) = acos(x)
If 0 < | k | < 1, then
 cn -1(*,k): [-1,1] → [0,2K] cn -1(x,k) = F(acos(x),k)
If | k | = 1, then
 cn -1(*,k): (0,1] → [0,∞) cn -1(x,k) = asech(x)
If | k | > 1, then
 cn -1(*,k): [√(1 - 1 / k²),1] → [0,K(1 / k) / | k |] cn -1(x,k) = dn -1(x, 1 / k) / k
If m < 0, then
 cn -1(*,ik): [-1,1] → [0, 2K(k / k') / k'] cn -1(x,ik) = cd -1(x, k / k') / k'
For the inverse dn() function:
If k = 0, then
 dn(u,0) = 1 identically dn -1(*,0): [1,1] → [0,0] dn -1(x,0) = 0
If 0 < | k | < 1, then
 dn -1(*,k): [k',1] → [0,K] dn -1(x,k) = F(asin(√(1 - x²) / | k |),k)
If | k | = 1, then
 dn -1(*,k): (0,1] → [0,∞) dn -1(x,k) = asech(x)
If | k | > 1, then
 cn -1(*,k): [-1,1] → [0,2K(1 / k) / | k |] dn -1(x,k) = cn -1(x, 1 / k) / k
If m < 0, then
 dn -1(*,ik): [1,k'] → [0, K(k / k') / k'] dn -1(x,ik) = nd -1(x, k / k') / k'

#### Function List

• double Inverse_Jacobi_sn(double x, char arg, double param)

This routine returns the principal value of the inverse of the Jacobi sn elliptic function for fixed modulus k, modular angle α, or parameter m at x, i.e. this routine returns u where x = sn(u,k) = sn(u \ α) = sn(u | m). Note that:
 If m < 1 then -1 ≤ x ≤ 1 If m = 1 then -1 < x < 1 If m > 1 then -1 / k ≤ x ≤ 1 / k
If m = 1 and x = ±1, then sgn(x) DBL_MAX is returned.
This determination of which form of the inverse elliptic is used: either sn-1(x, param) or sn-1(x \ param) or sn-1(x | param) depends on whether arg = 'k' or arg = 'a' or arg = 'm' respectively. If arg = 'a' then param is measured in radians.

• double Inverse_Jacobi_cn(double x, char arg, double param)

This routine returns the principal value of the inverse of the Jacobi cn elliptic function for fixed modulus k, modular angle α, or parameter m at x, i.e. this routine returns u where x = cn(u,k) = cn(u \ α) = cn(u | m). Note that:
 If m < 1 then -1 ≤ x ≤ 1 If m = 1 then -1 < x < 1 If m > 1 then -1 / k ≤ x ≤ 1 / k
If m = 1 and x = 0, then DBL_MAX is returned.
This determination of which form of the inverse elliptic is used: either cn-1(x, param) or cn-1(x \ param) or cn-1(x | param) depends on whether arg = 'k' or arg = 'a' or arg = 'm' respectively. If arg = 'a' then param is measured in radians.

• double Inverse_Jacobi_dn(double x, char arg, double param)

This routine returns the principal value of the inverse of the Jacobi dn elliptic function for fixed modulus k, modular angle α, or parameter m at x, i.e. this routine returns u where x = dn(u,k) = dn(u \ α) = dn(u | m). Note that:
 If m < 1 then -1 ≤ x ≤ 1 If m = 1 then -1 < x < 1 If m > 1 then -1 / k ≤ x ≤ 1 / k
If m = 1 and x = 0, then DBL_MAX is returned.

This determination of which form of the inverse elliptic is used: either dn-1(x, param) or dn-1(x \ param) or dn-1(x | param) depends on whether arg = 'k' or arg = 'a' or
arg = 'm' respectively. If arg = 'a' then param is measured in radians.

#### Source Code

C source code is available for these routines:
• The file, inverse_jacobi_elliptic_functions.c, contains the functions Inverse_Jacobi_sn( ), Inverse_Jacobi_cn( ), and Inverse_Jacobi_dn( ).

Dependencies: In addition to the file inverse_jacobi_elliptic_functions.c, the functions Inverse_Jacobi_sn( ), Inverse_Jacobi_cn( ), and Inverse_Jacobi_dn( ) require the following files:

### Nome

The nome q is defined as
q = exp(- π * K' / K),
where K is the complete elliptic integral of the first kind with modulus k and K' is the complete elliptic integral of the first kind with modulus k' the complementary modulus. If the modulus
k = 0, K' is infinite and q = 0. If the modulus k = 1, K is infinite and q = 1.

#### Function List

• double Nome(double k)

This function returns the nome described above where the argument k is the modulus used to calculate the complete elliptic integral of the first kind K and the complementary modulus k' = √(1 - k²) is used to calculate K'. The modulus k must satisfy the condition | k | ≤ 1

#### Source Code

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

Dependencies: In addition to the file nome.c, the function Nome() requires the following file: