gamma#

Purpose#

Returns the value of the gamma function.

Format#

g = gamma(x)#
Parameters:

x (NxK matrix or N-dimensional array) – the values used to evaluate the gamma function.

Returns:

g (NxK matrix or N-dimensional array) – the value of the gamma function evaluated at x.

Examples#

g = gamma(2.5);

After the code above:

g = 1.329340

Remarks#

For each element of x this function returns the integral

\[\int_{0}^{\infty}t^{(x−1)⁢}e^{−t}dt\]

All elements of x must be positive and less than or equal to 169. Values of x greater than 169 will cause an overflow.

The natural log of gamma() is often what is required and it can be computed without the overflow problems of gamma() using lnfact().