Factorials...How do they do it?

317 Views Asked by At

So I've been recently arguing with my teacher about factorials. My teacher says that factorials can only be calculated for integers, because the definition of factorials is as follows:

the product of an integer and all the integers below it

But I've seen many different calculators where you can find the factorials of real numbers, like $5!$, $1.1!$, $-5.7!$, $\sqrt 2!$ or $(\tan 85)!$ and so on...

How do calculators do this? What formula do they use? It's obviously not $(n) \times (n-1) \times \cdots \times 1$ where $n$ is some integer. (In this case it's any real number)

1

There are 1 best solutions below

2
On BEST ANSWER

The calculator is using the gamma function, that satisfies for natural numbers $n$ $$\Gamma(n) = (n-1)!$$ and it is given by $$\Gamma(t) = \int_0^\infty x^{t-1}e^{-x}\,\mathrm{d}x.$$ However, note that when you say $-5.7!$, that means $-(5.7!),$ not $(-5.7)!$.