Class LanczosApproximation

java.lang.Object
org.apache.commons.numbers.gamma.LanczosApproximation

public final class LanczosApproximation extends Object
Lanczos approximation to the Gamma function. It is related to the Gamma function by the following equation \[ \Gamma(x) = \sqrt{2\pi} \, \frac{(g + x + \frac{1}{2})^{x + \frac{1}{2}} \, e^{-(g + x + \frac{1}{2})} \, \mathrm{lanczos}(x)} {x} \] where \( g \) is the Lanczos constant. See equations (1) through (5), and Paul Godfrey's Note on the computation of the convergent Lanczos complex Gamma approximation.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final double[]
    Lanczos coefficients.
    private static final double
    \( g = \frac{607}{128} \).
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Private constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    g()
    Return the Lanczos constant \( g = \frac{607}{128} \).
    static double
    value(double x)
    Computes the Lanczos approximation.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • LANCZOS_G

      private static final double LANCZOS_G
      \( g = \frac{607}{128} \).
      See Also:
    • LANCZOS

      private static final double[] LANCZOS
      Lanczos coefficients.
  • Constructor Details

    • LanczosApproximation

      private LanczosApproximation()
      Private constructor.
  • Method Details

    • value

      public static double value(double x)
      Computes the Lanczos approximation.
      Parameters:
      x - Argument.
      Returns:
      the Lanczos approximation.
    • g

      public static double g()
      Return the Lanczos constant \( g = \frac{607}{128} \).
      Returns:
      the Lanczos constant.