Returns the Gamma function of a double.

Namespace: Imsl.Math
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.0.0

Syntax

C#
public static double Gamma(
	double x
)
Visual Basic (Declaration)
Public Shared Function Gamma ( _
	x As Double _
) As Double
Visual C++
public:
static double Gamma(
	double x
)

Parameters

x
Type: System..::.Double
A double value.

Return Value

A double value specifying the Gamma function of x. If x is a negative integer, the result is NaN.

Remarks

The Gamma function, \Gamma (x), is defined to be

\Gamma \left( x \right) = \int_0^\infty 
            {t^{x - 1} } e^{ - t} dt \,\,\,\, for \, x \gt 0

For x \lt 0, the above definition is extended by analytic continuation.

The Gamma function is not defined for integers less than or equal to zero. Also, the argument x must be greater than -170.56 so that \Gamma (x) does not underflow, and x must be less than 171.64 so that \Gamma (x) does not overflow. The underflow limit occurs first for arguments that are close to large negative half integers. Even though other arguments away from these half integers may yield machine-representable values of \Gamma (x), such arguments are considered illegal. Users who need such values should use the Log Gamma. Finally, the argument should not be so close to a negative integer that the result is less accurate than half precision.

Plot of Gamma(x)

See Also