Gamma and Related Functions

The Gamma function, Γ(x) is a generalization of the factorial. It is defined as

$$\Gamma(x) = \int_0^\inf t^{x-1}e^{-t}\,dt$$

The Special class provides static methods for evaluating the Gamma function and its variants, including Beta functions and the Digamma function.

Gamma functions

The Gamma method evaluates the standard Gamma function. The LogGamma method evaluates the natural logarithm of (the absolute value of) the Gamma function. Both methods have overloads for real and complex arguments. This method has an overload that takes an additional integer out parameter. On exit, this parameter contains the sign of the Gamma function.

The incomplete Gamma function is defined as

$$\Gamma(a, x) = \int_x^\inf t^{a-1}e^{-t}\,dt$$

It is implemented as the IncompleteGamma method. Allowing the upper bound of the integral to vary as well leads to a second variant of IncompleteGamma that takes three arguments.

The regularized Gamma functions are defined by

$$Q(a,x) = \frac{\Gamma(a, x)}{\Gamma(x)}, P(a, x) = 1 - Q(a, x)$$

and implemented by the RegularizedGammaP and RegularizedGammaQ methods. Table 1 summarizes the methods that implement Gamma functions.

Method

Description

Gamma or Gamma

(Overloaded.) Gamma function for real or complex argument.

LogGamma or LogGamma

(Overloaded.) Natural logarithm of the Gamma function for real or complex argument. Optionally returns the sign in a second out parameter.

IncompleteGamma

(Overloaded.) Incomplete Gamma function for two or three real arguments.

RegularizedGammaP

Regularized Gamma function of the first kind.

RegularizedGammaQ

Regularized Gamma function of the second kind.

InverseRegularizedGammaP

Inverse of the regularized Gamma function of the first kind.

InverseRegularizedGammaQ

Inverse of the regularized Gamma function of the second kind.

Table 1. Gamma functions.

Beta functions

The Beta function is closely related to the Gamma function. It is defined as:

B(a, b) = \int_0^1 t^{a-1}(1-t)^{b-1}\,dt = \frac{\Gamma(a)\Gamma(b)}{\Gamma(a+b)}

The methods that implement the Beta function and related functions are listed below:

Method

Description

Beta

Beta function for real arguments.

LogBeta

Natural logarithm of the Beta function for real arguments.

RegularizedBeta

Regularized Beta function for real arguments.

InverseRegularizedBeta

Inverse of the regularized Beta function for real arguments.

Table 2. Beta functions.

Other Gamma-related functions

The DiGamma function Psi(x) is the derivative of the logarithm of the Gamma function. It is implemented by the Digamma method, with overloads for real and integer arguments. When the argument is an integer, the following special relation holds:

$$\psi(n) = H_{n-1} - \gamma$$

where γ is EulersConstant and the first term is a so-called harmonic number, also available through the HarmonicNumber method.

The TaylorCoefficient method evaluates the Taylor coefficient of the specified degree for a specified value of the argument.