|
Lanczos approximation
numericana.com/answer/info/godfrey.htm
The Lanczos approximation consists of the formula
\[\Gamma(z+1) = \sqrt{2\pi} {\left( z + g + \tfrac12 \right)}^{z + 1/2 } e^{-(z+g+1/2)} A_g(z)\]
for the gamma function, with
\[A_g(z) = \frac12p_0(g) + p_1(g) \frac{z}{z+1} + p_2(g) \frac{z(z-1)}{(z+1)(z+2)} + \cdots\]
Here $g$ is a real constant that may be chosen arbitrarily subject to the restriction that $\text{Re}(z+g+\frac12)>0$.
The coefficients are given by
\[p_k(g) = \frac{\sqrt{2\,}}{\pi} \sum_{\ell=0}^k C_{2k+1,\,2\ell+1} \left(\ell - \tfrac{1}{2} \right)! {\left(\ell + g + \tfrac{1}{2} \right)}^{-(\ell+1/2)} e^{\ell + g + 1/2 }\]
where $C_{n,m}$ represents the $(n,m)$th element of the matrix of coefficients for the Chebyshev polynomials, which can be calculated recursively from these identities:
$$\begin{aligned}
C_{1,\,1} &= 1 \\[5px]
C_{2,\,2} &= 1 \\[5px]
C_{n+1,\,1} &= -\,C_{n-1,\,1} & \text{ for } n &= 2, 3, 4\, \dots \\[5px]
C_{n+1,\,n+1} &= 2\,C_{n,\,n} & \text{ for } n &= 2, 3, 4\, \dots \\[5px]
C_{n+1,\,m+1} &= 2\,C_{n,\,m} - C_{n-1,\,m+1} & \text{ for } n & > m = 1, 2, 3\, \dots
\end{aligned}$$ |
|