acb_elliptic.h
#include <flint/acb_elliptic.h>This module evaluates elliptic integrals and elliptic (doubly periodic) functions of complex variables with rigorous error bounds:
- the complete elliptic integrals , and , computed with the arithmetic-geometric mean;
- the incomplete Legendre integrals , and , reduced to Carlson's symmetric integrals;
- the Carlson symmetric integrals , , and the special cases and , computed by the duplication algorithm with a high-order Taylor expansion;
- the Weierstrass functions , , , and for the lattice , and the lattice invariants and roots, computed with Jacobi theta functions.
The modular forms and theta functions on which the Weierstrass functions are built are in acb_modular (genus 1) and acb_theta (any genus). The algorithms are described in Elliptic integrals, elliptic functions and modular forms, following [Joh2019].
Conventions#
- The parameter of the Legendre integrals is the parameter, related to the modulus and the modular angle by (as in [NIST2012, §19.1]).
- In the Weierstrass functions, the lattice is with , that is, the half-periods are and . A general lattice is handled by the homogeneity relations, for instance .
- A nonzero flag
times_pireplaces the amplitude by , which makes the quasi-period 1 instead of and allows exact input at multiples of . - The
flagsarguments of the Carlson integrals are reserved for future use; pass 0. - Outputs may alias inputs. A function returns indeterminate balls (or balls containing the result with infinite radius) when the input is not finite, lies on or straddles a singularity, or the algorithm cannot separate the input from a branch cut.
Complete elliptic integrals#
void acb_elliptic_k(acb_t k, const acb_t m, slong prec)void acb_elliptic_k_jet(acb_ptr w, const acb_t m, slong len, slong prec)Sets w to the Taylor coefficients of at , truncated to length len. The first two coefficients come from evaluated by acb_agm1_cpx, the others from the linear recurrence implied by the hypergeometric differential equation of .
void _acb_elliptic_k_series(acb_ptr res, acb_srcptr m, slong mlen, slong len, slong prec)void acb_elliptic_k_series(acb_poly_t res, const acb_poly_t m, slong len, slong prec)Set res to truncated to length len, for a power series , by composing the output of acb_elliptic_k_jet with the nonconstant part of . The underscore version requires len and reads coefficients of m.
void acb_elliptic_e(acb_t res, const acb_t m, slong prec)Sets res to the complete elliptic integral of the second kind , computed from and by , where is the derivative (not the complementary integral).
void acb_elliptic_pi(acb_t r, const acb_t n, const acb_t m, slong prec)Sets r to the complete elliptic integral of the third kind . For this is and for it is ; otherwise it is computed as , the same reduction as for the incomplete integral, which is slower than the AGM methods for and .
Legendre incomplete elliptic integrals#
The incomplete integrals are computed on the strip by the reductions to Carlson's integrals of [NIST2012, §19.25(i)], with and :
Outside the strip the functions are extended by quasi-periodicity: writing with and , the integral over a full period is added times. If is a ball that contains a point , both neighbouring values of are tried and the union of the results is returned; if it is wider than , the result is indeterminate.
void acb_elliptic_f(acb_t res, const acb_t phi, const acb_t m, int times_pi, slong prec)Sets res to the incomplete elliptic integral of the first kind , extended by . With times_pi nonzero, is replaced by . In particular .
void acb_elliptic_e_inc(acb_t res, const acb_t phi, const acb_t m, int times_pi, slong prec)Sets res to the incomplete elliptic integral of the second kind , extended by . With times_pi nonzero, is replaced by . In particular .
void acb_elliptic_pi_inc(acb_t res, const acb_t n, const acb_t phi, const acb_t m, int times_pi, slong prec)Sets res to the incomplete elliptic integral of the third kind , extended by . With times_pi nonzero, is replaced by . In particular and .
Carlson symmetric integrals#
Carlson's symmetric forms are the preferred form of incomplete elliptic integrals: they are symmetric in their arguments, homogeneous, and can be computed by a duplication algorithm [Car1995]. Every elliptic integral can be expressed in terms of , and , of which and are special cases. Carlson symmetric integrals explains the domains of validity and the choice of method.
Sets res to the Carlson symmetric integral of the first kind , by duplication steps followed by a Taylor series in the elementary symmetric polynomials of the deviations. The result is indeterminate if more than one argument contains zero.
Sets res to the Carlson symmetric integral of the second kind , computed from and . There are no restrictions on the arguments.
void acb_elliptic_rj(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)void acb_elliptic_rj_carlson(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)void acb_elliptic_rj_integration(acb_t res, const acb_t x, const acb_t y, const acb_t z, const acb_t p, int flags, slong prec)Set res to the Carlson symmetric integral of the third kind . The carlson version uses the duplication algorithm, which can give wrong values for some complex arguments; the integration version moves the arguments to the right half-plane by numerical integration; the default version uses the duplication algorithm when it is known to be correct (including the case , which computes ) and integration otherwise.
void acb_elliptic_rc1(acb_t res, const acb_t x, slong prec)Sets res to , a helper for , using a short Taylor series for small .
Weierstrass elliptic functions#
The Weierstrass functions for the lattice are computed from the Jacobi theta functions of acb_modular, which moves to the fundamental domain and reduces before summing the theta series. Because the Weierstrass functions are invariant (or covariant) under the action of the modular group, the cost is multiplications plus the theta series, which needs terms at precision . The reference is [NIST2012, Ch. 23]. When is real and is a multiple of , the functions are real and the imaginary part of the output is set to exactly zero.
void acb_elliptic_p(acb_t r, const acb_t z, const acb_t tau, slong prec)Sets r to the Weierstrass elliptic function , computed by
void acb_elliptic_p_prime(acb_t r, const acb_t z, const acb_t tau, slong prec)Sets r to the derivative with respect to , computed by , where is the Dedekind eta function.
Sets r to the Taylor coefficients of at , truncated to length len, from the theta function jets of acb_modular_theta_jet. With len = 2 this gives , which generate the field of elliptic functions with periods 1 and .
void _acb_elliptic_p_series(acb_ptr res, acb_srcptr z, slong zlen, const acb_t tau, slong len, slong prec)void acb_elliptic_p_series(acb_poly_t res, const acb_poly_t z, const acb_t tau, slong len, slong prec)Set res to truncated to length len, for a power series . The underscore version requires len .
void acb_elliptic_invariants(acb_t g2, acb_t g3, const acb_t tau, slong prec)Sets g2 and g3 to the lattice invariants and , where are the Eisenstein series of acb_modular_eisenstein. They are the coefficients of the differential equation .
void acb_elliptic_inv_p(acb_t res, const acb_t z, const acb_t tau, slong prec)Sets res to the inverse Weierstrass function, a solution of , given by the elliptic integral
void acb_elliptic_zeta(acb_t res, const acb_t z, const acb_t tau, slong prec)Sets res to the Weierstrass zeta function , which satisfies and is quasi-periodic: , with and . It is computed as , where .
References#
- [Joh2019] F. Johansson. Numerical evaluation of elliptic functions, elliptic integrals and modular forms. In J. Blümlein, C. Schneider and P. Paule (eds.), Elliptic Integrals, Elliptic Functions and Modular Forms in Quantum Field Theory, Texts & Monographs in Symbolic Computation, Springer, 2019, 269–293. https://arxiv.org/abs/1806.06725
- [NIST2012] National Institute of Standards and Technology, Digital Library of Mathematical Functions (2012), https://dlmf.nist.gov/
- [Car1995] B. C. Carlson, "Numerical computation of real or complex elliptic integrals". Numerical Algorithms, 10(1):13-26 (1995).
The FLINT team, “acb_elliptic.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/acb_elliptic/index.html (generated 2026-11-02).
@misc{flint-doc-acb-elliptic-index,
author = {{The FLINT team}},
title = {{acb\_elliptic.h (module overview)}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/acb_elliptic/index.html},
note = {Generated 2026-11-02}
}