# NewGamePhysics.Mathematics.Gamma Class Reference

Special functions: Gamma functions. More...

List of all members.

## Static Public Member Functions
static double | LogFunction (double x)
| Calculates the logarithm of the gamma function ln(G(x)). Evaluated iteratively. Reference: M. Pike, D. Hill, Algorithm 291: Logarithm of the Gamma Function, Communications of the ACM, Vol. 9, #9, 09/1966, page 684. See also: http://mathworld.wolfram.com/LogGammaFunction.html.

## Detailed Description

Special functions: Gamma functions.

Definition at line 13 of file Gamma.cs.

## Member Function Documentation

static double NewGamePhysics.Mathematics.Gamma.LogFunction | ( | double | x | ) | `[static]`

Calculates the logarithm of the gamma function ln(G(x)). Evaluated iteratively. Reference: M. Pike, D. Hill, Algorithm 291: Logarithm of the Gamma Function, Communications of the ACM, Vol. 9, #9, 09/1966, page 684. See also: http://mathworld.wolfram.com/LogGammaFunction.html.

Parameters:

  | x | The argument of the log gamma function. Value range >0.

Returns:
  The logarithm of the gamma function at x.

Definition at line 26 of file Gamma.cs.

    00027         {
    00028             if (x <= 0)
    00029             {
    00030                 throw new ArgumentOutOfRangeException("x");
    00031             }
    00032
    00033             double f;
    00034             double y;
    00035             double z;
    00036
    00037             y = x;
    00038             if (x < 7.0)
    00039             {
    00040                 f = 1.0;
    00041                 z = y;
    00042                 while (z < 7.0)
    00043                 {
    00044                     f *= z;
    00045                     z += 1.0;
    00046                 }
    00047
    00048                 y = z;
    00049                 f = -Math.Log(f);
    00050             }
    00051             else
    00052             {
    00053                 f = 0.0;
    00054             }
    00055
    00056             z = 1.0 / (y * y);
    00057
    00058             double v =
    00059                 f + (y - 0.5) * Math.Log(y) - y + 0.918938533204673 +
    00060                 (((-0.000595238095238 * z + 0.000793650793651) * z - 0.002777777777778) * z + 0.083333333333333) / y;
    00061
    00062             return v;
    00063         }

The documentation for this class was generated from the following file:

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Mathematics/Gamma.cs