Algorithms for hypergeometric functions¶
Convergent series¶
Let
We compute a factor C such that
We check that \(\operatorname{Re}(b+n) > 0\) for all lower parameters b. If this does not hold, C is set to infinity. Otherwise, we cancel out pairs of parameters \(a\) and \(b\) against each other. We have
and
for all \(k \ge n\). This gives us a constant D such that \(T(k+1) \le D T(k)\) for all \(k \ge n\). If \(D \ge 1\), we set C to infinity. Otherwise, we take \(C = \sum_{k=0}^{\infty} D^k = (1-D)^{-1}\).
Convergent series of power series¶
The same principle is used to get tail bounds for with \(a_i, b_i, z \in \mathbb{C}[[x]]\), or more precisely, bounds for each coefficient in \(\sum_{k=N}^{\infty} T(k) \in \mathbb{C}[[x]] / \langle x^n \rangle\) given \(a_i, b_i, z \in \mathbb{C}[[x]] / \langle x^n \rangle\). First, we fix some notation, assuming that \(A\) and \(B\) are power series:
- \(A_{[k]}\) denotes the coefficient of \(x^k\) in \(A\), and \(A_{[m:n]}\) denotes the power series \(\sum_{k=m}^{n-1} A_{[k]} x^k\).
- \(|A|\) denotes \(\sum_{k=0}^{\infty} |A_{[k]}| x^k\) (this can be viewed as an element of \(\mathbb{R}_{\ge 0}[[x]]\)).
- \(A \le B\) signifies that \(|A|_{[k]} \le |B|_{[k]}\) holds for all \(k\).
- We define \(\mathcal{R}(B) = |B_{[0]}| - |B_{[1:\infty]}|\).
Using the formulas
it is easy prove the following bounds for the coefficients of sums, products and quotients of formal power series:
If \(p \le q\) and \(\operatorname{Re}({b_i}_{[0]}+N) > 0\) for all \(b_i\), then we may take
If \(D_{[0]} < 1\),then \((1 - D)^{-1} |T(n)|\) gives the error bound.
Note when adding and multiplying power series with (complex) interval coefficients, we can use point-valued upper bounds for the absolute values instead of performing interval arithmetic throughout. For \(\mathcal{R}(B)\), we must then pick a lower bound for \(|B_{[0]}|\) and upper bounds for the coefficients of \(|B_{[1:\infty]}|\).
Asymptotic series for the confluent hypergeometric function¶
Let \(U(a,b,z)\) denote the confluent hypergeometric function of the second kind with the principal branch cut, and let \(U^{*} = z^a U(a,b,z)\). For all \(z \ne 0\) and \(b \notin \mathbb{Z}\) (but valid for all \(b\) as a limit), we have (DLMF 13.2.42)
Moreover, for all \(z \ne 0\) we have
which is equivalent to DLMF 13.2.41 (but simpler in form).
We have the asymptotic expansion
where \({}_2F_0(a,b,z)\) denotes a formal hypergeometric series, i.e.
The error term \(\varepsilon_n(z)\) is bounded according to DLMF 13.7. A case distinction is made depending on whether \(z\) lies in one of three regions which we index by \(R\). Our formula for the error bound increases with the value of \(R\), so we can always choose the larger out of two indices if \(z\) lies in the union of two regions.
Let \(r = |b-2a|\). If \(\operatorname{Re}(z) \ge r\), set \(R = 1\). Otherwise, if \(\operatorname{Im}(z) \ge r\) or \(\operatorname{Re}(z) \ge 0 \land |z| \ge r\), set \(R = 2\). Otherwise, if \(|z| \ge 2r\), set \(R = 3\). Otherwise, the bound is infinite. If the bound is finite, we have
in terms of the following auxiliary quantities
Asymptotic series for Airy functions¶
Error bounds are based on Olver (DLMF section 9.7). For \(\arg(z) < \pi\) and \(\zeta = (2/3) z^{3/2}\), we have
Assuming that n is positive, the error terms are bounded by
where
For computing Bi when z is roughly in the positive half-plane, we use the connection formulas
where \(w = \exp(\pi i/3)\). Combining roots of unity gives
where the upper formula is valid for \(-\pi/3 < \arg(z) < \pi\) and the lower formula is valid for \(-\pi < \arg(z) < \pi/3\). We proceed analogously for the derivative of Bi.
In the negative half-plane, we use the connection formulas
where \(z_1 = -z e^{+\pi i/3}\), \(z_2 = -z e^{-\pi i/3}\). Provided that \(|\arg(-z)| < 2 \pi / 3\), we have \(|\arg(z_1)|, |\arg(z_2)| < \pi\), and thus the asymptotic expansion for Ai can be used. As before, we collect roots of unity to obtain
where \(\zeta = (2/3) (-z)^{3/2}\) and
The differentiated formulas are analogous.
Corner case of the Gauss hypergeometric function¶
In the corner case where \(z\) is near \(\exp(\pm \pi i / 3)\), none of the linear fractional transformations is effective. In this case, we use Taylor series to analytically continue the solution of the hypergeometric differential equation from the origin. The function \(f(z) = {}_2F_1(a,b,c,z_0+z)\) satisfies
Knowing \(f(0), f'(0)\), we can compute the consecutive derivatives recursively, and evaluating the truncated Taylor series allows us to compute \(f(z), f'(z)\) to high accuracy for sufficiently small \(z\). Some experimentation showed that two continuation steps
gives good performance. Error bounds for the truncated Taylor series are obtained using the Cauchy-Kovalevskaya majorant method, following the outline in [Hoe2001]. The differential equation is majorized by
provided that \(N\) and \(\nu \ge \max(1/|z_0|, 1/|z_0-1|)\) are chosen sufficiently large. It follows that we can compute explicit numbers \(A, N, \nu\) such that the simple solution \(g(z) = A (1-\nu z)^{-N}\) of the differential equation provides the bound