Elliptic integrals — API

The MeanFieldHom.Elliptic submodule. All five public names are re-exported at the top level (using MeanFieldHom brings them into scope directly).

MeanFieldHom.EllipticModule
MeanFieldHom.Elliptic

Type-generic complete and incomplete elliptic integrals.

Provides the Legendre integrals $K(m)$, $E(m)$, $F(\varphi, m)$, $E(\varphi, m)$ and Carlson's symmetric integrals $R_F(x, y, z)$, $R_D(x, y, z)$ in a form that works for every Number subtype — Float64, ForwardDiff.Dual, BigFloat, SymPy.Sym, Symbolics.Num, and arbitrary user-defined scalar types.

Dispatch table

Scalar typeBackend
Float64Elliptic.jl (GSL C binding)
ForwardDiff.DualAGM / Carlson (pure arithmetic)
SymPy.Symsympy.elliptic_{k,e,f} via the optional SymPy extension
Symbolics.NumAGM / Carlson (arithmetic-only — verbose but correct; user can simplify())
any other NumberAGM / Carlson

Users can add methods to ell_K, ell_E, ell_F, ell_RF, ell_RD for their own number types — downstream callers will automatically pick them up.

References

  • AGM for $K, E$: Abramowitz & Stegun 17.6, NIST DLMF 19.8.
  • Carlson's symmetric integrals: B.C. Carlson, Numerical computation of real or complex elliptic integrals, Numerical Algorithms 10 (1995) 13-26.
  • Iterative duplication scheme: public-domain SLATEC routines DRF / DRD (B.C. Carlson and E.M. Notis, Ames Laboratory, 1981).
MeanFieldHom.Elliptic.ell_KFunction
ell_K(m) -> T

Complete elliptic integral of the first kind $K(m) = \int_0^{π/2} dθ/\sqrt{1-m\sin^2 θ}$.

m is the parameter (not the modulus): $m = k^2$. Type-generic: works with any Number subtype.

MeanFieldHom.Elliptic.ell_EFunction
ell_E(m) -> T

Complete elliptic integral of the second kind $E(m) = \int_0^{π/2} \sqrt{1-m\sin^2 θ}\,dθ$.

ell_E(φ, m) -> T

Incomplete elliptic integral of the second kind $E(φ, m) = \int_0^φ \sqrt{1-m\sin^2 θ}\,dθ$.

The 1-argument ell_E(m) (complete integral) and the 2-argument ell_E(φ, m) (incomplete integral) coexist via arity dispatch — identical to the convention of Elliptic.jl.

MeanFieldHom.Elliptic.ell_FFunction
ell_F(φ, m) -> T

Incomplete elliptic integral of the first kind $F(φ, m) = \int_0^φ dθ/\sqrt{1-m\sin^2 θ}$.

MeanFieldHom.Elliptic.ell_RFFunction
ell_RF(x, y, z) -> T

Carlson's symmetric elliptic integral of the first kind,

$R_F(x, y, z) = \tfrac{1}{2}\int_0^{\infty} \bigl[(t+x)(t+y)(t+z)\bigr]^{-1/2}\,dt$.

Type-generic: the duplication recursion uses only arithmetic and square roots, so it extends unchanged to BigFloat, ForwardDiff.Dual, Symbolics.Num, SymPy.Sym, and any other Number subtype.

MeanFieldHom.Elliptic.ell_RDFunction
ell_RD(x, y, z) -> T

Carlson's symmetric elliptic integral of the second kind, degenerate in z:

$R_D(x, y, z) = \tfrac{3}{2}\int_0^{\infty} \bigl[(t+z)\sqrt{(t+x)(t+y)(t+z)}\bigr]^{-1}\,dt$.

Same type-generic recursion as ell_RF with the additional $(1, 1, 3)$-weighted mean and a running sum that accounts for the degenerate $(t + z)$ factor (Carlson 1995 §2).

Index