3.5.1.3.36 Gamma

Definition:

gamma = gamma(x) evaluates

\Gamma (x)=\int_0^\infty t^{x-1}e^{-t}dt

The function is based on a Chebyshev expansion for \Gamma(1+u), and uses the property \Gamma(1+x) = x\Gamma(x).

If x = N +1+u where N is integral and 0 ≤ u < 1 then it follows that:

for N >0 \Gamma(x) = (x - 1)(x - 2) . . . (x - N)\Gamma(1 + u)

for N = 0 \Gamma(x) = \Gamma(1+u)

for N <0 \Gamma(x) = \Gamma(1+u)/x(x + 1)(x + 2) . . . (x - N - 1).

For more information please review the s14aac function in the NAG document

Parameters:

x (input, double)
The argument x of the function.
Constraint: x must not be zero or a negative integer.
gamma (output, double)
the value of the function \Gamma (x)=\int_0^\infty t^{x-1}e^{-t}dt