Error functions, incomplete gamma functions and exponential integrals
The error function, the incomplete gamma function and the exponential integrals are confluent hypergeometric functions with one parameter fixed or tied to the argument:
Their evaluation therefore follows Hypergeometric functions: a convergent series near the origin, the asymptotic expansion of with Olver's error bound for large , and a working precision chosen from the cancellation of the series.
Error functions#
FLINT uses three representations of the error function:
For the terms of the first series have size up to about when and the function has size about , so the series loses about bits; the second series has the opposite behaviour (by Kummer's transformation), losing about . acb_hypgeom_erf uses the second series if and the first otherwise, at a working precision raised by bits, and the asymptotic expansion when its error term is below , computing the term at the lower precision that its small prefactor allows. For inexact , the series is evaluated at the midpoint and acb_hypgeom_erf_propagated_error bounds the propagated error with the derivative . The complementary function is computed from the representation without the subtraction when is large and positive, and . The normalized Fresnel integrals satisfy [NIST2012, 7.5]
and acb_hypgeom_fresnel computes them from for a real multiple of , so that the square inside the error function is computed without rounding of the real part.
Real arguments#
For real , arb_hypgeom_erf uses
whose terms are positive, so that no precision is lost. Since , the tail after terms is at most the tail of the series of , and is chosen with the Lambert function. The sum is computed by rectangular splitting (_arb_hypgeom_gamma_lower_sum_rs_1): with powers of , the coefficients are accumulated as products of the word-size factors , and only about multiplications of full-precision numbers are needed. For the asymptotic expansion
whose remainder is bounded by the first omitted term for real , is used when it reaches the target accuracy; its sum is also computed by rectangular splitting (_arb_hypgeom_gamma_upper_sum_rs_1). arb_hypgeom_erfc uses the asymptotic expansion whenever possible and otherwise the convergent series at a working precision increased by bits.
Incomplete gamma functions#
The upper incomplete gamma function is computed from
The first form is the asymptotic expansion , whose error bound from Asymptotic expansions depends on . The two convergent forms differ by Kummer's transformation; the second is used for and the third for , so that the series has terms of equal sign on the real axis. For a nonpositive integer, has a pole that cancels with the series, and the limit
is used instead. acb_hypgeom_gamma_upper chooses the asymptotic expansion for nonnegative real and when (an empirical fit of the region where it reaches bits), and for other arguments when acb_hypgeom_u_use_asymp holds and is a positive integer or lies in one of Olver's regions. The lower incomplete gamma function is , computed with acb_hypgeom_m (regularized when requested), which applies the same choices. The regularized forms , and are computed directly with regularized hypergeometric functions, so that they are defined at the poles of .
Rational parameters and the bit-burst algorithm#
For a rational parameter and real , the internal functions _arb_hypgeom_gamma_upper_fmpq_inf_bsplit and _arb_hypgeom_gamma_lower_fmpq_0_bsplit sum the asymptotic expansion at infinity and the Taylor series
at zero by binary splitting, with truncation errors bounded by the corresponding _choose_N functions for a prescribed absolute tolerance. This is efficient only when has few bits. For a full-precision , arb_hypgeom_erf_bb applies the bit-burst algorithm (The bit-burst algorithm) to :
- is truncated to 64 fractional bits (or more if is tiny), and is computed with the asymptotic series if it reaches the tolerance and as otherwise.
- For , is truncated to bits, and
_arb_gamma_upper_fmpq_step_bsplitcomputes from and with the Taylor expansion at ; the coefficients satisfy a recurrence from the differential equation of , so the step is a product of polynomial matrices computed by binary splitting, with a Cauchy-type bound for the truncation error. - A last step goes from the last truncation to itself.
The working precisions of the two parts are adjusted to the absolute tolerance needed for or (with cancellation when is computed from the lower series). arb_hypgeom_erf and arb_hypgeom_erfc use this method above 30000 bits for moderately large ; it costs , compared with full multiplications plus cheap ones for rectangular splitting. The same functions are used by acb_dirichlet for the incomplete gamma functions in the approximate functional equation of Dirichlet -functions at rational .
Incomplete beta function#
are computed with acb_hypgeom_2f1, and inherit its transformations and analytic continuation (The Gauss hypergeometric function).
Exponential, logarithmic and trigonometric integrals#
The generalized exponential integral is (acb_hypgeom_expint). The other integrals have the representations
and similar ones for and , while . The logarithmic terms implement the branch cuts of Mathematica: , and have a cut on , and the combination equals except on the cut, where it averages the two sides. For each function the automatic version compares the accuracy of the asymptotic expansion ( bits) with that of the series after cancellation, as for and .
For real arguments, arb_hypgeom_si and arb_hypgeom_ci avoid complex arithmetic: the convergent series are summed with arb_hypgeom_sum_fmpq_arb at a working precision raised by bits, and the asymptotic expansions
where , with arb_hypgeom_sum_fmpq_imag_arb in powers of ; the error of the asymptotic expansion is bounded by the first omitted term . The number of terms of the asymptotic expansion is the first for which this bound is below , if the bound reaches it before it starts to grow.
Use in FLINT#
- Error functions:
acb_hypgeom_erf,acb_hypgeom_erfc,acb_hypgeom_erfiand the methodsacb_hypgeom_erf_1f1a,acb_hypgeom_erf_1f1b,acb_hypgeom_erf_asymp; real versionsarb_hypgeom_erf,arb_hypgeom_erfcwitharb_hypgeom_erf_bb; inversesarb_hypgeom_erfinv,arb_hypgeom_erfcinv(Newton iteration, see Error functions of a real ball); Fresnel integralsacb_hypgeom_fresnel. - Incomplete gamma and beta functions:
acb_hypgeom_gamma_upperand its methods,acb_hypgeom_gamma_lower,acb_hypgeom_beta_lower, the real wrappers,arb_hypgeom_gamma_upper_integration, and the rational-parameter functions_arb_hypgeom_gamma_upper_fmpq_inf_bsplit,_arb_hypgeom_gamma_lower_fmpq_0_bsplit,_arb_gamma_upper_fmpq_step_bsplit. - Exponential integrals:
acb_hypgeom_expint,acb_hypgeom_ei,acb_hypgeom_si,acb_hypgeom_ci,acb_hypgeom_shi,acb_hypgeom_chi,acb_hypgeom_liand the real versions, witharb_hypgeom_siandarb_hypgeom_ciimplemented directly. - All of them have power series versions (
_series), which compute the constant term with the scalar function and the other coefficients by integrating the derivative, which is elementary: , , , and so on.
Referenced from#
acb_dirichlet_l_fmpq,acb_dirichlet_l_fmpq_afe- acb_hypgeom.h (module)
- Hypergeometric functions (algorithm)
- Error functions of a real ball
- gr_special.h (module)
References#
- [NIST2012] National Institute of Standards and Technology, Digital Library of Mathematical Functions (2012), https://dlmf.nist.gov/
The FLINT team, “Error functions, incomplete gamma functions and exponential integrals,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/special-functions/error-functions.html (generated 2026-11-02).
@misc{flint-doc-algorithms-special-functions-error-functions,
author = {{The FLINT team}},
title = {{Error functions, incomplete gamma functions and exponential integrals}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/special-functions/error-functions.html},
note = {Generated 2026-11-02}
}