SpecialFunctions Type

Static members

Static member Description

SpecialFunctions.DiGamma(x)

Full Usage: SpecialFunctions.DiGamma(x)

Parameters:
    x : float - The argument of the digamma function.

Returns: float The value of the DiGamma function at x.

Computes the Digamma function which is mathematically defined as the derivative of the logarithm of the gamma function. This implementation is based on Jose Bernardo Algorithm AS 103: Psi ( Digamma ) Function, Applied Statistics, Volume 25, Number 3, 1976, pages 315-317. Using the modifications as in Tom Minka's lightspeed toolbox.

x : float

The argument of the digamma function.

Returns: float

The value of the DiGamma function at x.

SpecialFunctions.DiGammaInv(p)

Full Usage: SpecialFunctions.DiGammaInv(p)

Parameters:
    p : float - The argument of the inverse digamma function.

Returns: float The positive solution to the inverse DiGamma function at p.

Computes the inverse Digamma function: this is the inverse of the logarithm of the gamma function. This function will only return solutions that are positive.

This implementation is based on the bisection method.

p : float

The argument of the inverse digamma function.

Returns: float

The positive solution to the inverse DiGamma function at p.

SpecialFunctions.Gamma(z)

Full Usage: SpecialFunctions.Gamma(z)

Parameters:
    z : float - The argument of the gamma function.

Returns: float The logarithm of the gamma function.

Computes the Gamma function.

This implementation of the computation of the gamma and logarithm of the gamma function follows the derivation in "An Analysis Of The Lanczos Gamma Approximation", Glendon Ralph Pugh, 2004. We use the implementation listed on p. 116 which should achieve an accuracy of 16 floating point digits. Although 16 digit accuracy should be sufficient for double values, improving accuracy is possible (see p. 126 in Pugh).

Our unit tests suggest that the accuracy of the Gamma function is correct up to 13 floating point digits.

z : float

The argument of the gamma function.

Returns: float

The logarithm of the gamma function.

SpecialFunctions.GammaLn(z)

Full Usage: SpecialFunctions.GammaLn(z)

Parameters:
    z : float - The argument of the gamma function.

Returns: float The logarithm of the gamma function.

Computes the logarithm of the Gamma function.

This implementation of the computation of the gamma and logarithm of the gamma function follows the derivation in "An Analysis Of The Lanczos Gamma Approximation", Glendon Ralph Pugh, 2004. We use the implementation listed on p. 116 which achieves an accuracy of 16 floating point digits. Although 16 digit accuracy should be sufficient for double values, improving accuracy is possible (see p. 126 in Pugh).

Our unit tests suggest that the accuracy of the Gamma function is correct up to 14 floating point digits.

z : float

The argument of the gamma function.

Returns: float

The logarithm of the gamma function.

SpecialFunctions.GammaLowerIncomplete(a, x)

Full Usage: SpecialFunctions.GammaLowerIncomplete(a, x)

Parameters:
    a : float - The argument for the gamma function.
    x : float - The upper integral limit.

Returns: float The lower incomplete gamma function.

Returns the lower incomplete gamma function gamma(a,x) = int(exp(-t)t^(a-1),t=0..x) for real a > 0, x > 0.

a : float

The argument for the gamma function.

x : float

The upper integral limit.

Returns: float

The lower incomplete gamma function.

SpecialFunctions.GammaLowerRegularized(a, x)

Full Usage: SpecialFunctions.GammaLowerRegularized(a, x)

Parameters:
    a : float - The argument for the gamma function.
    x : float - The upper integral limit.

Returns: float The lower incomplete gamma function.

Returns the lower incomplete regularized gamma function P(a,x) = 1/Gamma(a) * int(exp(-t)t^(a-1),t=0..x) for real a > 0, x > 0.

a : float

The argument for the gamma function.

x : float

The upper integral limit.

Returns: float

The lower incomplete gamma function.

SpecialFunctions.GammaLowerRegularizedInv(a, y0)

Full Usage: SpecialFunctions.GammaLowerRegularizedInv(a, y0)

Parameters:
    a : float
    y0 : float

Returns: float

Returns the inverse P^(-1) of the regularized lower incomplete gamma function P(a,x) = 1/Gamma(a) * int(exp(-t)t^(a-1),t=0..x) for real a > 0, x > 0, such that P^(-1)(a,P(a,x)) == x.

a : float
y0 : float
Returns: float

SpecialFunctions.GammaUpperIncomplete(a, x)

Full Usage: SpecialFunctions.GammaUpperIncomplete(a, x)

Parameters:
    a : float - The argument for the gamma function.
    x : float - The lower integral limit.

Returns: float The upper incomplete gamma function.

Returns the upper incomplete gamma function Gamma(a,x) = int(exp(-t)t^(a-1),t=0..x) for real a > 0, x > 0.

a : float

The argument for the gamma function.

x : float

The lower integral limit.

Returns: float

The upper incomplete gamma function.

SpecialFunctions.GammaUpperRegularized(a, x)

Full Usage: SpecialFunctions.GammaUpperRegularized(a, x)

Parameters:
    a : float - The argument for the gamma function.
    x : float - The lower integral limit.

Returns: float The upper incomplete regularized gamma function.

Returns the upper incomplete regularized gamma function Q(a,x) = 1/Gamma(a) * int(exp(-t)t^(a-1),t=0..x) for real a > 0, x > 0.

a : float

The argument for the gamma function.

x : float

The lower integral limit.

Returns: float

The upper incomplete regularized gamma function.