Learn R Programming

flint (version 0.0.3)

arb_hypgeom_2f1: Hypergeometric Functions

Description

Computes the principal branch of the hypergeometric function \({}_{2}F_{1}(a, b, c, z)\), defined by $$\sum_{k = 0}^{\infty} \frac{(a)_{k} (b)_{k}}{(c)_{k}} \frac{z^{k}}{k!}$$ for \(|z| < 1\) and by analytic continuation elsewhere in the \(z\)-plane, or the principal branch of the regularized hypergeometric function \({}_{2}F_{1}(a, b, c, z) / \Gamma(c)\).

Usage

arb_hypgeom_2f1(a, b, c, x, flags = 0L, prec = flintPrec())
acb_hypgeom_2f1(a, b, c, z, flags = 0L, prec = flintPrec())

Value

An arb or acb vector storing function values with error bounds. Its length is the maximum of the lengths of the arguments or zero (zero if any argument has length zero). The arguments are recycled as necessary.

Arguments

a, b, c, x, z

numeric, complex, arb, or acb vectors.

flags

an integer vector. The lowest bit of the integer element(s) indicates whether to regularize. Later bits indicate special cases for which an alternate algorithm may be used. Non-experts should use flags = 0L or 1L, leaving the later bits unset.

prec

a numeric or slong vector indicating the desired precision as a number of bits.

References

The FLINT documentation of the underlying C functions: https://flintlib.org/doc/arb_hypgeom.html, https://flintlib.org/doc/acb_hypgeom.html

NIST Digital Library of Mathematical Functions: https://dlmf.nist.gov/15

See Also

Classes arb and acb.

Examples

Run this code
h2f1 <- function(...) as.complex(acb_hypgeom_2f1(...))

set.seed(0xbcdeL)
r <- 10L
tol <- 0x1p-4
z.l1 <- complex(modulus  = runif(r,     0, 1-tol),
                argument = runif(r,     0,  2*pi))
z.g1 <- complex(modulus  = runif(r, 1+tol, 1/tol),
                argument = runif(r,     0,  2*pi))
z <- c(z.l1, z.g1)

## Elementary special cases from http://dlmf.nist.gov/15.4 :
all.equal(h2f1(1.0, 1.0, 2.0,  z  ),
          -log(1 - z)/z)
all.equal(h2f1(0.5, 1.0, 1.5,  z^2),
          0.5 * (log(1 + z) - log(1 - z))/z)
all.equal(h2f1(0.5, 1.0, 1.5, -z^2),
          atan(z)/z)
## [ see more in ../tests/acb_hypgeom_2f1.R ]

Run the code above in your browser using DataLab