Skip to content

tk-yoshimura/LanczosApproximation

Repository files navigation

LanczosApproximation

Lanczos approximation is a method for computing the gamma function numerically, published by Cornelius Lanczos in 1964. It is a practical alternative to the more popular Stirling's approximation for calculating the gamma function with fixed precision.

The Lanczos approximation consists of the formula:

Gamma Lanczos Approximation

for the gamma function, with

Ag term

The p coefficients are given by:

p coef

where C represents the (n, m)th element of the matrix of coefficients for the Chebyshev polynomials.

as equal to:

gamma2 Ag term2 p coef2

Log gamma is the following formula:

loggamma

If a fixed g is chosen, the coefficients can be calculated in advance and the sum is recast into the following form:

Ag term expand

Refer to Ag table.

Digamma is the following formula:

digamma

The multiplier of p is calculated from the following formula:

c series

N = 1:

N1

N = 2:

N2

N = 3:

N3

N > 3:

Refer to r table.

(Quote: wikipedia)

About

Coefficient generation of Lanczos approximation

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published