Factorial and Gamma function

461 Views Asked by At

Problem

According to Wikipedia, the Gamma function is computed as $$ \Gamma(z)=\int_{0}^{\infty} x^{z-1} e^{-x} d x $$ where $z$ is a complex number.

Using integration by parts, it is easy to verify that $\Gamma(z)=(z-1)\Gamma(z-1)$ and therefore I have $$\Gamma(z) = (z-1)!$$ However, I am not sure how do I compute something like $4.7!$ (or value of any real number). I tried $4.7\cdot 3.7\cdots \cdot 0.7$, but it does not give the correct result as verified by scipy.math.gamma function.

5

There are 5 best solutions below

0
On BEST ANSWER

I mean, what does your formula actually tell you? It tells you that $$\Gamma(5.7)=4.7\times3.7\times2.7\times1.7\times0.7\times\Gamma(0.7)$$ But there's no reason why $\Gamma(0.7)=1$ like you seem to have assumed. The gamma functions is very difficult to calculate exactly, but fast approximations are also given on the wikipedia page.

0
On

I think the comments given are already getting you on the right track, however let's assume you don't mean $4.7!$ but instead to calculate $\Gamma(5.7)$. Let's take a second look at that product you have: $$ \Gamma(5.7) = 4.7 \Gamma(4.7)=...=(4.7)(3.7)(2.7)(1.7)(0.7)\Gamma(0.7)$$

Now we are stuck with the question, what is $\Gamma(0.7)$? Based on the linked related question it looks like there are some approximations or approaches to representing that.

0
On

The only way to compute $\Gamma(4.7)$ is by approximately evaluating the integral definition, or some equivalent definition, by numerical methods, although you can of course shift the argument by an integer first using the recursion formula. The only useful base cases for the recursion alone are for half-integer arguments viz. $\Gamma(1/2)=\sqrt{\pi},\,\Gamma(1)=1$, which won't help you.

0
On

If $z=4.7$ then the Gamma function recursion gives $$\Gamma(4.7)=4.7\cdot 3.7\cdot 2.7\cdot 1.7\cdot 0.7\cdot \Gamma(0.7)$$ but $\Gamma(0.7)\neq 1$. The factorial property requires $z$ to be integral, i.e. $\Gamma(z)=(z-1)!$ when $z$ is a positive integer. This factorial result is because $$\Gamma(z)=(z-1)(z-2)\cdots(2)(1)\Gamma(1)$$ when $z$ is a positive integer, and $\Gamma(1)=1$.

0
On

As was mentioned in the comments, saying $z!$ does not mean anything unless $z$ is a non-negative integer. While it's true that $\Gamma(z+1)=z\Gamma(z)$ for all $z$, it does not mean that $\Gamma(z+1)=z!$ for all $z$.

If you want to compute values of $\Gamma$, an efficient is the following infinite product: $$\Gamma(z)=\frac1{z}\prod_{k=1}^{\infty}\frac{\left(1+\frac{1}{k}\right)^z}{1+\frac{z}{k}}\qquad z\ne 0,-1,-2,...$$ You can approximate these values by letting $$G_n(z)=\frac{1}{z}\prod_{k=1}^{n}\frac{\left(1+\frac{1}{k}\right)^z}{1+\frac{z}{k}}$$ Which converges reasonably quickly as you let $n\to\infty$.