FLINT3.7.0-dev
Module · 162 functions

acb_hypgeom.h

#include <flint/acb_hypgeom.h>

This module evaluates hypergeometric functions of complex arguments given as balls (acb_t) or as complex power series (acb_poly_t), with rigorous error bounds. The generalized hypergeometric function is defined by the series

pFq(a1,…,ap;b1,…,bq;z)=∑k=0∞(a1)k⋯(ap)k(b1)k⋯(bq)kzkk!,{}_pF_q(a_1,\ldots,a_p;b_1,\ldots,b_q;z) = \sum_{k=0}^\infty \frac{(a_1)_k\cdots(a_p)_k}{(b_1)_k\cdots(b_q)_k} \frac{z^k}{k!},

interpreted by analytic continuation (or as a formal series together with an asymptotic expansion) where it does not converge. In a wider sense, "hypergeometric functions" are linear combinations of such functions with prefactors that are products of exponentials, powers and gamma functions. This covers most classical special functions, and this module implements the gamma function and rising factorials, the confluent functions 0F1{}_0F_1, 1F1{}_1F_1 and UU, error functions and Fresnel integrals, incomplete gamma and beta functions, exponential, sine and cosine integrals, Bessel, Airy and Coulomb wave functions, the Gauss function 2F1{}_2F_1, Legendre functions, orthogonal polynomials, spherical harmonics and the dilogarithm. The real versions are in arb_hypgeom, which calls this module for most functions, and the generic interface gr_special calls both for its real and complex ball contexts.

Each function chooses between convergent series, asymptotic expansions, transformation formulas, analytic continuation and, for real arguments, numerical integration, and sets its working precision from an estimate of the cancellation; the algorithms and error bounds are described in Hypergeometric functions, and Evaluating special functions maps each function to its methods. The guide Using acb_hypgeom explains the conventions with examples.

AlgorithmHypergeometric functionsThe general machinery for hypergeometric functions in ball arithmetic — convergent series with rigorous tail bounds (also for power series parameters), asymptotic expansions with Olver's error bounds, the choice between them by estimated cancellation, connection formulas and regularization, and the summation algorithms (forward recurrence, rectangular splitting, binary splitting, fast multipoint evaluation, bit-burst continuation).

Guides#

Conventions#

  • Enclosures. Every function returns a ball containing the value of the function at every point of the input balls. If the function is undefined somewhere in the input (a pole, or an input that straddles a branch cut in a way the function cannot handle), or if no finite enclosure could be computed, the output is indeterminate (see acb_indeterminate). A wide or indeterminate output for a valid input usually means that the precision is too low for the size of the parameters; increasing prec helps.
  • Precision. prec is the target precision. The functions estimate the cancellation in the series they use and increase the working precision internally, and reduce it to what the accuracy of the input justifies. For inexact input they usually evaluate at the midpoint and bound the propagated error with derivative bounds.
  • Branch cuts. Multivalued functions use the principal branch, with the branch cut on (−∞,0](-\infty, 0] for functions built from log⁡z\log z and zaz^a (UU, Ei⁡\operatorname{Ei}, Ci⁡\operatorname{Ci}, Coulomb functions, the log-gamma function) and on [1,+∞)[1, +\infty) for functions built from log⁡(1−z)\log(1-z) (2F1{}_2F_1, the dilogarithm). On a cut the value follows acb_log, which is continuous from the upper half-plane on (−∞,0)(-\infty, 0); for a cut on (1,+∞)(1, +\infty) this means the limit from the lower half-plane. The conventions for the exponential and trigonometric integrals match Mathematica.
  • Regularization. An int argument regularized (or flags for 2F1{}_2F_1) selects the regularized function, divided by the gamma functions of the lower parameters so that it is entire in them; the regularized function is defined at the nonpositive integers where the ordinary one has poles.
  • Aliasing and optional outputs. Inputs and outputs may be the same object unless stated otherwise. Functions with several outputs accept NULL for unwanted outputs. The underscore power series functions require positive lengths, write exactly len coefficients and do not allow the output to overlap the input.
  • Wrappers. For real input, several functions call the faster real implementation in arb_hypgeom (gamma, rising factorials, error function, Legendre polynomials).

Rising factorials#

void acb_hypgeom_rising_ui_bs(acb_t res, const acb_t x, ulong n, slong prec)
void acb_hypgeom_rising_ui_rs(acb_t res, const acb_t x, ulong n, ulong m, slong prec)
void acb_hypgeom_rising_ui_rec(acb_t res, const acb_t x, ulong n, slong prec)
void acb_hypgeom_rising_ui(acb_t res, const acb_t x, ulong n, slong prec)
void acb_hypgeom_rising(acb_t res, const acb_t x, const acb_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); acb_hypgeom_rising allows any complex nn and computes Γ(x+n)/Γ(x)\Gamma(x+n)/\Gamma(x).

More
void acb_hypgeom_rising_ui_jet_bs(acb_ptr res, const acb_t x, ulong n, slong len, slong prec)
void acb_hypgeom_rising_ui_jet_rs(acb_ptr res, const acb_t x, ulong n, ulong m, slong len, slong prec)
void acb_hypgeom_rising_ui_jet(acb_ptr res, const acb_t x, ulong n, slong len, slong prec)

Sets the vector res of length len to the coefficients of the polynomial (x+t)n∈C[t](x + t)_n \in \mathbb{C}[t], truncated if len<n+1\mathit{len} < n+1 and padded with zeros if len>n+1\mathit{len} > n+1.

More
void acb_hypgeom_log_rising_ui(acb_ptr res, const acb_t x, ulong n, slong prec)

Sets res to the log-rising factorial log⁡ (x)n=∑k=0n−1log⁡(x+k)\log\,(x)_n = \sum_{k=0}^{n-1} \log(x+k), the sum of principal logarithms, which differs from the principal logarithm of (x)n(x)_n by a multiple of 2πi2\pi i.

More
void acb_hypgeom_log_rising_ui_jet(acb_ptr res, const acb_t x, ulong n, slong len, slong prec)

Sets the vector res to the coefficients of log⁡ (x+t)n\log\,(x+t)_n as a power series in tt, truncated to length len, with the constant term as in acb_hypgeom_log_rising_ui.

Gamma function#

The algorithms for the gamma function are described in The gamma function.

void acb_hypgeom_gamma(acb_t res, const acb_t x, slong prec)

Sets res to the gamma function Γ(x)\Gamma(x). The result is indeterminate if xx contains a pole.

Full documentation
void acb_hypgeom_rgamma(acb_t res, const acb_t x, slong prec)

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

Full documentation
void acb_hypgeom_lgamma(acb_t res, const acb_t x, slong prec)

Sets res to the principal branch of the log-gamma function log⁡Γ(x)\log \Gamma(x), which is analytic except on the branch cut (−∞,0](-\infty, 0] and differs from log⁡(Γ(x))\log(\Gamma(x)) by a multiple of 2πi2\pi i.

Full documentation

Sets s to ∑n=1N−1B2n/(2n(2n−1)z2n−1)\sum_{n=1}^{N-1} B_{2n} / (2n(2n-1) z^{2n-1}), the sum in the Stirling series truncated before the term of index NN, using Horner's scheme or the improved algorithm with splitting parameter KK (0 to choose it), as arb_hypgeom_gamma_stirling_sum_horner and arb_hypgeom_gamma_stirling_sum_improved do for real zz. No bound for the truncation error is added.

void acb_hypgeom_gamma_stirling(acb_t res, const acb_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 by a rising factorial and, for real part below −5-5, the reflection formula. See arb_hypgeom_gamma_stirling and The Stirling series.

int acb_hypgeom_gamma_taylor(acb_t res, const acb_t x, int reciprocal, slong prec)

Attempts to compute Γ(x)\Gamma(x), or 1/Γ(x)1/\Gamma(x) if reciprocal is nonzero, with the tabulated Taylor series of 1/Γ(1+x)1/\Gamma(1+x) and argument reduction. Returns 1 on success and 0, without changing res, if xx or prec is outside the supported range.

More

Generalized hypergeometric function#

void acb_hypgeom_pfq(acb_t res, acb_srcptr a, slong p, acb_srcptr b, slong q, const acb_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.

Full documentation

Confluent hypergeometric functions#

In this section U(a,b,z)U(a,b,z) is the confluent hypergeometric function of the second kind with the principal branch cut, and U∗(a,b,z)=zaU(a,b,z)U^{*}(a,b,z) = z^a U(a,b,z), which tends to 1 as z→∞z \to \infty in the sector ∣arg⁡z∣<3π/2|\arg z| < 3\pi/2.

void acb_hypgeom_m_asymp(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec)
void acb_hypgeom_m_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec)
void acb_hypgeom_m(acb_t res, const acb_t a, const acb_t b, const acb_t z, int regularized, slong prec)
void acb_hypgeom_1f1(acb_t res, const acb_t a, const acb_t b, const acb_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. acb_hypgeom_1f1 is the same function as acb_hypgeom_m.

More
void acb_hypgeom_u_asymp(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong n, slong prec)

Sets res to U∗(a,b,z)U^{*}(a,b,z) computed with nn terms of the asymptotic series U∗(a,b,z)∼2F0(a,a−b+1;;−1/z)U^{*}(a,b,z) \sim {}_2F_0(a, a-b+1; ; -1/z), with a rigorous bound for the truncation error. Requires n≥0n \ge 0; n<0n < 0 chooses the number of terms automatically.

More

Returns nonzero if the asymptotic series is expected to give U(a,b,z)U(a,b,z) to prec bits, namely if ∣z∣>preclog⁡2|z| > \mathit{prec} \log 2 or ∣z∣>264|z| > 2^{64} (assuming that aa and bb are small).

void acb_hypgeom_u_1f1_series(acb_poly_t res, const acb_poly_t a, const acb_poly_t b, const acb_poly_t z, slong len, slong prec)

Sets res to U(a,b,z)U(a,b,z) as a power series truncated to length len, for power series a,b,z∈C[[x]]a, b, z \in \mathbb{C}[[x]], using the connection formula with two 1F1{}_1F_1 series. If the constant term of bb is an integer, one extra derivative is computed and the removable singularity is divided out; it is then assumed that the coefficient of xx in bb is nonzero. The output is indeterminate if the constant term of bb is inexact and contains an integer.

void acb_hypgeom_u_1f1(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong prec)

Sets res to U(a,b,z)U(a,b,z) computed from the convergent series by the connection formula

U(a,b,z)=Γ(1−b)Γ(a−b+1)M(a,b,z)+Γ(b−1)Γ(a)z1−bM(a−b+1,2−b,z).U(a,b,z) = \frac{\Gamma(1-b)}{\Gamma(a-b+1)} M(a,b,z) + \frac{\Gamma(b-1)}{\Gamma(a)} z^{1-b} M(a-b+1,2-b,z).

If bb is an integer the limit is computed with acb_hypgeom_u_1f1_series; the output is indeterminate if bb is inexact and contains an integer.

void acb_hypgeom_u(acb_t res, const acb_t a, const acb_t b, const acb_t z, slong prec)

Sets res to U(a,b,z)U(a,b,z).

More
void acb_hypgeom_0f1_asymp(acb_t res, const acb_t a, const acb_t z, int regularized, slong prec)
void acb_hypgeom_0f1_direct(acb_t res, const acb_t a, const acb_t z, int regularized, slong prec)
void acb_hypgeom_0f1(acb_t res, const acb_t a, const acb_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, using asymptotic expansions, direct summation, or an automatic choice.

More

Error functions and Fresnel integrals#

The representations and the choice of method for this section and the next two are described in Error functions, incomplete gamma functions and exponential integrals.

void acb_hypgeom_erf_1f1a(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_erf_1f1b(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_erf_asymp(acb_t res, const acb_t z, int complementary, slong prec, slong prec2)

Sets res to erf⁡(z)\operatorname{erf}(z) computed respectively from

erf⁡(z)=2zπ1F1(12,32,−z2),erf⁡(z)=2ze−z2π1F1(1,32,z2),\operatorname{erf}(z) = \frac{2z}{\sqrt{\pi}} {}_1F_1(\tfrac{1}{2}, \tfrac{3}{2}, -z^2), \qquad \operatorname{erf}(z) = \frac{2z e^{-z^2}}{\sqrt{\pi}} {}_1F_1(1, \tfrac{3}{2}, z^2),
erf⁡(z)=zz2(1−e−z2πU(12,12,z2))=zz2−e−z2zπU∗(12,12,z2).\operatorname{erf}(z) = \frac{z}{\sqrt{z^2}} \left(1 - \frac{e^{-z^2}}{\sqrt{\pi}} U(\tfrac{1}{2}, \tfrac{1}{2}, z^2)\right) = \frac{z}{\sqrt{z^2}} - \frac{e^{-z^2}}{z \sqrt{\pi}} U^{*}(\tfrac{1}{2}, \tfrac{1}{2}, z^2).
More
void acb_hypgeom_erf(acb_t res, const acb_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.

More

Sets re and im to upper bounds for the errors in the real and imaginary parts that result from replacing erf⁡(z)\operatorname{erf}(z) by erf⁡\operatorname{erf} evaluated at the midpoint of zz, using a bound for the first derivative 2πe−z2\frac{2}{\sqrt\pi} e^{-z^2} on the ball.

Sets res to the error function of the power series zz, truncated to length len.

void acb_hypgeom_erfc(acb_t res, const acb_t z, slong prec)

Sets res to the complementary error function erfc⁡(z)=1−erf⁡(z)\operatorname{erfc}(z) = 1 - \operatorname{erf}(z), avoiding the catastrophic cancellation of the subtraction when Re⁡z\operatorname{Re} z is large and positive.

Sets res to the complementary error function of the power series zz, truncated to length len.

void acb_hypgeom_erfi(acb_t res, const acb_t z, slong prec)

Sets res to the imaginary error function erfi⁡(z)=−ierf⁡(iz)\operatorname{erfi}(z) = -i\operatorname{erf}(iz), computed with acb_hypgeom_erf.

Sets res to the imaginary error function of the power series zz, truncated to length len.

void acb_hypgeom_fresnel(acb_t res1, acb_t res2, const acb_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, the integrands are sin⁡(12πt2)\sin(\tfrac12 \pi t^2) and cos⁡(12πt2)\cos(\tfrac12 \pi t^2), the convention of Abramowitz and Stegun and of the DLMF. The values are computed from erf⁡((1±i)w)\operatorname{erf}((1 \pm i) w), where ww is zz times a real constant, evaluated at the midpoint of zz with a bound for the propagated error.

void _acb_hypgeom_fresnel_series(acb_ptr res1, acb_ptr res2, acb_srcptr z, slong zlen, int normalized, slong len, slong prec)
void acb_hypgeom_fresnel_series(acb_poly_t res1, acb_poly_t res2, const acb_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 acb_hypgeom_gamma_upper_asymp(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec)
void acb_hypgeom_gamma_upper_1f1a(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec)
void acb_hypgeom_gamma_upper_1f1b(acb_t res, const acb_t s, const acb_t z, int regularized, slong prec)
void acb_hypgeom_gamma_upper_singular(acb_t res, slong s, const acb_t z, int regularized, slong prec)
void acb_hypgeom_gamma_upper(acb_t res, const acb_t s, const acb_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 the generalized exponential integral z−sΓ(s,z)=E1−s(z)z^{-s} \Gamma(s,z) = E_{1-s}(z) if regularized is 2 (mainly for internal use; acb_hypgeom_expint is the interface for EsE_s).

More
void _acb_hypgeom_gamma_upper_series(acb_ptr res, const acb_t s, acb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void acb_hypgeom_gamma_upper_series(acb_poly_t res, const acb_t s, const acb_poly_t z, int regularized, slong n, slong prec)

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

void acb_hypgeom_gamma_lower(acb_t res, const acb_t s, const acb_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 ss and zz, if regularized is 2.

void _acb_hypgeom_gamma_lower_series(acb_ptr res, const acb_t s, acb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void acb_hypgeom_gamma_lower_series(acb_poly_t res, const acb_t s, const acb_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 acb_hypgeom_gamma_lower.

void acb_hypgeom_beta_lower(acb_t res, const acb_t a, const acb_t b, const acb_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 incomplete beta 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.

More
void _acb_hypgeom_beta_lower_series(acb_ptr res, const acb_t a, const acb_t b, acb_srcptr z, slong zlen, int regularized, slong n, slong prec)
void acb_hypgeom_beta_lower_series(acb_poly_t res, const acb_t a, const acb_t b, const acb_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 aa and bb and the power series zz, truncated to length nn.

Exponential and trigonometric integrals#

void acb_hypgeom_expint(acb_t res, const acb_t s, const acb_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), computed with acb_hypgeom_gamma_upper.

void acb_hypgeom_ei_asymp(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_ei_2f2(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_ei(acb_t res, const acb_t z, slong prec)

Sets res to the exponential integral Ei⁡(z)\operatorname{Ei}(z), computed respectively from

Ei⁡(z)=−ezU(1,1,−z)−log⁡(−z)+12(log⁡(z)−log⁡(1z)),\operatorname{Ei}(z) = -e^z U(1,1,-z) - \log(-z) + \frac{1}{2} \left(\log(z) - \log\left(\frac{1}{z}\right) \right),
Ei⁡(z)=z 2F2(1,1;2,2;z)+γ+12(log⁡(z)−log⁡(1z)),\operatorname{Ei}(z) = z\, {}_2F_2(1, 1; 2, 2; z) + \gamma + \frac{1}{2} \left(\log(z) - \log\left(\frac{1}{z}\right) \right),

or by an automatic choice based on the expected accuracy of the two methods. The result is indeterminate if zz contains zero.

void acb_hypgeom_ei_series(acb_poly_t res, const acb_poly_t z, slong len, slong prec)

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

void acb_hypgeom_si_asymp(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_si_1f2(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_si(acb_t res, const acb_t z, slong prec)

Sets res to the sine integral Si⁡(z)\operatorname{Si}(z), computed respectively from

Si⁡(z)=i2[eizU(1,1,−iz)−e−izU(1,1,iz)+log⁡(−iz)−log⁡(iz)],\operatorname{Si}(z) = \frac{i}{2} \left[ e^{iz} U(1,1,-iz) - e^{-iz} U(1,1,iz) + \log(-iz) - \log(iz) \right],
Si⁡(z)=z 1F2(12;32,32;−z24),\operatorname{Si}(z) = z\, {}_1F_2(\tfrac{1}{2}; \tfrac{3}{2}, \tfrac{3}{2}; -\tfrac{z^2}{4}),

or by an automatic choice. Real input is passed to arb_hypgeom_si.

void acb_hypgeom_si_series(acb_poly_t res, const acb_poly_t z, slong len, slong prec)

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

void acb_hypgeom_ci_asymp(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_ci_2f3(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_ci(acb_t res, const acb_t z, slong prec)

Sets res to the cosine integral Ci⁡(z)\operatorname{Ci}(z), computed respectively from

Ci⁡(z)=log⁡(z)−12[eizU(1,1,−iz)+e−izU(1,1,iz)+log⁡(−iz)+log⁡(iz)],\operatorname{Ci}(z) = \log(z) - \frac{1}{2} \left[ e^{iz} U(1,1,-iz) + e^{-iz} U(1,1,iz) + \log(-iz) + \log(iz) \right],
Ci⁡(z)=−z24 2F3(1,1;2,2,32;−z24)+log⁡(z)+γ,\operatorname{Ci}(z) = -\tfrac{z^2}{4}\, {}_2F_3(1, 1; 2, 2, \tfrac{3}{2}; -\tfrac{z^2}{4}) + \log(z) + \gamma,

or by an automatic choice. Positive real input is passed to arb_hypgeom_ci.

void acb_hypgeom_ci_series(acb_poly_t res, const acb_poly_t z, slong len, slong prec)

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

void acb_hypgeom_shi(acb_t res, const acb_t z, slong prec)

Sets res to the hyperbolic sine integral Shi⁡(z)=−iSi⁡(iz)\operatorname{Shi}(z) = -i \operatorname{Si}(iz), computed with acb_hypgeom_si.

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

void acb_hypgeom_chi_asymp(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_chi_2f3(acb_t res, const acb_t z, slong prec)
void acb_hypgeom_chi(acb_t res, const acb_t z, slong prec)

Sets res to the hyperbolic cosine integral Chi⁡(z)\operatorname{Chi}(z), computed respectively from

Chi⁡(z)=−12[ezU(1,1,−z)+e−zU(1,1,z)+log⁡(−z)−log⁡(z)],\operatorname{Chi}(z) = -\frac{1}{2} \left[ e^{z} U(1,1,-z) + e^{-z} U(1,1,z) + \log(-z) - \log(z) \right],
Chi⁡(z)=z24 2F3(1,1;2,2,32;z24)+log⁡(z)+γ,\operatorname{Chi}(z) = \tfrac{z^2}{4}\, {}_2F_3(1, 1; 2, 2, \tfrac{3}{2}; \tfrac{z^2}{4}) + \log(z) + \gamma,

or by an automatic choice.

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

void acb_hypgeom_li(acb_t res, const acb_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.

void _acb_hypgeom_li_series(acb_ptr res, acb_srcptr z, slong zlen, int offset, slong len, slong prec)
void acb_hypgeom_li_series(acb_poly_t res, const acb_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#

The methods for the Bessel, Airy and Coulomb wave functions are described in Bessel, Airy and Coulomb wave functions.

void acb_hypgeom_bessel_j_asymp(acb_t res, const acb_t nu, const acb_t z, slong prec)

Sets res to the Bessel function of the first kind Jν(z)J_\nu(z) computed with the asymptotic expansion of acb_hypgeom_u_asymp.

More
void acb_hypgeom_bessel_j_0f1(acb_t res, const acb_t nu, const acb_t z, slong prec)

Sets res to Jν(z)J_\nu(z) computed from the convergent series

Jν(z)=1Γ(ν+1)(z2)ν0F1(ν+1,−z24),J_{\nu}(z) = \frac{1}{\Gamma(\nu+1)} \left(\frac{z}{2}\right)^{\nu} {}_0F_1\left(\nu+1, -\frac{z^2}{4}\right),

using J−n(z)=(−1)nJn(z)J_{-n}(z) = (-1)^n J_n(z) for negative integer ν\nu.

void acb_hypgeom_bessel_j(acb_t res, const acb_t nu, const acb_t z, slong prec)

Sets res to the Bessel function of the first kind Jν(z)J_\nu(z).

More
void acb_hypgeom_bessel_j_deriv_bound(mag_t res, const acb_t nu, const acb_t z, ulong d)

Sets res to an upper bound, possibly crude, for ∣Jν(d)(z)∣|J_\nu^{(d)}(z)| (∣Jν(z)∣|J_\nu(z)| for d=0d = 0). Implemented only for integer ν\nu, using for example ∣Jn(d)(z)∣≤e∣Im⁡z∣|J_n^{(d)}(z)| \le e^{|\operatorname{Im} z|}; for non-integer ν\nu the bound is infinite.

void _acb_hypgeom_bessel_j_series(acb_ptr res, const acb_t nu, acb_srcptr z, slong zlen, slong len, slong prec)
void acb_hypgeom_bessel_j_series(acb_poly_t res, const acb_t nu, const acb_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. Both functions call the generic _gr_poly_bessel_j_series with a complex ball context; as described for arb_hypgeom_bessel_j_series, the result is indeterminate if the constant term of zz is an inexact ball containing zero.

void acb_hypgeom_bessel_y(acb_t res, const acb_t nu, const acb_t z, slong prec)

Sets res to the Bessel function of the second kind

Yν(z)=cos⁡(νπ)Jν(z)−J−ν(z)sin⁡(νπ),Y_{\nu}(z) = \frac{\cos(\nu \pi) J_{\nu}(z) - J_{-\nu}(z)}{\sin(\nu \pi)},

or for ν=n\nu = n an integer the limit

Yn(z)=−2π(inKn(iz)+[log⁡(iz)−log⁡(z)]Jn(z)).Y_n(z) = -\frac{2}{\pi} \left( i^n K_n(iz) + \left[\log(iz)-\log(z)\right] J_n(z) \right).

The output is indeterminate if ν\nu is inexact and contains an integer.

void acb_hypgeom_bessel_jy(acb_t res1, acb_t res2, const acb_t nu, const acb_t z, slong prec)

Sets res1 to Jν(z)J_\nu(z) and res2 to Yν(z)Y_\nu(z), computed together. The Hankel functions Hν(1)(z),Hν(2)(z)=Jν(z)±iYν(z)H_\nu^{(1)}(z), H_\nu^{(2)}(z) = J_\nu(z) \pm i Y_\nu(z) can be formed from them.

Modified Bessel functions#

void acb_hypgeom_bessel_i_asymp(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec)
void acb_hypgeom_bessel_i_0f1(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec)
void acb_hypgeom_bessel_i(acb_t res, const acb_t nu, const acb_t z, slong prec)
void acb_hypgeom_bessel_i_scaled(acb_t res, const acb_t nu, const acb_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), computed respectively with the asymptotic expansion (see acb_hypgeom_bessel_j_asymp), the convergent series

Iν(z)=1Γ(ν+1)(z2)ν0F1(ν+1,z24),I_{\nu}(z) = \frac{1}{\Gamma(\nu+1)} \left(\frac{z}{2}\right)^{\nu} {}_0F_1\left(\nu+1, \frac{z^2}{4}\right),

or an automatic choice. acb_hypgeom_bessel_i_scaled computes e−zIν(z)e^{-z} I_\nu(z); the asymp and 0f1 versions compute the scaled function if scaled is nonzero. For real arguments with an inaccurate result, the automatic versions also try arb_hypgeom_bessel_i_integration.

void acb_hypgeom_bessel_k_asymp(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec)

Sets res to the modified Bessel function of the second kind

Kν(z)=(2zπ)−1/2e−zU∗(ν+12,2ν+1,2z),K_{\nu}(z) = \left(\frac{2z}{\pi}\right)^{-1/2} e^{-z} U^{*}(\nu+\tfrac{1}{2}, 2\nu+1, 2z),

valid for all ν\nu and z≠0z \ne 0, using acb_hypgeom_u_asymp; or ezKν(z)e^z K_\nu(z) if scaled is nonzero.

void acb_hypgeom_bessel_k_0f1_series(acb_poly_t res, const acb_poly_t nu, const acb_poly_t z, int scaled, slong len, slong prec)

Sets res to Kν(z)K_\nu(z) (or ezKν(z)e^z K_\nu(z) if scaled is nonzero) as a power series truncated to length len, for power series ν,z∈C[[x]]\nu, z \in \mathbb{C}[[x]], using

Kν(z)=12πsin⁡(πν)[(z2)−ν0F~1(1−ν,z24)−(z2)ν0F~1(1+ν,z24)].K_{\nu}(z) = \frac{1}{2} \frac{\pi}{\sin(\pi \nu)} \left[ \left(\frac{z}{2}\right)^{-\nu} {}_0{\widetilde F}_1\left(1-\nu, \frac{z^2}{4}\right) - \left(\frac{z}{2}\right)^{\nu} {}_0{\widetilde F}_1\left(1+\nu, \frac{z^2}{4}\right) \right].

If the constant term of ν\nu is an integer, one extra derivative is computed and the singularity is removed (the coefficient of xx in ν\nu must then be nonzero). The output is indeterminate if the constant term of ν\nu is inexact and contains an integer.

void acb_hypgeom_bessel_k_0f1(acb_t res, const acb_t nu, const acb_t z, int scaled, slong prec)

Sets res to Kν(z)K_\nu(z) (or ezKν(z)e^z K_\nu(z) if scaled is nonzero) computed from

Kν(z)=12[(z2)−νΓ(ν)0F1(1−ν,z24)−(z2)νπνsin⁡(πν)Γ(ν)0F1(ν+1,z24)]K_{\nu}(z) = \frac{1}{2} \left[ \left(\frac{z}{2}\right)^{-\nu} \Gamma(\nu) {}_0F_1\left(1-\nu, \frac{z^2}{4}\right) - \left(\frac{z}{2}\right)^{\nu} \frac{\pi}{\nu \sin(\pi \nu) \Gamma(\nu)} {}_0F_1\left(\nu+1, \frac{z^2}{4}\right) \right]

for ν∉Z\nu \notin \mathbb{Z}, and the limit computed with acb_hypgeom_bessel_k_0f1_series for ν∈Z\nu \in \mathbb{Z}. The output is indeterminate if ν\nu is inexact and contains an integer.

void acb_hypgeom_bessel_k(acb_t res, const acb_t nu, const acb_t z, slong prec)
void acb_hypgeom_bessel_k_scaled(acb_t res, const acb_t nu, const acb_t z, slong prec)

Sets res to the modified Bessel function of the second kind Kν(z)K_\nu(z), or to ezKν(z)e^z K_\nu(z), choosing between the asymptotic expansion and the convergent series. For real arguments with an inaccurate result they also try arb_hypgeom_bessel_k_integration.

Airy functions#

The Airy functions Ai⁡(z)\operatorname{Ai}(z) and Bi⁡(z)\operatorname{Bi}(z) are linearly independent solutions of y′′−zy=0y'' - zy = 0; both are entire. For negative zz both oscillate; for positive zz the first decreases and the second increases exponentially. They can be expressed with Bessel functions of order ±1/3\pm 1/3, but these formulas hold only piecewise (because of the Stokes phenomenon), so the module provides a dedicated implementation. The functions below compute (Ai⁡(z),Ai⁡′(z),Bi⁡(z),Bi⁡′(z))(\operatorname{Ai}(z), \operatorname{Ai}'(z), \operatorname{Bi}(z), \operatorname{Bi}'(z)) together; any of the four outputs may be NULL, which saves work.

void acb_hypgeom_airy_direct(acb_t ai, acb_t ai_prime, acb_t bi, acb_t bi_prime, const acb_t z, slong n, slong prec)

Computes the Airy functions with the convergent series at the origin truncated after nn terms, including a bound for the truncation error.

void acb_hypgeom_airy_asymp(acb_t ai, acb_t ai_prime, acb_t bi, acb_t bi_prime, const acb_t z, slong n, slong prec)

Computes the Airy functions with the asymptotic expansions truncated after nn terms, including a bound for the truncation error. The bounds and connection formulas are given in Asymptotic expansions.

void acb_hypgeom_airy_bound(mag_t ai, mag_t ai_prime, mag_t bi, mag_t bi_prime, const acb_t z)

Sets the outputs to upper bounds for ∣Ai⁡(z)∣|\operatorname{Ai}(z)|, ∣Ai⁡′(z)∣|\operatorname{Ai}'(z)|, ∣Bi⁡(z)∣|\operatorname{Bi}(z)|, ∣Bi⁡′(z)∣|\operatorname{Bi}'(z)| on the ball zz, from first-order asymptotic expansions with error bounds. This is faster than calling acb_hypgeom_airy_asymp with n=1n = 1.

void acb_hypgeom_airy(acb_t ai, acb_t ai_prime, acb_t bi, acb_t bi_prime, const acb_t z, slong prec)

Computes the Airy functions with an automatic choice of method.

More
void acb_hypgeom_airy_jet(acb_ptr ai, acb_ptr bi, const acb_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. The expansions of the derivatives are obtained by computing one more coefficient and applying _acb_poly_derivative.

void _acb_hypgeom_airy_series(acb_ptr ai, acb_ptr ai_prime, acb_ptr bi, acb_ptr bi_prime, acb_srcptr z, slong zlen, slong len, slong prec)
void acb_hypgeom_airy_series(acb_poly_t ai, acb_poly_t ai_prime, acb_poly_t bi, acb_poly_t bi_prime, const acb_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.

Coulomb wave functions#

Coulomb wave functions are solutions of the Coulomb wave equation

y′′+(1−2ηz−ℓ(ℓ+1)z2)y=0,y'' + \left(1 - \frac{2 \eta}{z} - \frac{\ell(\ell+1)}{z^2}\right) y = 0,

the radial Schrödinger equation for a charged particle in a Coulomb potential 1/z1/z, where ℓ\ell is the orbital angular momentum and η\eta the Sommerfeld parameter. The standard solutions are Fℓ(η,z)F_\ell(\eta,z), regular at the origin, and Gℓ(η,z)G_\ell(\eta,z), irregular at the origin; the irregular solutions Hℓ±(η,z)=Gℓ(η,z)±iFℓ(η,z)H^{\pm}_\ell(\eta,z) = G_\ell(\eta,z) \pm i F_\ell(\eta,z) are also used. They are special cases of confluent hypergeometric functions; the normalizations and connection formulas are discussed in [DYF1999], [Gas2018], [Mic2007] and [NIST2012, chapter 33]. Here the analytic continuations of all functions are defined so that the branch cut with respect to zz is the negative real axis; precise definitions are given in [Fungrim] (topic "Coulomb wave functions"), whose formulas the implementation follows.

The functions below compute Fℓ(η,z)F_\ell(\eta,z), Gℓ(η,z)G_\ell(\eta,z), Hℓ+(η,z)H^{+}_\ell(\eta,z) and Hℓ−(η,z)H^{-}_\ell(\eta,z) together; any output may be NULL. The redundant functions H±H^{\pm} are provided because the linear combination of FF and GG suffers from cancellation in parts of the complex plane.

void acb_hypgeom_coulomb(acb_t F, acb_t G, acb_t Hpos, acb_t Hneg, const acb_t l, const acb_t eta, const acb_t z, slong prec)

Sets F, G, Hpos, Hneg to the respective Coulomb wave functions. Any of the outputs may be NULL.

More
void acb_hypgeom_coulomb_jet(acb_ptr F, acb_ptr G, acb_ptr Hpos, acb_ptr Hneg, const acb_t l, const acb_t eta, const acb_t z, slong len, slong prec)

Sets F, G, Hpos, Hneg to the Taylor coefficients of the Coulomb wave functions at the point zz, truncated to length len, using the differential equation to obtain the higher coefficients. Any of the outputs may be NULL.

void _acb_hypgeom_coulomb_series(acb_ptr F, acb_ptr G, acb_ptr Hpos, acb_ptr Hneg, const acb_t l, const acb_t eta, acb_srcptr z, slong zlen, slong len, slong prec)
void acb_hypgeom_coulomb_series(acb_poly_t F, acb_poly_t G, acb_poly_t Hpos, acb_poly_t Hneg, const acb_t l, const acb_t eta, const acb_poly_t z, slong len, slong prec)

Sets the outputs to the Coulomb wave functions evaluated at the power series zz, truncated to length len. Any of the outputs may be NULL.

Gauss hypergeometric function#

The functions in this section compute the Gauss hypergeometric function

F(z)=2F1(a,b,c,z)=∑k=0∞(a)k(b)k(c)kzkk!F(z) = {}_2F_1(a,b,c,z) = \sum_{k=0}^{\infty} \frac{(a)_k (b)_k}{(c)_k} \frac{z^k}{k!}

or, if the flag regularized (ACB_HYPGEOM_2F1_REGULARIZED) is set, the regularized function F(z)=F(a,b,c,z)=2F1(a,b,c,z)/Γ(c)\mathbf{F}(z) = \mathbf{F}(a,b,c,z) = {}_2F_1(a,b,c,z) / \Gamma(c), which is entire in aa, bb and cc. The branch cut is [1,+∞)[1, +\infty); on the cut, the value is the limit from the lower half-plane. The algorithms are described in The Gauss hypergeometric function.

Bit flags for the flags argument of acb_hypgeom_2f1 and acb_hypgeom_2f1_transform, with the values 1, 2, 4, 8 and 16: compute the regularized function, and declare that a−ba - b, a−ca - c, b−cb - c or a+b−ca + b - c respectively is an exact integer.

void acb_hypgeom_2f1(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int flags, slong prec)

Sets res to F(z)F(z), or F(z)\mathbf{F}(z) if flags contains ACB_HYPGEOM_2F1_REGULARIZED, with an automatic choice of algorithm. The other flags declare that a parameter difference is an exact integer even if the input balls are inexact, so that the correct limit is computed where a transformation formula is singular.

Full documentation
void acb_hypgeom_2f1_direct(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, slong prec)

Sets res to F(z)F(z) (or F(z)\mathbf{F}(z)) by direct summation of the hypergeometric series, which converges for ∣z∣<1|z| < 1.

void acb_hypgeom_2f1_series_direct(acb_poly_t res, const acb_poly_t a, const acb_poly_t b, const acb_poly_t c, const acb_poly_t z, int regularized, slong len, slong prec)

Sets res to F(z)F(z) (or F(z)\mathbf{F}(z)) for power series parameters and argument, truncated to length len, by direct summation of the hypergeometric series.

void acb_hypgeom_2f1_transform(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int flags, int which, slong prec)
void acb_hypgeom_2f1_transform_limit(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, int which, slong prec)

Sets res to F(z)F(z) (or F(z)\mathbf{F}(z)) computed with the linear fractional transformation selected by which: 1 for z/(z−1)z/(z-1), 2 for 1/z1/z, 3 for 1/(1−z)1/(1-z), 4 for 1−z1-z and 5 for 1−1/z1-1/z.

More
void acb_hypgeom_2f1_corner(acb_t res, const acb_t a, const acb_t b, const acb_t c, const acb_t z, int regularized, slong prec)

Sets res to F(z)F(z) (or F(z)\mathbf{F}(z)) for zz near the points exp⁡(±πi/3)\exp(\pm \pi i/3), where none of the transformations gives a convergent series, by analytic continuation along a path from a point where the direct series converges.

void acb_hypgeom_2f1_continuation(acb_t res0, acb_t res1, const acb_t a, const acb_t b, const acb_t c, const acb_t z0, const acb_t z1, const acb_t f0, const acb_t f1, slong prec)

Given F(z0)F(z_0) and F′(z0)F'(z_0) in f0 and f1, sets res0 and res1 to F(z1)F(z_1) and F′(z1)F'(z_1), computed by integrating the hypergeometric differential equation along the straight segment from z0z_0 to z1z_1 with Taylor series and rigorous bounds. The points should be well isolated from the singular points 0 and 1. If FF denotes the regularized function, f0,f1f_0, f_1 must be values of the regularized function.

Chooses the method for computing 2F1{}_2F_1 from the location of zz: returns 0 for direct summation, 1 to 5 for the transformation with that index in acb_hypgeom_2f1_transform, or 6 for the corner case.

More

Orthogonal polynomials and functions#

The algorithms for this section are described in Legendre functions and orthogonal polynomials.

void acb_hypgeom_chebyshev_t(acb_t res, const acb_t n, const acb_t z, slong prec)
void acb_hypgeom_chebyshev_u(acb_t res, const acb_t n, const acb_t z, slong prec)

Sets res to the Chebyshev polynomial or Chebyshev function of the first or second kind

Tn(z)=2F1(−n,n,12,1−z2),Un(z)=(n+1) 2F1(−n,n+2,32,1−z2).T_n(z) = {}_2F_1\left(-n,n,\frac{1}{2},\frac{1-z}{2}\right), \qquad U_n(z) = (n+1)\, {}_2F_1\left(-n,n+2,\frac{3}{2},\frac{1-z}{2}\right).
More
void acb_hypgeom_jacobi_p(acb_t res, const acb_t n, const acb_t a, const acb_t b, const acb_t z, slong prec)

Sets res to the Jacobi polynomial (or Jacobi function)

Pn(a,b)(z)=(a+1)nΓ(n+1) 2F1(−n,n+a+b+1,a+1,1−z2).P_n^{(a,b)}(z) = \frac{(a+1)_n}{\Gamma(n+1)}\, {}_2F_1\left(-n,n+a+b+1,a+1,\frac{1-z}{2}\right).

For nonnegative integer nn this is a polynomial in aa, bb and zz, also for parameters where the hypergeometric series is undefined; it is then evaluated by direct methods.

void acb_hypgeom_gegenbauer_c(acb_t res, const acb_t n, const acb_t m, const acb_t z, slong prec)

Sets res to the Gegenbauer polynomial (or Gegenbauer function)

Cnm(z)=(2m)nΓ(n+1) 2F1(−n,2m+n,m+12,1−z2).C_n^{m}(z) = \frac{(2m)_n}{\Gamma(n+1)}\, {}_2F_1\left(-n,2m+n,m+\frac{1}{2},\frac{1-z}{2}\right).

For nonnegative integer nn this is a polynomial in mm and zz, also where the hypergeometric series is undefined; it is then evaluated by direct methods.

void acb_hypgeom_laguerre_l(acb_t res, const acb_t n, const acb_t m, const acb_t z, slong prec)

Sets res to the Laguerre polynomial (or Laguerre function)

Lnm(z)=(m+1)nΓ(n+1) 1F1(−n,m+1,z).L_n^{m}(z) = \frac{(m+1)_n}{\Gamma(n+1)}\, {}_1F_1\left(-n,m+1,z\right).

For nonnegative integer nn this is a polynomial in mm and zz, also where the hypergeometric series is undefined; it is then evaluated by direct methods.

More
void acb_hypgeom_hermite_h(acb_t res, const acb_t n, const acb_t z, slong prec)

Sets res to the Hermite polynomial (or Hermite function)

Hn(z)=2nπ(1Γ((1−n)/2) 1F1(−n2,12,z2)−2zΓ(−n/2) 1F1(1−n2,32,z2)).H_n(z) = 2^n \sqrt{\pi} \left( \frac{1}{\Gamma((1-n)/2)}\, {}_1F_1\left(-\frac{n}{2},\frac{1}{2},z^2\right) - \frac{2z}{\Gamma(-n/2)}\, {}_1F_1\left(\frac{1-n}{2},\frac{3}{2},z^2\right)\right).
void acb_hypgeom_legendre_p(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, slong prec)

Sets res to the associated Legendre function of the first kind of degree nn, order mm and argument zz; for m=0m = 0 this is the Legendre polynomial Pn(z)P_n(z). Several branch cut conventions are in use. If type is 0, the function is

Pnm(z)=(1+z)m/2(1−z)m/2 F(−n,n+1,1−m,1−z2),P_n^m(z) = \frac{(1+z)^{m/2}}{(1-z)^{m/2}}\, \mathbf{F}\left(-n, n+1, 1-m, \frac{1-z}{2}\right),

with cuts (−∞,−1](-\infty, -1] and [1,∞)[1, \infty), and if type is 1, the function is

Pnm(z)=(z+1)m/2(z−1)m/2 F(−n,n+1,1−m,1−z2),{\mathcal P}_n^m(z) = \frac{(z+1)^{m/2}}{(z-1)^{m/2}}\, \mathbf{F}\left(-n, n+1, 1-m, \frac{1-z}{2}\right),

with the cut (−∞,1](-\infty, 1]. Type 0 and type 1 correspond to type 2 and type 3 in Mathematica and mpmath; other values of type raise an exception.

More
void acb_hypgeom_legendre_q(acb_t res, const acb_t n, const acb_t m, const acb_t z, int type, slong prec)

Sets res to the associated Legendre function of the second kind of degree nn, order mm and argument zz; for m=0m = 0 this is the Legendre function Qn(z)Q_n(z). If type is 0, the function is

Qnm(z)=π2sin⁡(πm)(cos⁡(πm)Pnm(z)−Γ(1+m+n)Γ(1−m+n)Pn−m(z)),Q_n^m(z) = \frac{\pi}{2 \sin(\pi m)} \left( \cos(\pi m) P_n^m(z) - \frac{\Gamma(1+m+n)}{\Gamma(1-m+n)} P_n^{-m}(z)\right),

and if type is 1,

Qnm(z)=π2sin⁡(πm)eπim(Pnm(z)−Γ(1+m+n)Γ(1−m+n)Pn−m(z)).\mathcal{Q}_n^m(z) = \frac{\pi}{2 \sin(\pi m)} e^{\pi i m} \left( \mathcal{P}_n^m(z) - \frac{\Gamma(1+m+n)}{\Gamma(1-m+n)} \mathcal{P}_n^{-m}(z)\right).

Type 0 and type 1 correspond to type 2 and type 3 in Mathematica and mpmath; other values of type raise an exception.

More

For nonnegative integers nn and mm, sets res to (1−z2)−m/2Pnm(z)(1-z^2)^{-m/2} P_n^m(z), which is a polynomial in zz, computed with the three-term recurrence in the degree starting from PmmP_m^m. The result is zero for m>nm > n, and indeterminate if (n−m)/4>prec(n - m)/4 > \mathit{prec}, where the recurrence would lose all accuracy.

void acb_hypgeom_spherical_y(acb_t res, slong n, slong m, const acb_t theta, const acb_t phi, slong prec)

Sets res to the spherical harmonic of degree nn and order mm at latitude angle θ\theta and longitude angle ϕ\phi, normalized so that

Ynm(θ,ϕ)=2n+14π(n−m)!(n+m)! eimϕPnm(cos⁡(θ)).Y_n^m(\theta, \phi) = \sqrt{\frac{2n+1}{4\pi} \frac{(n-m)!}{(n+m)!}}\, e^{im\phi} P_n^m(\cos(\theta)).

The definition is extended to negative mm and nn by symmetry. The function is a polynomial in cos⁡θ\cos\theta and sin⁡θ\sin\theta and is evaluated with acb_hypgeom_legendre_p_uiui_rec.

Dilogarithm#

The dilogarithm is Li⁡2(z)=−∫0zlog⁡(1−t)tdt=z 3F2(1,1,1;2,2;z)\operatorname{Li}_2(z) = -\int_0^z \frac{\log(1-t)}{t} dt = z\, {}_3F_2(1,1,1;2,2;z), with the branch cut [1,+∞)[1, +\infty) (the value on the cut is the limit from the lower half-plane). The algorithms are described in The dilogarithm.

void acb_hypgeom_dilog_bernoulli(acb_t res, const acb_t z, slong prec)

Sets res to Li⁡2(z)\operatorname{Li}_2(z) computed with the series expansion in w=log⁡(z)w = \log(z), which converges like ∣w/(2π)∣n|w/(2\pi)|^n. This gives good convergence near z=e±iπ/3z = e^{\pm i \pi / 3}, where the hypergeometric series fail. Since the coefficients involve Bernoulli numbers, the method is meant for moderate precision.

Sets res to Li⁡2(z)\operatorname{Li}_2(z) computed with the hypergeometric series at 0, which is efficient only for ∣z∣≪1|z| \ll 1.

void acb_hypgeom_dilog_zero(acb_t res, const acb_t z, slong prec)

Sets res to Li⁡2(z)\operatorname{Li}_2(z) for zz close to 0, using the Taylor series below 40000 bits (or for tiny ∣z∣|z|) and the bit-burst algorithm otherwise.

void acb_hypgeom_dilog_transform(acb_t res, const acb_t z, int algorithm, slong prec)

Sets res to Li⁡2(z)\operatorname{Li}_2(z) computed by one of the transformations 1/z1/z, 1−z1-z, z/(z−1)z/(z-1), 1/(1−z)1/(1-z), selected by algorithm from 1 to 4, followed by acb_hypgeom_dilog_zero at the transformed argument. For algorithm between 5 and 7, it instead starts from the respective point ±i\pm i, (1±i)/2(1\pm i)/2 or 1±i1 \pm i (with the sign of the imaginary part of zz), where Li⁡2\operatorname{Li}_2 has a closed form in terms of π\pi, log⁡2\log 2 and Catalan's constant, and continues to zz with the bit-burst method; these require that the imaginary part of zz does not contain 0. The result is indeterminate if the transformation is not valid on the whole input ball.

void acb_hypgeom_dilog_continuation(acb_t res, const acb_t a, const acb_t z, slong prec)

Sets res to Li⁡2(z)−Li⁡2(a)\operatorname{Li}_2(z) - \operatorname{Li}_2(a) computed with the Taylor expansion at aa, summed by binary splitting. Both aa and zz should be well isolated from 0 and 1, except that aa may be exactly 0. If the segment from aa to zz crosses the branch cut, the result is the analytic continuation along the segment rather than the principal branch.

void acb_hypgeom_dilog_bitburst(acb_t res, acb_t z0, const acb_t z, slong prec)

Sets z0 to a point with a short binary expansion close to zz and res to Li⁡2(z)−Li⁡2(z0)\operatorname{Li}_2(z) - \operatorname{Li}_2(z_0), computed with the bit-burst algorithm: z0z_0 is zz truncated to 16 fractional bits, and continuation steps lead from it through the truncations of zz to 32, 64, 128, ... bits to zz. If zz is close to the branch cut, it sets z0 to zz and res to 0.

void acb_hypgeom_dilog(acb_t res, const acb_t z, slong prec)

Sets res to the dilogarithm Li⁡2(z)\operatorname{Li}_2(z) with an automatic choice of method: the series at 0 after the transformation that minimizes ∣z∣|z|, the Bernoulli series near e±iπ/3e^{\pm i\pi/3} below 10000 bits, and expansions at the points of acb_hypgeom_dilog_transform otherwise.

Summation of hypergeometric series#

The functions in this section are the building blocks of the functions above. With

T(k)=∏i=0p−1(ai)k∏i=0q−1(bi)kzk,T(k) = \frac{\prod_{i=0}^{p-1} (a_i)_k}{\prod_{i=0}^{q-1} (b_i)_k} z^k,

they compute partial sums of

pfq(a0,…,ap−1;b0…bq−1;z)=p+1Fq(a0,…,ap−1,1;b0…bq−1;z)=∑k=0∞T(k).{}_pf_{q}(a_0,\ldots,a_{p-1}; b_0 \ldots b_{q-1}; z) = {}_{p+1}F_{q}(a_0,\ldots,a_{p-1},1; b_0 \ldots b_{q-1}; z) = \sum_{k=0}^{\infty} T(k).

There is no implicit k!k!: to compute the usual pFq{}_pF_q, call the pfq+1{}_pf_{q+1} functions with the extra lower parameter bq=1b_q = 1, or remove an upper parameter equal to 1 if there is one. The algorithms and the error bounds are described in Hypergeometric functions.

Sets C to a factor such that ∣∑k=n∞T(k)∣≤C∣T(n)∣\left|\sum_{k=n}^{\infty} T(k)\right| \le C |T(n)|. The bound is infinite if p>qp > q, if Re⁡(bi+n)>0\operatorname{Re}(b_i + n) > 0 fails for some ii, or if nn is too small for the term ratio to be bounded below 1, even when the series converges. See Convergent series.

Heuristically chooses the number of terms nn for summing the series at prec bits of working precision.

More

Like acb_hypgeom_pfq_choose_n for power series parameters and argument, using their constant terms; the result is at least len.

void acb_hypgeom_pfq_sum(acb_t s, acb_t t, acb_srcptr a, slong p, acb_srcptr b, slong q, const acb_t z, slong n, slong prec)

Sets s=∑k=0n−1T(k)s = \sum_{k=0}^{n-1} T(k) and t=T(n)t = T(n). Requires n≥0n \ge 0. The outputs must not alias the inputs. No truncation error is added.

More
void acb_hypgeom_pfq_sum_invz(acb_t s, acb_t t, acb_srcptr a, slong p, acb_srcptr b, slong q, const acb_t z, const acb_t w, slong n, slong prec)

Like acb_hypgeom_pfq_sum_bs and acb_hypgeom_pfq_sum, but given w=1/zw = 1/z (and also zz for the second function), which is advantageous when ww has few bits, as in asymptotic expansions at an integer or short argument: binary splitting then divides by ww instead of multiplying by the long zz.

void acb_hypgeom_pfq_direct(acb_t res, acb_srcptr a, slong p, acb_srcptr b, slong q, const acb_t z, slong n, slong prec)

Sets res to

pfq(z)=∑k=0∞T(k)=∑k=0n−1T(k)+ε,{}_pf_{q}(z) = \sum_{k=0}^{\infty} T(k) = \sum_{k=0}^{n-1} T(k) + \varepsilon,

computed directly from the series with acb_hypgeom_pfq_sum and a rigorous bound for the truncation error ε\varepsilon from acb_hypgeom_pfq_bound_factor. If n<0n < 0, the number of terms is chosen with acb_hypgeom_pfq_choose_n. If T(n)T(n) is exactly zero (a terminating series), no error is added. For real input the error is added to the real part only.

void acb_hypgeom_pfq_series_sum_forward(acb_poly_t s, acb_poly_t t, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, const acb_poly_t z, int regularized, slong n, slong len, slong prec)
void acb_hypgeom_pfq_series_sum_bs(acb_poly_t s, acb_poly_t t, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, const acb_poly_t z, int regularized, slong n, slong len, slong prec)
void acb_hypgeom_pfq_series_sum_rs(acb_poly_t s, acb_poly_t t, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, const acb_poly_t z, int regularized, slong n, slong len, slong prec)
void acb_hypgeom_pfq_series_sum(acb_poly_t s, acb_poly_t t, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, const acb_poly_t z, int regularized, slong n, slong len, slong prec)

Sets s=∑k=0n−1T(k)s = \sum_{k=0}^{n-1} T(k) and t=T(n)t = T(n) for parameters and argument that are power series, with all arithmetic truncated to length len. Requires n≥0n \ge 0 and len≥1\mathit{len} \ge 1. The outputs must not alias the inputs.

More
void acb_hypgeom_pfq_series_direct(acb_poly_t res, const acb_poly_struct * a, slong p, const acb_poly_struct * b, slong q, const acb_poly_t z, int regularized, slong n, slong len, slong prec)

Sets res to pfq(z){}_pf_{q}(z) (regularized if regularized is set) for parameters and argument that are power series, truncated to length len ≥1\ge 1, summing nn terms of the series and adding a rigorous bound for the truncation error in each coefficient (see Power series parameters). If n<0n < 0, the number of terms is chosen automatically.

References#

  • [DYF1999] A. Dzieciol, S. Yngve and P. O. Fröman, "Coulomb wave functions with complex values of the variable and the parameters", J. Math. Phys. 40, 6145 (1999), https://doi.org/10.1063/1.533083
  • [Gas2018] D. Gaspard, "Connection formulas between Coulomb wave functions" (2018), https://arxiv.org/abs/1804.10976
  • [Mic2007] N. Michel, "Precise Coulomb wave functions for a wide range of complex l, eta and z", Computer Physics Communications, Volume 176, Issue 3, (2007), 232-249, https://doi.org/10.1016/j.cpc.2006.10.004
  • [NIST2012] National Institute of Standards and Technology, Digital Library of Mathematical Functions (2012), https://dlmf.nist.gov/
  • [Fungrim] F. Johansson. Fungrim: the Mathematical Functions Grimoire. https://fungrim.org
Cite this page

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