FLINT3.7.0-dev
Module · 147 functions

arb_hypgeom.h

#include <flint/arb_hypgeom.h>

This module evaluates hypergeometric and related special functions of real arguments given as balls (arb_t) or real power series (arb_poly_t), with rigorous error bounds. It provides the functions of acb_hypgeom for real variables. Most of them convert their arguments to complex balls, call the complex function, and return the real part. A smaller set is implemented directly for real arguments because a dedicated algorithm is much faster there: the gamma function and rising factorials, the error functions and their inverses, the sine and cosine integrals, central binomial coefficients, Legendre polynomials Pn(x)P_n(x) of integer degree and their roots, the real zeros of the Airy functions, the incomplete gamma function at rational parameters, and finite hypergeometric sums with rational parameters. Several functions also have variants based on rigorous numerical integration, which work for large parameters where series expansions fail.

Evaluating special functions explains how FLINT evaluates special functions and which methods each function uses; The gamma function and Hypergeometric functions describe the two main families of algorithms in detail. The same functions are available through the generic interface of gr_special: for the context of real balls (gr_ctx_init_real_arb), gr_gamma, gr_erf, gr_hypgeom_2f1, gr_bessel_j and their relatives call the functions documented here.

OverviewEvaluating special functionsHow FLINT evaluates special functions with rigorous error bounds — the common principles (enclosures, error propagation, cancellation-aware working precision, argument reduction, convergent and asymptotic expansions, analytic continuation, caching) and a map of the methods to the functions and modules that use them.

Conventions#

  • Precision and accuracy. Every function returns a ball that contains the exact value of the function at every point of the input balls. The working precision prec bounds the relative accuracy of the result, which is close to prec bits for exact inputs away from zeros and singularities of the function; the functions add guard bits internally to compensate for the cancellation they can predict. For inexact inputs, most functions evaluate at the midpoint and add a bound for the propagated error, and lower the working precision to what the accuracy of the input justifies.
  • Undefined values. If the function is undefined or not real at some point of the input (a pole, a branch cut, a real argument for which the value is complex), or if no finite enclosure could be computed, the output is indeterminate (NaN midpoint, infinite radius; see arb_indeterminate). The functions that wrap a complex function return an indeterminate result whenever the complex result is not finite or has an imaginary part that is not exactly zero. An indeterminate or very wide result for a valid input means that the input is too wide or the precision too low, not that the function is undefined; increasing prec usually helps.
  • Aliasing. Inputs and outputs of the functions taking arb_t arguments may be the same object, except where stated (the jet functions). The underscore power series functions require positive lengths, write exactly len coefficients and must not have the output overlap the input; the non-underscore versions accept any lengths and aliasing.
  • Optional outputs. Functions that compute several related values (Fresnel integrals, Airy functions, Coulomb functions, Legendre polynomials with their derivative) accept NULL for the outputs that are not wanted, and then skip their computation when this saves time.
  • Regularized and normalized variants. An int argument regularized selects the regularized function (divided by gamma functions, so that it is entire in the parameters) instead of the ordinary one; the exact meaning is given for each function.

The guide Using acb_hypgeom illustrates these conventions with examples.

Rising factorials#

void arb_hypgeom_rising_ui_bs(arb_t res, const arb_t x, ulong n, slong prec)
void arb_hypgeom_rising_ui_rs(arb_t res, const arb_t x, ulong n, ulong m, slong prec)
void arb_hypgeom_rising_ui_rec(arb_t res, const arb_t x, ulong n, slong prec)
void arb_hypgeom_rising_ui(arb_t res, const arb_t x, ulong n, slong prec)
void arb_hypgeom_rising(arb_t res, const arb_t x, const arb_t n, slong prec)

Sets res to the rising factorial (x)n=x(x+1)⋯(x+n−1)(x)_n = x (x+1) \cdots (x+n-1), with (x)0=1(x)_0 = 1; arb_hypgeom_rising allows any real nn and computes Γ(x+n)/Γ(x)\Gamma(x+n)/\Gamma(x).

More
void arb_hypgeom_rising_ui_jet_bs(arb_ptr res, const arb_t x, ulong n, slong len, slong prec)
void arb_hypgeom_rising_ui_jet_rs(arb_ptr res, const arb_t x, ulong n, ulong m, slong len, slong prec)
void arb_hypgeom_rising_ui_jet(arb_ptr res, const arb_t x, ulong n, slong len, slong prec)

Sets the vector res of length len to the coefficients of the polynomial (x+t)n=(x+t)(x+t+1)⋯(x+t+n−1)∈R[t](x + t)_n = (x+t)(x+t+1)\cdots(x+t+n-1) \in \mathbb{R}[t], truncated to length len if len<n+1\mathit{len} < n+1 and padded with zeros if len>n+1\mathit{len} > n+1. The coefficient of tkt^k is the kk-th derivative of (x)n(x)_n with respect to xx divided by k!k!.

More

Gamma function#

void arb_hypgeom_gamma(arb_t res, const arb_t x, slong prec)
void arb_hypgeom_gamma_fmpq(arb_t res, const fmpq_t x, slong prec)
void arb_hypgeom_gamma_fmpz(arb_t res, const fmpz_t x, slong prec)

Sets res to the gamma function Γ(x)\Gamma(x). The result is indeterminate if xx contains a pole 0,−1,−2,…0, -1, -2, \ldots.

Full documentation
void arb_hypgeom_rgamma(arb_t res, const arb_t x, slong prec)

Sets res to the reciprocal gamma function 1/Γ(x)1/\Gamma(x), which is entire and zero at the nonpositive integers.

Full documentation
void arb_hypgeom_lgamma(arb_t res, const arb_t x, slong prec)

Sets res to log⁡Γ(x)\log \Gamma(x) for x>0x > 0. The result is indeterminate unless xx is positive; acb_hypgeom_lgamma computes the log-gamma function of negative and complex arguments.

Full documentation

Sets res to the sum ∑n=1N−1B2n/(2n(2n−1)z2n−1)\sum_{n=1}^{N-1} B_{2n} / (2n(2n-1) z^{2n-1}) of the Stirling series for log⁡Γ(z)\log \Gamma(z), truncated before the term of index NN. No bound for the truncation error is added.

More
void arb_hypgeom_gamma_stirling(arb_t res, const arb_t x, int reciprocal, slong prec)

Sets res to Γ(x)\Gamma(x), or 1/Γ(x)1/\Gamma(x) if reciprocal is nonzero, computed with the Stirling series after argument reduction.

More
int arb_hypgeom_gamma_taylor(arb_t res, const arb_t x, int reciprocal, slong prec)

Attempts to compute Γ(x)\Gamma(x), or 1/Γ(x)1/\Gamma(x) if reciprocal is nonzero, using a precomputed Taylor series. Returns 1 and sets res on success; returns 0 without changing res if xx or prec is too large for the method.

More

Binomial coefficients#

Sets res to the central binomial coefficient (2nn)\binom{2n}{n}.

More

Generalized hypergeometric function#

void arb_hypgeom_pfq(arb_t res, arb_srcptr a, slong p, arb_srcptr b, slong q, const arb_t z, int regularized, slong prec)

Sets res to the generalized hypergeometric function pFq(a1,…,ap;b1,…,bq;z){}_pF_q(a_1, \ldots, a_p; b_1, \ldots, b_q; z), or the regularized function pFq/(Γ(b1)⋯Γ(bq)){}_pF_q / (\Gamma(b_1) \cdots \Gamma(b_q)) if regularized is nonzero. Wrapper of acb_hypgeom_pfq.

Confluent hypergeometric functions#

void arb_hypgeom_0f1(arb_t res, const arb_t a, const arb_t z, int regularized, slong prec)

Sets res to the confluent hypergeometric limit function 0F1(a,z){}_0F_1(a, z), or 0F1(a,z)/Γ(a){}_0F_1(a,z)/\Gamma(a) if regularized is nonzero. Wrapper of acb_hypgeom_0f1.

void arb_hypgeom_m(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, slong prec)
void arb_hypgeom_1f1(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, slong prec)

Sets res to Kummer's confluent hypergeometric function M(a,b,z)=1F1(a,b,z)M(a,b,z) = {}_1F_1(a,b,z), or M(a,b,z)=1F1(a,b,z)/Γ(b)\mathbf{M}(a,b,z) = {}_1F_1(a,b,z)/\Gamma(b) if regularized is nonzero. The two names denote the same function, a wrapper of acb_hypgeom_m.

void arb_hypgeom_u(arb_t res, const arb_t a, const arb_t b, const arb_t z, slong prec)

Sets res to Tricomi's confluent hypergeometric function U(a,b,z)U(a,b,z), which is real for z>0z > 0. Wrapper of acb_hypgeom_u.

void arb_hypgeom_1f1_integration(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, slong prec)

Computes 1F1(a,b,z){}_1F_1(a,b,z) (regularized if regularized is nonzero) by rigorous numerical integration of

1F1(a,b,z)=Γ(b)Γ(a)Γ(b−a)∫01eztta−1(1−t)b−a−1 dt.{}_1F_1(a,b,z) = \frac{\Gamma(b)}{\Gamma(a) \Gamma(b-a)} \int_0^1 e^{zt} t^{a-1} (1-t)^{b-a-1} \, dt.

The result is finite only if a≥1a \ge 1 and b−a≥1b - a \ge 1.

More
void arb_hypgeom_u_integration(arb_t res, const arb_t a, const arb_t b, const arb_t z, slong prec)

Computes U(a,b,z)U(a,b,z) by rigorous numerical integration of

U(a,b,z)=1Γ(a)∫0∞e−ztta−1(1+t)b−a−1 dt.U(a,b,z) = \frac{1}{\Gamma(a)} \int_0^{\infty} e^{-zt} t^{a-1} (1+t)^{b-a-1} \, dt.

The result is finite only if a≥1a \ge 1 and z>0z > 0. acb_hypgeom_u uses it as a fallback for real arguments in the same way as arb_hypgeom_1f1_integration.

Gauss hypergeometric function#

void arb_hypgeom_2f1(arb_t res, const arb_t a, const arb_t b, const arb_t c, const arb_t z, int regularized, slong prec)

Sets res to the Gauss hypergeometric function 2F1(a,b,c,z){}_2F_1(a,b,c,z), or F(a,b,c,z)=2F1(a,b,c,z)/Γ(c)\mathbf{F}(a,b,c,z) = {}_2F_1(a,b,c,z)/\Gamma(c) if the bit ACB_HYPGEOM_2F1_REGULARIZED (= 1) is set in regularized. Wrapper of acb_hypgeom_2f1; the flags of that function, which declare that a parameter difference is an exact integer, can be set in regularized too. The value is real for z<1z < 1; on the branch cut z>1z > 1 the result is indeterminate unless the function is a polynomial.

void arb_hypgeom_2f1_integration(arb_t res, const arb_t a, const arb_t b, const arb_t c, const arb_t z, int regularized, slong prec)

Computes 2F1(a,b,c,z){}_2F_1(a,b,c,z) (regularized if regularized is nonzero) by rigorous numerical integration of

2F1(a,b,c,z)=Γ(c)Γ(b)Γ(c−b)∫01tb−1(1−t)c−b−1(1−zt)−a dt.{}_2F_1(a,b,c,z) = \frac{\Gamma(c)}{\Gamma(b) \Gamma(c-b)} \int_0^1 t^{b-1} (1-t)^{c-b-1} (1-zt)^{-a} \, dt.

The result is finite only if b≥1b \ge 1, c−b≥1c - b \ge 1 and z<1z < 1, possibly after exchanging aa and bb. acb_hypgeom_2f1 uses it as a fallback for real arguments.

Error functions and Fresnel integrals#

void arb_hypgeom_erf(arb_t res, const arb_t z, slong prec)

Sets res to the error function erf⁡(z)=2π∫0ze−t2dt\operatorname{erf}(z) = \frac{2}{\sqrt\pi} \int_0^z e^{-t^2} dt.

Full documentation
void arb_hypgeom_erfc(arb_t res, const arb_t z, slong prec)

Sets res to the complementary error function erfc⁡(z)=1−erf⁡(z)\operatorname{erfc}(z) = 1 - \operatorname{erf}(z), accurately also for large positive zz where erfc⁡(z)\operatorname{erfc}(z) is tiny.

Full documentation
void arb_hypgeom_erfi(arb_t res, const arb_t z, slong prec)

Sets res to the imaginary error function erfi⁡(z)=−ierf⁡(iz)=2π∫0zet2dt\operatorname{erfi}(z) = -i \operatorname{erf}(iz) = \frac{2}{\sqrt\pi} \int_0^z e^{t^2} dt. Wrapper of acb_hypgeom_erfi.

void arb_hypgeom_erfinv(arb_t res, const arb_t x, slong prec)
void arb_hypgeom_erfcinv(arb_t res, const arb_t x, slong prec)

Sets res to the inverse error function erf⁡−1(x)\operatorname{erf}^{-1}(x) for −1≤x≤1-1 \le x \le 1, or the inverse complementary error function erfc⁡−1(x)=erf⁡−1(1−x)\operatorname{erfc}^{-1}(x) = \operatorname{erf}^{-1}(1-x) for 0≤x≤20 \le x \le 2. The values at the endpoints are ±∞\pm\infty; arguments outside the domain give an indeterminate result.

Full documentation

Sets res to erf⁡\operatorname{erf}, erfc⁡\operatorname{erfc} or erfi⁡\operatorname{erfi} of the power series zz, truncated to length len.

More
void arb_hypgeom_fresnel(arb_t res1, arb_t res2, const arb_t z, int normalized, slong prec)

Sets res1 to the Fresnel sine integral S(z)S(z) and res2 to the Fresnel cosine integral C(z)C(z); either output may be NULL. If normalized is 0, S(z)=∫0zsin⁡(t2)dtS(z) = \int_0^z \sin(t^2) dt and C(z)=∫0zcos⁡(t2)dtC(z) = \int_0^z \cos(t^2) dt; if normalized is 1, S(z)=∫0zsin⁡(12πt2)dtS(z) = \int_0^z \sin(\tfrac12 \pi t^2) dt and C(z)=∫0zcos⁡(12πt2)dtC(z) = \int_0^z \cos(\tfrac12 \pi t^2) dt, the convention of Abramowitz and Stegun and of the DLMF [NIST2012]. Wrapper of acb_hypgeom_fresnel.

void _arb_hypgeom_fresnel_series(arb_ptr res1, arb_ptr res2, arb_srcptr z, slong zlen, int normalized, slong len, slong prec)
void arb_hypgeom_fresnel_series(arb_poly_t res1, arb_poly_t res2, const arb_poly_t z, int normalized, slong len, slong prec)

Sets res1 and res2 to the Fresnel sine and cosine integrals of the power series zz, truncated to length len. Either output may be NULL.

Incomplete gamma and beta functions#

void arb_hypgeom_gamma_upper(arb_t res, const arb_t s, const arb_t z, int regularized, slong prec)

Sets res to the upper incomplete gamma function Γ(s,z)=∫z∞ts−1e−tdt\Gamma(s,z) = \int_z^\infty t^{s-1} e^{-t} dt if regularized is 0, to Q(s,z)=Γ(s,z)/Γ(s)Q(s,z) = \Gamma(s,z)/\Gamma(s) if regularized is 1, and to z−sΓ(s,z)=E1−s(z)z^{-s} \Gamma(s,z) = E_{1-s}(z) if regularized is 2. Wrapper of acb_hypgeom_gamma_upper.

More
void arb_hypgeom_gamma_upper_integration(arb_t res, const arb_t s, const arb_t z, int regularized, slong prec)

Computes the upper incomplete gamma function (with the same meaning of regularized as arb_hypgeom_gamma_upper) from Γ(s,z)=zse−zU(1,1+s,z)\Gamma(s,z) = z^s e^{-z} U(1, 1+s, z), using arb_hypgeom_u_integration. The result is finite only for z>0z > 0. acb_hypgeom_gamma_upper uses it as a fallback for real arguments.

void _arb_hypgeom_gamma_upper_series(arb_ptr res, const arb_t s, arb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void arb_hypgeom_gamma_upper_series(arb_poly_t res, const arb_t s, const arb_poly_t z, int regularized, slong n, slong prec)

Sets res to the upper incomplete gamma function Γ(s,z)\Gamma(s, z) of the constant ss and the power series zz, truncated to length nn. regularized has the same meaning as in arb_hypgeom_gamma_upper.

void arb_hypgeom_gamma_lower(arb_t res, const arb_t s, const arb_t z, int regularized, slong prec)

Sets res to the lower incomplete gamma function γ(s,z)=∫0zts−1e−tdt=zss1F1(s,s+1,−z)\gamma(s,z) = \int_0^z t^{s-1} e^{-t} dt = \frac{z^s}{s} {}_1F_1(s, s+1, -z) if regularized is 0, to P(s,z)=γ(s,z)/Γ(s)P(s,z) = \gamma(s,z)/\Gamma(s) if regularized is 1, and to γ∗(s,z)=z−sP(s,z)\gamma^{*}(s,z) = z^{-s} P(s,z), which is entire in both variables, if regularized is 2. Wrapper of acb_hypgeom_gamma_lower.

void _arb_hypgeom_gamma_lower_series(arb_ptr res, const arb_t s, arb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void arb_hypgeom_gamma_lower_series(arb_poly_t res, const arb_t s, const arb_poly_t z, int regularized, slong n, slong prec)

Sets res to the lower incomplete gamma function of the constant ss and the power series zz, truncated to length nn, with regularized as in arb_hypgeom_gamma_lower.

void arb_hypgeom_beta_lower(arb_t res, const arb_t a, const arb_t b, const arb_t z, int regularized, slong prec)

Sets res to the incomplete beta function B(a,b;z)=∫0zta−1(1−t)b−1dtB(a,b;z) = \int_0^z t^{a-1} (1-t)^{b-1} dt, or the regularized function I(a,b;z)=B(a,b;z)/B(a,b;1)I(a,b;z) = B(a,b;z)/B(a,b;1) if regularized is nonzero. The precise definition by analytic continuation is given for acb_hypgeom_beta_lower, of which this is a wrapper.

void _arb_hypgeom_beta_lower_series(arb_ptr res, const arb_t a, const arb_t b, arb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void arb_hypgeom_beta_lower_series(arb_poly_t res, const arb_t a, const arb_t b, const arb_poly_t z, int regularized, slong n, slong prec)

Sets res to B(a,b;z)B(a,b;z) (or I(a,b;z)I(a,b;z) if regularized is nonzero) for constants a,ba, b and the power series zz, truncated to length nn.

Exponential and trigonometric integrals#

void arb_hypgeom_expint(arb_t res, const arb_t s, const arb_t z, slong prec)

Sets res to the generalized exponential integral Es(z)=zs−1Γ(1−s,z)E_s(z) = z^{s-1} \Gamma(1-s, z). Wrapper of acb_hypgeom_expint.

void arb_hypgeom_ei(arb_t res, const arb_t z, slong prec)

Sets res to the exponential integral Ei⁡(z)=−∫−z∞e−t/t dt\operatorname{Ei}(z) = -\int_{-z}^\infty e^{-t}/t \, dt (a principal value for z>0z > 0), defined for real z≠0z \ne 0. Wrapper of acb_hypgeom_ei.

void arb_hypgeom_ei_series(arb_poly_t res, const arb_poly_t z, slong len, slong prec)

Sets res to the exponential integral of the power series zz, truncated to length len.

void arb_hypgeom_si(arb_t res, const arb_t z, slong prec)

Sets res to the sine integral Si⁡(z)=∫0zsin⁡(t)/t dt\operatorname{Si}(z) = \int_0^z \sin(t)/t \, dt.

More
void arb_hypgeom_si_series(arb_poly_t res, const arb_poly_t z, slong len, slong prec)

Sets res to the sine integral of the power series zz, truncated to length len.

void arb_hypgeom_ci(arb_t res, const arb_t z, slong prec)

Sets res to the cosine integral Ci⁡(z)=−∫z∞cos⁡(t)/t dt\operatorname{Ci}(z) = -\int_z^\infty \cos(t)/t \, dt for z>0z > 0. The result is indeterminate unless zz is positive, since the value is complex for z<0z < 0.

More
void arb_hypgeom_ci_series(arb_poly_t res, const arb_poly_t z, slong len, slong prec)

Sets res to the cosine integral of the power series zz, truncated to length len.

void arb_hypgeom_shi(arb_t res, const arb_t z, slong prec)

Sets res to the hyperbolic sine integral Shi⁡(z)=−iSi⁡(iz)=∫0zsinh⁡(t)/t dt\operatorname{Shi}(z) = -i \operatorname{Si}(iz) = \int_0^z \sinh(t)/t \, dt. Wrapper of acb_hypgeom_shi.

Sets res to the hyperbolic sine integral of the power series zz, truncated to length len.

void arb_hypgeom_chi(arb_t res, const arb_t z, slong prec)

Sets res to the hyperbolic cosine integral Chi⁡(z)=γ+log⁡z+∫0z(cosh⁡(t)−1)/t dt\operatorname{Chi}(z) = \gamma + \log z + \int_0^z (\cosh(t) - 1)/t \, dt for z>0z > 0. The result is indeterminate unless zz is positive. Wrapper of acb_hypgeom_chi.

Sets res to the hyperbolic cosine integral of the power series zz, truncated to length len.

void arb_hypgeom_li(arb_t res, const arb_t z, int offset, slong prec)

Sets res to the logarithmic integral li⁡(z)=Ei⁡(log⁡z)\operatorname{li}(z) = \operatorname{Ei}(\log z) if offset is zero, or the offset logarithmic integral Li⁡(z)=li⁡(z)−li⁡(2)\operatorname{Li}(z) = \operatorname{li}(z) - \operatorname{li}(2) if offset is nonzero, for z≥0z \ge 0. The result is indeterminate unless zz is nonnegative. Wrapper of acb_hypgeom_li.

void _arb_hypgeom_li_series(arb_ptr res, arb_srcptr z, slong zlen, int offset, slong len, slong prec)
void arb_hypgeom_li_series(arb_poly_t res, const arb_poly_t z, int offset, slong len, slong prec)

Sets res to the logarithmic integral (the offset version if offset is nonzero) of the power series zz, truncated to length len.

Bessel functions#

void arb_hypgeom_bessel_j(arb_t res, const arb_t nu, const arb_t z, slong prec)
void arb_hypgeom_bessel_y(arb_t res, const arb_t nu, const arb_t z, slong prec)

Sets res to the Bessel function of the first kind Jν(z)J_\nu(z) or of the second kind Yν(z)Y_\nu(z). Wrappers of acb_hypgeom_bessel_j and acb_hypgeom_bessel_y; the result is indeterminate where the value is not real, for example Yν(z)Y_\nu(z) with z<0z < 0.

void arb_hypgeom_bessel_jy(arb_t res1, arb_t res2, const arb_t nu, const arb_t z, slong prec)

Sets res1 to Jν(z)J_\nu(z) and res2 to Yν(z)Y_\nu(z), computed together, which is faster than two separate calls. Wrapper of acb_hypgeom_bessel_jy.

void arb_hypgeom_bessel_i(arb_t res, const arb_t nu, const arb_t z, slong prec)
void arb_hypgeom_bessel_i_scaled(arb_t res, const arb_t nu, const arb_t z, slong prec)

Sets res to the modified Bessel function of the first kind Iν(z)=zν(iz)−νJν(iz)I_\nu(z) = z^\nu (iz)^{-\nu} J_\nu(iz), or to the scaled function e−zIν(z)e^{-z} I_\nu(z), which does not overflow for large zz. Wrappers of acb_hypgeom_bessel_i and acb_hypgeom_bessel_i_scaled.

void arb_hypgeom_bessel_k(arb_t res, const arb_t nu, const arb_t z, slong prec)
void arb_hypgeom_bessel_k_scaled(arb_t res, const arb_t nu, const arb_t z, slong prec)

Sets res to the modified Bessel function of the second kind Kν(z)K_\nu(z), or to the scaled function ezKν(z)e^z K_\nu(z), which does not underflow for large zz. Wrappers of acb_hypgeom_bessel_k and acb_hypgeom_bessel_k_scaled.

void arb_hypgeom_bessel_i_integration(arb_t res, const arb_t nu, const arb_t z, int scaled, slong prec)
void arb_hypgeom_bessel_k_integration(arb_t res, const arb_t nu, const arb_t z, int scaled, slong prec)

Computes Iν(z)I_\nu(z) or Kν(z)K_\nu(z) (multiplied by e−ze^{-z} or eze^{z} if scaled is nonzero) by rigorous numerical integration of an integral representation. These functions are intended for large ν\nu, where the series expansions are slow; acb_hypgeom_bessel_i and acb_hypgeom_bessel_k use them as fallbacks for real arguments.

void _arb_hypgeom_bessel_j_series(arb_ptr res, const arb_t nu, arb_srcptr z, slong zlen, slong len, slong prec)
void arb_hypgeom_bessel_j_series(arb_poly_t res, const arb_t nu, const arb_poly_t z, slong len, slong prec)

Sets res to Jν(z)J_\nu(z) for the constant ν\nu and the power series zz, truncated to length len.

More

Airy functions#

void arb_hypgeom_airy(arb_t ai, arb_t ai_prime, arb_t bi, arb_t bi_prime, const arb_t z, slong prec)

Sets ai, ai_prime, bi, bi_prime to the Airy functions Ai⁡(z)\operatorname{Ai}(z), Ai⁡′(z)\operatorname{Ai}'(z), Bi⁡(z)\operatorname{Bi}(z), Bi⁡′(z)\operatorname{Bi}'(z). Any of the outputs may be NULL, and omitting outputs speeds up the evaluation. Wrapper of acb_hypgeom_airy.

void arb_hypgeom_airy_jet(arb_ptr ai, arb_ptr bi, const arb_t z, slong len, slong prec)

Sets the vectors ai and bi to the Taylor coefficients of Ai⁡\operatorname{Ai} and Bi⁡\operatorname{Bi} at the point zz, truncated to length len. Either output may be NULL; zz must not alias the outputs.

More
void _arb_hypgeom_airy_series(arb_ptr ai, arb_ptr ai_prime, arb_ptr bi, arb_ptr bi_prime, arb_srcptr z, slong zlen, slong len, slong prec)
void arb_hypgeom_airy_series(arb_poly_t ai, arb_poly_t ai_prime, arb_poly_t bi, arb_poly_t bi_prime, const arb_poly_t z, slong len, slong prec)

Sets the outputs to the Airy functions and their derivatives evaluated at the power series zz, truncated to length len. Any of the outputs may be NULL.

void arb_hypgeom_airy_zero(arb_t a, arb_t a_prime, arb_t b, arb_t b_prime, const fmpz_t n, slong prec)

Sets a, a_prime, b, b_prime to the nn-th real zero ana_n, an′a'_n, bnb_n, bn′b'_n of Ai⁡\operatorname{Ai}, Ai⁡′\operatorname{Ai}', Bi⁡\operatorname{Bi}, Bi⁡′\operatorname{Bi}' respectively; any of them may be NULL. The zeros are negative and indexed by increasing magnitude starting with n=1n = 1, as in the literature. An index n≤0n \le 0 raises an exception.

More

Coulomb wave functions#

void arb_hypgeom_coulomb(arb_t F, arb_t G, const arb_t l, const arb_t eta, const arb_t z, slong prec)

Sets F and G to the regular and irregular Coulomb wave functions Fℓ(η,z)F_\ell(\eta, z) and Gℓ(η,z)G_\ell(\eta, z). Either output may be NULL. An output is indeterminate if its complex value is not real. Wrapper of acb_hypgeom_coulomb, which gives the definitions.

void arb_hypgeom_coulomb_jet(arb_ptr F, arb_ptr G, const arb_t l, const arb_t eta, const arb_t z, slong len, slong prec)

Sets the vectors F and G to the Taylor coefficients of the Coulomb wave functions at the point zz, truncated to length len. Either output may be NULL.

void _arb_hypgeom_coulomb_series(arb_ptr F, arb_ptr G, const arb_t l, const arb_t eta, arb_srcptr z, slong zlen, slong len, slong prec)
void arb_hypgeom_coulomb_series(arb_poly_t F, arb_poly_t G, const arb_t l, const arb_t eta, const arb_poly_t z, slong len, slong prec)

Sets F and G to the Coulomb wave functions evaluated at the power series zz, truncated to length len. Either output may be NULL.

Orthogonal polynomials and functions#

void arb_hypgeom_chebyshev_t(arb_t res, const arb_t nu, const arb_t z, slong prec)
void arb_hypgeom_chebyshev_u(arb_t res, const arb_t nu, const arb_t z, slong prec)
void arb_hypgeom_jacobi_p(arb_t res, const arb_t n, const arb_t a, const arb_t b, const arb_t z, slong prec)
void arb_hypgeom_gegenbauer_c(arb_t res, const arb_t n, const arb_t m, const arb_t z, slong prec)
void arb_hypgeom_laguerre_l(arb_t res, const arb_t n, const arb_t m, const arb_t z, slong prec)
void arb_hypgeom_hermite_h(arb_t res, const arb_t nu, const arb_t z, slong prec)

Sets res to the Chebyshev polynomial Tν(z)T_\nu(z) or Uν(z)U_\nu(z), the Jacobi polynomial Pn(a,b)(z)P_n^{(a,b)}(z), the Gegenbauer polynomial Cnm(z)C_n^{m}(z), the Laguerre polynomial Lnm(z)L_n^{m}(z) or the Hermite polynomial Hν(z)H_\nu(z), or their extensions to non-integer degree. Wrappers of the functions of the same name in acb_hypgeom, which give the definitions.

void arb_hypgeom_legendre_p(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, slong prec)
void arb_hypgeom_legendre_q(arb_t res, const arb_t n, const arb_t m, const arb_t z, int type, slong prec)

Sets res to the associated Legendre function of the first kind Pnm(z)P_n^m(z) or of the second kind Qnm(z)Q_n^m(z), with the branch cut convention selected by type (0 or 1) as described for acb_hypgeom_legendre_p and acb_hypgeom_legendre_q. For m=0m = 0 and a nonnegative integer n<2FLINT_BITS−1n < 2^{\mathtt{FLINT\_BITS} - 1}, arb_hypgeom_legendre_p calls arb_hypgeom_legendre_p_ui; otherwise both functions wrap the complex versions.

void arb_hypgeom_legendre_p_ui_zero(arb_t res, arb_t res_prime, ulong n, const arb_t x, slong K, slong prec)
void arb_hypgeom_legendre_p_ui_one(arb_t res, arb_t res_prime, ulong n, const arb_t x, slong K, slong prec)
void arb_hypgeom_legendre_p_ui_asymp(arb_t res, arb_t res_prime, ulong n, const arb_t x, slong K, slong prec)
void arb_hypgeom_legendre_p_ui_rec(arb_t res, arb_t res_prime, ulong n, const arb_t x, slong prec)
void arb_hypgeom_legendre_p_ui(arb_t res, arb_t res_prime, ulong n, const arb_t x, slong prec)

Sets res to the Legendre polynomial Pn(x)P_n(x) and res_prime to its derivative Pn′(x)P'_n(x). Either output may be NULL.

More

Sets res to the kk-th root xkx_k of the Legendre polynomial PnP_n, with the roots in decreasing order 1>x0>x1>⋯>xn−1>−11 > x_0 > x_1 > \cdots > x_{n-1} > -1, and, if weight is not NULL, sets weight to the corresponding weight wk=2/((1−xk2)Pn′(xk)2)w_k = 2 / ((1 - x_k^2) P'_n(x_k)^2) of Gauss–Legendre quadrature on [−1,1][-1, 1]. Requires 0≤k<n0 \le k < n. See Roots of Legendre polynomials and Gauss–Legendre nodes.

Full documentation

Dilogarithm#

void arb_hypgeom_dilog(arb_t res, const arb_t z, slong prec)

Sets res to the dilogarithm Li⁡2(z)=−∫0zlog⁡(1−t)/t dt\operatorname{Li}_2(z) = -\int_0^z \log(1-t)/t \, dt for z≤1z \le 1; the result is indeterminate for z>1z > 1, where the value is complex. Wrapper of acb_hypgeom_dilog.

Hypergeometric sums#

These functions sum a finite number of terms of a hypergeometric series with rational parameters and a real ball argument. They are the building blocks of several real functions (sine and cosine integrals, error functions, incomplete gamma functions) and are useful on their own for constants and functions given by such series. No truncation error is added: the caller chooses NN and bounds the tail. See Hypergeometric sums with rational parameters and Sums of hypergeometric series with rational parameters.

void arb_hypgeom_sum_fmpq_arb_forward(arb_t res, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_arb_rs(arb_t res, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_arb_bs(arb_t res, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_arb(arb_t res, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)

Sets res to the finite sum ∑n=0N−1(a1)n⋯(aalen)n(b1)n⋯(bblen)nwn\sum_{n=0}^{N-1} \frac{(a_1)_n \cdots (a_{\mathit{alen}})_n}{(b_1)_n \cdots (b_{\mathit{blen}})_n} w^n with rational parameters aia_i and bjb_j, where w=zw = z, or w=1/zw = 1/z if reciprocal is nonzero. There is no implicit n!n!: include bj=1b_j = 1 for the usual pFq{}_pF_q normalisation.

Full documentation
void arb_hypgeom_sum_fmpq_imag_arb_forward(arb_t res1, arb_t res2, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_imag_arb_rs(arb_t res1, arb_t res2, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_imag_arb_bs(arb_t res1, arb_t res2, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)
void arb_hypgeom_sum_fmpq_imag_arb(arb_t res1, arb_t res2, const fmpq * a, slong alen, const fmpq * b, slong blen, const arb_t z, int reciprocal, slong N, slong prec)

Sets res1 and res2 to the real and imaginary parts of the finite sum ∑n=0N−1(a1)n⋯(b1)n⋯(iw)n\sum_{n=0}^{N-1} \frac{(a_1)_n \cdots}{(b_1)_n \cdots} (iw)^n with w=zw = z, or w=1/zw = 1/z if reciprocal is nonzero, using only real arithmetic.

Full documentation

Internal functions#

Sets c0,…,cn−1c_0, \ldots, c_{n-1} to the coefficients of the monic polynomial (X+k)n=Xn+cn−1Xn−1+⋯+c0(X+k)_n = X^n + c_{n-1} X^{n-1} + \cdots + c_0 (the leading 1 is not stored). Requires n≥2n \ge 2 and raises an exception otherwise.

More

For 1≤n<N1 \le n < N, sets bound[n] to an exponent ee such that the nn-th term ∣B2n/(2n(2n−1)z2n−1)∣|B_{2n}/(2n(2n-1) z^{2n-1})| of the Stirling series is at most 2e2^e, given an upper bound zinv for ∣1/z∣|1/z|. Does not check for overflow or underflow of the exponents.

The number of entries (536) of the table of Taylor coefficients of 1/Γ(1+x)1/\Gamma(1+x) and their precision in bits (3456).

Describes one tabulated coefficient: its exponent (exp), its position in the limb table (tab_pos), its number of limbs (nlimbs) and its sign (negative).

The table arb_hypgeom_gamma_coeff_t arb_hypgeom_gamma_coeffs[ARB_HYPGEOM_GAMMA_TAB_NUM] describing the Taylor coefficients ckc_k of 1/Γ(1+x)=∑kckxk1/\Gamma(1+x) = \sum_k c_k x^k, used by arb_hypgeom_gamma_taylor and acb_hypgeom_gamma_taylor.

Sets c to a shallow copy of the tabulated coefficient cic_i of 1/Γ(1+x)1/\Gamma(1+x), 1≤i<1 \le i < ARB_HYPGEOM_GAMMA_TAB_NUM, truncated to prec bits (rounded up to whole limbs), and err (if not NULL) to a bound for the truncation error. Returns 0, without setting anything, if prec exceeds the precision of the table and 1 otherwise. c points into static data and must not be modified or cleared; ii is not checked.

Sets res to ∑k=0N−1zk/(a)k\sum_{k=0}^{N-1} z^k / (a)_k with a=p/qa = p/q, computed by rectangular splitting. Requires that p+qNp + qN fits in a word. Used for the error function.

Sets res to ∑k=0N−1(a)k/zk\sum_{k=0}^{N-1} (a)_k / z^k with a=p/qa = p/q, computed by rectangular splitting. Requires that p+qNp + qN fits in a word. Used for the asymptotic expansion of the error function.

Returns a number of terms NN of the asymptotic series of Γ(a,z)\Gamma(a, z) at infinity that gives an absolute error at most abs_tol, and sets err to a bound for the truncation error. Returns −1-1 if the tolerance cannot be reached. Assumes z>0z > 0.

Sets res to the asymptotic series of Γ(a,z)\Gamma(a,z) at infinity, including the prefactor za−1e−zz^{a-1} e^{-z}, truncated before the term of index NN and computed by binary splitting. The truncation error is not included.

Returns a number of terms NN of the Taylor series of γ(a,z)\gamma(a,z) at zero that gives an absolute error at most abs_tol, and sets err to a bound for the truncation error. Assumes z>0z > 0.

Sets res to the series γ(a,z)=zae−za∑nzn(a+1)n\gamma(a,z) = \frac{z^a e^{-z}}{a} \sum_n \frac{z^n}{(a+1)_n} truncated before the term of index NN and computed by binary splitting. The truncation error is not included.

Returns a number of terms NN of the series at zero of Γ(−n,z)\Gamma(-n,z), for an integer n≥0n \ge 0, that gives an absolute error at most abs_tol, and sets err to a bound for the truncation error.

Sets res to the series at zero of Γ(−n,z)\Gamma(-n,z), for an integer n≥0n \ge 0, truncated before the term of index NN and computed by binary splitting. The truncation error is not included.

The following functions compute jets Γ(a+ε,z)\Gamma(a + \varepsilon, z) (truncated power series in ε\varepsilon of length len) for rational aa, and are used by acb_dirichlet_l_fmpq_afe_jet. The choose_N functions set err to a bound for the truncation error which is valid simultaneously for every coefficient of the jet; this bound is computed from majorant series for the differentiated terms of the corresponding scalar series. With len = 1, they reduce to the corresponding scalar functions. Where a parameter logz (or logz0) appears, it may be passed an enclosure of log⁡(z)\log(z) to avoid recomputing it, or NULL.

void _arb_hypgeom_gamma_fmpq_jet(arb_ptr res, const fmpq_t a, slong len, slong prec)

Sets res to the jet of Γ(a+ε)\Gamma(a + \varepsilon) for rational aa which is not a nonpositive integer, computed as γ(a+ε,Z)+Γ(a+ε,Z)\gamma(a + \varepsilon, Z) + \Gamma(a + \varepsilon, Z) with an integer Z≈0.55log⁡(2)pZ \approx 0.55 \log(2) p at precision pp, as in arb_hypgeom_gamma_fmpq: the lower series at ZZ and the asymptotic series at ZZ (at reduced precision, since Γ(a+ε,Z)\Gamma(a+\varepsilon, Z) is small) are both evaluated by binary splitting. If the asymptotic series does not converge to the required accuracy (at low precision or for large aa), ZZ is increased until it does, or until the second term is negligible. With len = 1, this calls arb_gamma_fmpq.

void _arb_hypgeom_gamma_upper_fmpq_inf_bsplit_jet(arb_ptr res, const fmpq_t a, const arb_t z, const arb_t logz, slong N, slong len, slong prec)

Jet versions of _arb_hypgeom_gamma_upper_fmpq_inf_choose_N and _arb_hypgeom_gamma_upper_fmpq_inf_bsplit. The truncation error (a−1)⋯(a−N)Γ(a−N,z)(a-1)\cdots(a-N) \Gamma(a-N,z) is bounded using majorants for the polynomial factor and for ∫z∞ta−N−1e−tlog⁡j(t)/j! dt\int_z^{\infty} t^{a-N-1} e^{-t} \log^j(t) / j! \, dt. The choose_N function requires z≥1z \ge 1 (otherwise it returns −1-1).

void _arb_hypgeom_gamma_upper_singular_si_bsplit_jet(arb_ptr res, slong n, const arb_t z, const arb_t logz, slong N, arb_srcptr gamma1, slong len, slong prec)

Jet versions of _arb_hypgeom_gamma_upper_singular_si_choose_N and _arb_hypgeom_gamma_upper_singular_si_bsplit, computing the jet of Γ(−n+ε,z)\Gamma(-n + \varepsilon, z) for an integer n≥0n \ge 0. This uses

Γ(−n+ε,z)=(−1)nn!1ε[Γ(1+ε)∏i=1n(1−ε/i)−zε]−z−n+ε∑k≠n(−z)kk!(k−n+ε).\Gamma(-n + \varepsilon, z) = \frac{(-1)^n}{n!} \frac{1}{\varepsilon}\left[\frac{\Gamma(1+\varepsilon)}{\prod_{i=1}^n (1 - \varepsilon/i)} - z^{\varepsilon}\right] - z^{-n+\varepsilon} \sum_{k \ne n} \frac{(-z)^k}{k! (k - n + \varepsilon)}.

If gamma1 is not NULL, it should contain the jet of Γ(1+ε)\Gamma(1 + \varepsilon) of length len + 1; otherwise this is computed internally.

void _arb_gamma_upper_fmpq_step_bsplit_jet(arb_ptr Gz1, const fmpq_t a, const arb_t z0, const arb_t logz0, const arb_t z1, arb_srcptr Gz0, const arb_t expmz0, const mag_t abs_tol, slong len, slong prec)

Jet version of _arb_gamma_upper_fmpq_step_bsplit: given the jet Gz0 of Γ(a+ε,z0)\Gamma(a + \varepsilon, z_0) and expmz0 containing e−z0e^{-z_0}, sets Gz1 to the jet of Γ(a+ε,z1)\Gamma(a + \varepsilon, z_1). The matrix binary splitting is done with power series entries. The truncation error is bounded using Cauchy estimates on a circle of radius RR around z0z_0, with an extra factor max⁡j<lenΛj/j!\max_{j < \text{len}} \Lambda^j / j! where Λ\Lambda bounds ∣log⁡(t)∣|\log(t)| on the circle; the radius RR is chosen with this factor taken into account.

void _arb_gamma_upper_fmpq_step_bsplit(arb_t Gz1, const fmpq_t a, const arb_t z0, const arb_t z1, const arb_t Gz0, const arb_t expmz0, const mag_t abs_tol, slong prec)

Given Gz0 and expmz0 containing Γ(a,z0)\Gamma(a, z_0) and e−z0e^{-z_0}, sets Gz1 to Γ(a,z1)\Gamma(a, z_1), computed from the Taylor series at z0z_0 by binary splitting with an absolute truncation error at most abs_tol (included in the output). Assumes z0,z1>0z_0, z_1 > 0. This is one step of the bit-burst algorithm.

int arb_hypgeom_erf_bb(arb_t res, const arb_t z, int complementary, slong prec)

Attempts to compute erf⁡(z)\operatorname{erf}(z), or erfc⁡(z)\operatorname{erfc}(z) if complementary is nonzero, with the bit-burst algorithm applied to Γ(1/2,z2)\Gamma(1/2, z^2). Returns 1 on success. Returns 0 without changing res if zz is not finite, if ∣z∣>prec|z| > \mathit{prec} or if ∣z∣<2−prec/16|z| < 2^{-\mathit{prec}/16}.

void _arb_hypgeom_si_asymp(arb_t res, const arb_t z, slong N, slong prec)
void _arb_hypgeom_si_1f2(arb_t res, const arb_t z, slong N, slong wp, slong prec)

Compute Si⁡(z)\operatorname{Si}(z) with NN terms of the asymptotic expansion, or of the 1F2{}_1F_2 series summed at working precision wp and rounded to prec, including a bound for the truncation error. These are the two methods of arb_hypgeom_si.

void _arb_hypgeom_ci_asymp(arb_t res, const arb_t z, slong N, slong prec)
void _arb_hypgeom_ci_2f3(arb_t res, const arb_t z, slong N, slong wp, slong prec)

Compute Ci⁡(z)\operatorname{Ci}(z) with NN terms of the asymptotic expansion or of the 2F3{}_2F_3 series, including a bound for the truncation error. These are the two methods of arb_hypgeom_ci.

void arb_hypgeom_legendre_p_ui_deriv_bound(mag_t dp, mag_t dp2, ulong n, const arb_t x, const arb_t x2sub1)

Sets dp to an upper bound for ∣Pn′(x)∣|P'_n(x)| and dp2 to an upper bound for ∣Pn′′(x)∣|P''_n(x)|, for xx representing real numbers with ∣x∣≤1|x| \le 1, given the precomputed x2sub1 =1−x2= 1 - x^2 (or x2−1x^2 - 1). Used to bound the propagated error in arb_hypgeom_legendre_p_ui.

References#

  • [NIST2012] National Institute of Standards and Technology, Digital Library of Mathematical Functions (2012), https://dlmf.nist.gov/
Cite this page

The FLINT team, “arb_hypgeom.h (module overview),” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/arb_hypgeom/index.html (generated 2026-11-02).