Learn R Programming

flint (version 0.0.4)

arb_hypgeom_gamma_lower: Incomplete Gamma and Related Functions

Description

Compute the principal branch of the (optionally, regularized) incomplete gamma and beta functions. The lower incomplete gamma function \(\gamma(s, z)\) is defined by $$\int_{0}^{z} t^{s - 1} e^{-t} \text{d}t$$ for \(\Re(s) > 0\) and by analytic continuation elsewhere in the \(s\)-plane, excluding poles at \(s = 0, -1, \ldots\). The upper incomplete gamma function \(\Gamma(s, z)\) is defined by $$\int_{z}^{\infty} t^{s - 1} e^{-t} \text{d}t$$ for \(\Re(s) > 0\) and by analytic continuation elsewhere in the \(s\)-plane except at \(z = 0\). The incomplete beta function \(B(a, b, z)\) is defined by $$\int_{0}^{z} t^{a - 1} (1 - t)^{b - 1} \text{d}t$$ for \(\Re(a), \Re(b) > 0\) and by analytic continuation to all other \((a, b)\). It coincides with the beta function at \(z = 1\). The regularized functions are \(\gamma(s, z)/\Gamma(s)\), \(\Gamma(s, z)/\Gamma(s)\), and \(B(a, b, z)/B(a, b)\).

Usage

arb_hypgeom_gamma_lower(s, x, flags = 0L, prec = flintPrec())
acb_hypgeom_gamma_lower(s, z, flags = 0L, prec = flintPrec())

arb_hypgeom_gamma_upper(s, x, flags = 0L, prec = flintPrec()) acb_hypgeom_gamma_upper(s, z, flags = 0L, prec = flintPrec())

arb_hypgeom_beta_lower(a, b, x, flags = 0L, prec = flintPrec()) acb_hypgeom_beta_lower(a, b, 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

x, z, s, a, b

numeric, complex, arb, or acb vectors.

flags

an integer vector with elements 0, 1, or 2 indicating unregularized, regularized, or “alternately” regularized; see the FLINT documentation.

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/8

See Also

Classes arb and acb; arb_hypgeom_gamma and arb_hypgeom_beta for the “complete” gamma and beta functions.

Examples

Run this code
hg  <- acb_hypgeom_gamma
hgl <- acb_hypgeom_gamma_lower
hgu <- acb_hypgeom_gamma_upper

hb  <- acb_hypgeom_beta
hbl <- acb_hypgeom_beta_lower

set.seed(0xcdefL)
r <- 10L
eps <- 0x1p-4
a <- flint:::complex.runif(r, modulus = c(  0, 1/eps))
b <- flint:::complex.runif(r, modulus = c(  0, 1/eps))
z <- flint:::complex.runif(r, modulus = c(eps, 1/eps))

## Some trivial identities
stopifnot(# http://dlmf.nist.gov/8.2.E3
          all.equal(hgl(a, z) + hgu(a, z), hg(a), tolerance = 1e-5),
          # https://dlmf.nist.gov/8.4.E5
          all.equal(hgu(1, z), exp(-z), check.class = FALSE))

## Regularization
stopifnot(all.equal(hgl(a,    z, flags = 1L), hgl(a,    z)/hg(a   )),
          all.equal(hgu(a,    z, flags = 1L), hgu(a,    z)/hg(a   )),
          all.equal(hbl(a, b, z, flags = 1L), hbl(a, b, z)/hb(a, b)))

## A relation with the hypergeometric function from
##   https://dlmf.nist.gov/8.17.E7 :
h2f1 <- acb_hypgeom_2f1
stopifnot(all.equal(hbl(a, b, z), z^a * h2f1(a, 1 - b, a + 1, z)/a))

Run the code above in your browser using DataLab