# Re: factorial

```Michael Xu Wang wrote:
>
> does anyone know how the calculators calculate the factorial of a
> floating number, like 2.1!=2.19762...?

The factorial only has the non-negative integers as a domain, but the
gamma function is often used to calculate "factorials" of numbers which
can't be determined using the typical n!=n*(n-1)*(n-2)*...*3*2*1.  The
gamma function is defined at all points on the real number line except
the negative integers (it may also be used to compute the factorial of
complex arguments).  The gamma function is defined as
Gamma(x)=Int[0...infinity,t^(x-1)*e^(-t)dt].  Using some integration by
parts you can easily see that Gamma(x+1)=x*Gamma(x), which for positive
integers is the recursive definition of the factorial function.  Using
this, the relationship between factorial and gamma may be expressed as
Gamma(x+1)=x!.  Since
Int[0...infinity,e^(-t)*t^(-1/2)dt]=2*Int[0...infinity,e^(-x^2)dx],
Gamma(1/2)=sqrt(pi).  Using this with the recursive formula, any numbers
which are multiples of 1/2 (e.g., -5/2, 7/2) may have their gamma values
computed in terms of sqrt(pi).  As an example
(1/2)!=Gamma(3/2)=1/2*Gamma(1/2)=Sqrt(pi)/2.  The gamma function can be
expressed in many other ways.  Two of the most common are
Gamma(x)=Limit[n->infinity,n!*n^x/(x*(x+1)*(x+2)*...*(x+n-1)*(x+n))] and
1/Gamma(x)=x*e^(_gamma_*x)*ProductSummation[n=1...infinity,(1+x/n)*e^(-x/n)],
where _gamma_ is Euler's constant (defined as -d/dx(Gamma(1))), which
may be expressed as Limit[n->infinity,Sum[k=1...n,1/k]-ln(n)].  It is
approximately 0.5772156649....  (It may be rational or irrational-no one
yet knows.)

-David-

```

References:
• factorial
• From: Michael Xu Wang <wangm@SLIP.NET>