Elliptic integrals
JAX implementation of GSL elliptic integral functions.
This module provides JAX-compatible implementations of elliptic integrals, specifically the incomplete elliptic integral of the first kind (F).
Functions:
| Name | Description |
|---|---|
ellint_F |
Compute the incomplete elliptic integral of the first kind. |
gsl_sf_elljac_e |
Compute the Jacobian elliptic functions sn(u|m), cn(u|m), dn(u|m). |
ellint_F(phi: FloatLike, k: FloatLike, n_points: int = 1000) -> FloatLike
¤
Compute the incomplete elliptic integral of the first kind.
This function computes F(phi, k) using the Legendre form: F(phi, k) = integral_0^phi dt / sqrt(1 - k^2 sin^2(t))
This is equivalent to GSL's gsl_sf_ellint_F(phi, k, GSL_PREC_DOUBLE).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi
|
FloatLike
|
The amplitude (upper limit of integration) in radians |
required |
k
|
FloatLike
|
The modulus, where 0 <= k^2 <= 1 (note: this is k, not m = k^2) |
required |
n_points
|
int
|
Number of integration points (default: 1000) |
1000
|
Returns:
| Type | Description |
|---|---|
FloatLike
|
The value of F(phi, k) |
Notes
- For k = 0: F(phi, 0) = phi
- For |k| = 1 and |phi| < pi/2: F(phi, +/-1) = arctanh(sin(phi))
- The implementation uses numerical integration via trapezoidal rule
- JAX-compatible (can be used in jit, grad, vmap, etc.)
Examples:
>>> ellint_F(jnp.pi/2, 0.5) # Complete elliptic integral K(0.5)
>>> ellint_F(jnp.pi/4, 0.8) # Incomplete elliptic integral
gsl_sf_elljac_e(u: FloatLike, m: FloatLike, max_iter: int = 16) -> tuple[FloatLike, FloatLike, FloatLike]
¤
Compute the Jacobian elliptic functions sn(u|m), cn(u|m), dn(u|m).
This function computes the Jacobian elliptic functions using the descending Landen transformation, which is the same algorithm used by GSL.
The Jacobian elliptic functions are defined by the inverse of the elliptic integral of the first kind: u = F(phi, k) = integral_0^phi dt / sqrt(1 - k^2 sin^2(t))
Then
sn(u|m) = sin(phi) cn(u|m) = cos(phi) dn(u|m) = sqrt(1 - k^2 sin^2(phi))
where m = k^2 is the parameter (0 <= m <= 1).
This is equivalent to GSL's gsl_sf_elljac_e(u, m, &sn, &cn, &dn).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
FloatLike
|
The argument |
required |
m
|
FloatLike
|
The parameter (m = k^2, where k is the modulus), 0 <= m <= 1 |
required |
max_iter
|
int
|
Maximum number of Landen transformations (default: 16) |
16
|
Returns:
| Type | Description |
|---|---|
tuple[FloatLike, FloatLike, FloatLike]
|
A tuple (sn, cn, dn) containing the three Jacobian elliptic functions |
Notes
- For m = 0: sn(u|0) = sin(u), cn(u|0) = cos(u), dn(u|0) = 1
- For m = 1: sn(u|1) = tanh(u), cn(u|1) = sech(u), dn(u|1) = sech(u)
- The implementation uses the descending Landen transformation for accuracy
- JAX-compatible (can be used in jit, grad, vmap, etc.)
References
- Abramowitz & Stegun, Chapter 16
- GSL library: gsl_sf_elljac.c
- NIST DLMF: https://dlmf.nist.gov/22.20
Examples:
>>> sn, cn, dn = gsl_sf_elljac_e(1.0, 0.5)
>>> sn, cn, dn = gsl_sf_elljac_e(jnp.array([0.5, 1.0]), 0.8)