# How did Lanczos find his approximation for the Gamma function?

The Lanczos approximation gives a fixed-precision method for calculating the Gamma function. It is used in Desmos in their factorial function.

According to this Wikipedia page, Lanczos derived his approximation of the Gamma function by rewriting its defining integral, $$\Gamma(z+1)=\int_0^{\infty}t^ze^{-t}dt$$Into the following form:

$$= (z + g + 1)^{z+1}e^{-(z+g+1)} \int_0^e \Big( v \left( 1-\log{v} \right) \Big)^zv^gdv$$

He then found a series representation for the integral in this expression.

What kind of substitution would you have to use to get this form of the integral? Moreover, where did the constant $$g$$ come from, and what motivated Lanczos to include this constant in his formula? Finally, how could you derive a series expansion for this integral?

EDIT

@Kstargamer gave me a hint to help with the first part of this problem, the rewriting of the Gamma function. It only requires a couple of substitutions.

Start with the substitution $$t = u(z+g+1) \iff dt=(z+g+1)du$$. The limits of integration remain the same. This gives: $$\Gamma(z+1)=\int_0^{\infty} (u(z+g+1))^ze^{-u(z+g+1)} (z+g+1) \,du \\ = (z+g+1)^{z+1} \int_0^{\infty} u^ze^{-u(z+g+1)} \,du$$

Next, substitute $$u = 1-\log{v} \iff v = e^{1-u}, du = -\frac{dv}{v}$$. As $$u \to 0, v \to e$$. As $$u \to \infty, v \to 0$$. This gives: $$\Gamma(z+1) = (z+g+1)^{z+1} \int_e^0 (1-\log{v})^z \left(\frac{v}{e}\right)^{z+g+1}\frac{-dv}{v} \\ = (z+g+1)^{z+1}e^{-(z+g+1)} \int_0^e (1-\log{v})^z v^{z+g}\, dv \\ \therefore \Gamma(z+1) = (z+g+1)^{z+1}e^{-(z+g+1)} \int_0^e \Big(v(1-\log{v})\Big)^z v^g\, dv$$

And with that, we have the simple manipulations that give the integral that Lanczos used.

However, this does not close the question. I’m still looking for a way to derive the series expansion for this integral that Lanczos used. I’m open to ANY suggestions as to how to find this.

• Apparently $g$ can be arbitrary... weird May 18, 2022 at 19:52
• Take $1-\log v = u$ then we arrive at $$\int_{1}^{\infty} (g+z+1)^{z+1}u^z e^{-u(g+z+1)} \, du$$ and proceed with some manipulation. May 18, 2022 at 20:31
• @KStarGamer Thank you! I’ll edit this note into my question. I’m still curious about where the full series expansion comes from, though. (P.S., that lower limit should be 0). May 23, 2022 at 14:01
• @Mailbox Yes you are correct, that should be $0$, that was a typo from me oops. The series expansion comes from using a Fourier series as far as I’m aware. See page $11$ of this paper. May 23, 2022 at 17:15
• That is an extremely useful paper. May 23, 2022 at 18:27