GAMMA function
Description
GAMMA(x) returns the Gamma function of x.
When the argument n is an integer, the gamma function is similar to the factorial function, offset by one. Gamma(n) is defined as:
$$ \Gamma(n) = (n-1)! $$
When x is a real number Gamma(x) is defined by the integral:
$$ \Gamma(x) = \int_0^\infty t^{x-1} e^{-t}\,{\rm d}t $$
The argument n must be higher than 0.
If n is larger than 171.62, the function overflows and returns an error. For large arguments the GammaLn function can be used.
The argument n can be a real number or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the Gamma function applied to all elements.