| gammaVer | R Documentation |
Provide different variants or versions of computing the Gamma (Γ) function.
gammaVer(x, version, traceLev = 0)
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. |
All of these are good algorithms to compute Γ(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
.
.
.
Used in R from ... up to versions 4.2.z
Possibly to be used in R 4.3.z and newer.
numeric vector as x
Martin Maechler
.... TODO ....
gamma(), R's own Gamma function.
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)