Spouge's approximation

From HandWiki

In mathematics, Spouge's approximation is a formula for computing an approximation of the gamma function. It was named after John L. Spouge, who defined the formula in a 1994 paper.[1] The formula is a modification of Stirling's approximation, and has the form

[math]\displaystyle{ \Gamma(z+1) = (z+a)^{z+\frac12} e^{-z-a} \left( c_0 + \sum_{k=1}^{a-1} \frac{c_k}{z+k} + \varepsilon_a(z) \right) }[/math]

where a is an arbitrary positive integer and the coefficients are given by

[math]\displaystyle{ \begin{align} c_0 &= \sqrt{2 \pi}\\ c_k &= \frac{(-1)^{k-1}}{(k-1)!} (-k+a)^{k-\frac12} e^{-k+a} \qquad k\in\{1,2,\dots, a-1\}. \end{align} }[/math]

Spouge has proved that, if Re(z) > 0 and a > 2, the relative error in discarding εa(z) is bounded by

[math]\displaystyle{ a^{-\frac12} (2 \pi)^{-a-\frac12}. }[/math]

The formula is similar to the Lanczos approximation, but has some distinct features.[2] Whereas the Lanczos formula exhibits faster convergence, Spouge's coefficients are much easier to calculate and the error can be set arbitrarily low. The formula is therefore feasible for arbitrary-precision evaluation of the gamma function. However, special care must be taken to use sufficient precision when computing the sum due to the large size of the coefficients ck, as well as their alternating sign. For example, for a = 49, one must compute the sum using about 65 decimal digits of precision in order to obtain the promised 40 decimal digits of accuracy.

See also

References

  1. Spouge, John L. (1994). "Computation of the Gamma, Digamma, and Trigamma Functions". SIAM Journal on Numerical Analysis 31 (3): 931–000. doi:10.1137/0731050. https://zenodo.org/record/1236136. 
  2. * Pugh, Glendon (2004). An analysis of the Lanczos Gamma approximation (PDF) (PhD thesis).