gammaVer {DPQ}R Documentation

Gamma Function Versions

Description

Provide different variants or versions of computing the Gamma (\Gamma) function.

Usage


gammaVer(x, version, traceLev = 0)

Arguments

x

numeric vector of absissa value for the Gamma function.

version

integer in {1,2,..,5} specifying which variant is desired.

traceLev

non-negative integer indicating the amount of diagnostic “tracing” output to the console during computation.

Details

All of these are good algorithms to compute \Gamma(x) (for real x), and indeed correspond to the versions R's implementation of gamma(x) over time. More specifically, the current version numbers correspond to

  1. .

  2. .

  3. .

  4. Used in R from ... up to versions 4.2.z

  5. Possibly to be used in R 4.3.z and newer.

Value

numeric vector as x

Author(s)

Martin Maechler

References

.... TODO ....

See Also

gamma(), R's own Gamma function.

Examples

xx <- seq(-4, 10, by=1/2)
gx <- sapply(1:5, gammaVer, x=xx)
gamx <- gamma(xx)
cbind(xx, gx, gamma=gamx)
apply(gx, 2, all.equal, target=gamx, tol = 0) # typically: {T,T,T,T, 1.357e-16}
stopifnot( apply(gx, 2, all.equal, target = gamx, tol = 1e-14))
                                                 # even 2e-16 (Lnx, 64b, R 4.2.1)

[Package DPQ version 0.5-8 Index]