Documentation

GammaBase
in package

AbstractYes

Table of Contents

Constants

MAX_VALUE  = 1.2E+308

Methods

gammaValue()  : float
incompleteGamma()  : float
logGamma()  : float
logGamma function.
regularizedGammaP()  : float
Regularized lower incomplete gamma P(a,x) = gamma(a,x) / Gamma(a).
regularizedGammaQ()  : float
Regularized upper incomplete gamma Q(a,x) = 1 - P(a,x).
calculateDistribution()  : float
calculateInverse()  : float|string
logGamma3()  : float
logGamma4()  : float

Constants

MAX_VALUE

protected mixed MAX_VALUE = 1.2E+308

Methods

gammaValue()

public static gammaValue(float $value) : float
Parameters
$value : float
Return values
float

incompleteGamma()

public static incompleteGamma(float $a, float $x) : float
Parameters
$a : float
$x : float
Return values
float

logGamma()

logGamma function.

public static logGamma(float $x) : float

Original author was Jaco van Kooten. Ported to PHP by Paul Meagher.

The natural logarithm of the gamma function.
Based on public domain NETLIB (Fortran) code by W. J. Cody and L. Stoltz
Applied Mathematics Division
Argonne National Laboratory
Argonne, IL 60439

References:

  1. W. J. Cody and K. E. Hillstrom, 'Chebyshev Approximations for the Natural Logarithm of the Gamma Function,' Math. Comp. 21, 1967, pp. 198-203.
  2. K. E. Hillstrom, ANL/AMD Program ANLC366S, DGAMMA/DLGAMA, May, 1969.
  3. Hart, Et. Al., Computer Approximations, Wiley and sons, New York, 1968.

From the original documentation:

This routine calculates the LOG(GAMMA) function for a positive real argument X. Computation is based on an algorithm outlined in references 1 and 2. The program uses rational functions that theoretically approximate LOG(GAMMA) to at least 18 significant decimal digits. The approximation for X > 12 is from reference 3, while approximations for X < 12.0 are similar to those in reference 1, but are unpublished. The accuracy achieved depends on the arithmetic system, the compiler, the intrinsic functions, and proper selection of the machine-dependent constants.

Error returns:
The program returns the value XINF for X .LE. 0.0 or when overflow would occur. The computation is believed to be free of underflow and overflow.

Parameters
$x : float
Tags
version
1.1
author

Jaco van Kooten

Return values
float —

MAX_VALUE for x < 0.0 or when overflow would occur, i.e. x > 2.55E305

regularizedGammaP()

Regularized lower incomplete gamma P(a,x) = gamma(a,x) / Gamma(a).

public static regularizedGammaP(float $a, float $x) : float

Series for x < a+1, else the complement of the continued fraction.

Parameters
$a : float
$x : float
Return values
float

regularizedGammaQ()

Regularized upper incomplete gamma Q(a,x) = 1 - P(a,x).

public static regularizedGammaQ(float $a, float $x) : float

Continued fraction for x >= a+1 keeps the right tail free of cancellation.

Parameters
$a : float
$x : float
Return values
float

calculateDistribution()

protected static calculateDistribution(float $value, float $a, float $b, bool $cumulative) : float
Parameters
$value : float
$a : float
$b : float
$cumulative : bool
Return values
float

calculateInverse()

protected static calculateInverse(float $probability, float $alpha, float $beta) : float|string
Parameters
$probability : float
$alpha : float
$beta : float
Return values
float|string

logGamma3()

protected static logGamma3(float $y) : float
Parameters
$y : float
Return values
float

logGamma4()

protected static logGamma4(float $y) : float
Parameters
$y : float
Return values
float

        
On this page

Search results