Can non-integer factorials be calculated without numerical integration?

753 Views Asked by At

I saw a strange way to write the factorial function somewhere and after some integration by parts, it all sure enough worked out.

$$ n! = \int_0^\infty x^{n}e^{-x}dx $$ $$ =\left[-x^{n}e^{-x}\right]^{\infty}_{0}-\int_0^\infty -nx^{n-1}e^{-x}dx\, $$ $$ =-\infty^{n}e^{-\infty}-(-0^{n}e^{-0})-(-n)\int_0^\infty x^{n-1}e^{-x}dx $$ $$ =n\int_0^\infty x^{n-1}e^{-x}dx $$ $$ =n(n-1)! $$ I have seen non-integer factorials many times before in my programming experience because many pre-made factorial functions/methods can receive and return non-integers for some reason, but now I actually understand it. When trying to do 1.5! for myself, I quickly ran into problems because it just led to never-ending integration by parts. So I wrote a quick program to approximate with Simpson's rule and it gave results consistent with what the Google calculator gave. But anyway, (getting to the point finally), can these factorials be calculated without numerical integration like with Simpson's Rule? Are these results just irrational or also transcendental?

3

There are 3 best solutions below

1
On

This is essentially the Gamma function ($\Gamma(n) = (n-1)!$ for $x=1,2,3,\ldots$).

Exact values of the Gamma function can be computed only for integral multiples of $\frac12$, and it becomes infinite at all nonpositive integers.

There are several tricks to compute $(-\frac12)! =\Gamma(\frac12)=\sqrt{\pi}$. You can repeatedly use the fact that $x\Gamma(x)=\Gamma(x+1)$ (this is a restatement of $n(n-1)!=n!$) to compute the value of the Gamma function at any half-integer by expressing it in terms of $\Gamma(\frac12)$.

0
On

$$G(n)=\int_0^\infty e^{-x^n}dx\quad\iff\quad n!=G\bigg(\frac1n\bigg)$$ For $n=\dfrac12$ , see Gaussian integral, containing several proofs as to why its value is $\dfrac{\sqrt\pi}2$ . As to the irrationality and transcendence of these values, this has only been proven for the cases where the denominator is $2,3,4,$ and $6$. In the following lines, will provide yet another proof for the value of the Gaussian integral: It can be proven by induction and/or finite differences that $\displaystyle\int_0^1\big(1-\sqrt[n]x\big)^m$ $=\dfrac{m!\cdot n!}{(m+n)!}={m+n\choose n}^{-1}$ , which for $m=n=\dfrac12$ yields $\displaystyle\frac\pi4=\int_0^1\sqrt{1-x^2}\,dx=\Big(\tfrac12!\Big)^2$. QED.

0
On

It's actualy really easy, every product can be writen as sum, integrals are much harder as tend not to be as intunitive as sums and products. As we all learned 3*2= 2+2+2. If you apply this to normal products you will get:

$$\prod_{i=b}^c 1+a_i=1+\sum_{i=b}^{c} (a_i)+$$$$1/2! ((\sum_{i=b}^c (a_i))^2-\sum_{i=b}^c (a_i)^2+$$ $$1/3!((\sum_{i=b}^c (a_i))^3-3\sum_{i=b}^c (a_i)^2\sum_{i=b}^c (a_i)+2\sum_{i=b}^c (a_i)^3)+$$ $$1/4!((\sum_{i=b}^c (a_i))^4-6(\sum_{i=b}^c (a_i))^2\sum_{i=b}^c (a_i)^2+3(\sum_{i=b}^c (a_i)^2)^2+8(\sum_{i=b}^c (a_i)^3)\sum_{i=b}^c (a_i)-6\sum_{i=b}^c (a_i)^4)$$

I guess you see the pattern, dived them by the factorial and the refined stirling numbers.

An example for the factorial: $$(n+1)!=$$ $$1+$$ $$(n)(n+1)/2+$$ $$1/2((n+1)^2(n)^2/4-(n)(n+1)(2n+1))/6+$$ $$1/6((n)^3(n+1)^3/8-3(n^2(n+1)^2(2n+1)/12+2(n+1)^2(n)^2/4)+...$$

If you want to get a decent result without going to far, i'd say stop with terms just a little over the factorial you want. So take the roundup c of terms with 1 being the first term. So this works decent between 1! and 4!. It's bad around 0 but you can always manipulate them.

Also a great trick to compute negative products. If you want the discreet product you just need to get the discreet sum. If you want to take the derivative don't forget the correction value if it's n^0.