Class GammaLanczos

All Implemented Interfaces:
Function<Vector,Double>, RealScalarFunction, UnivariateRealFunction, Gamma

public class GammaLanczos extends AbstractUnivariateRealFunction implements Gamma
Lanczos approximation provides a way to compute the Gamma function such that the accuracy can be made arbitrarily precise. Yet, the computations can be time-consuming if done in, e.g., BigDecimal.
See Also:
  • Constructor Details

    • GammaLanczos

      public GammaLanczos()
      Construct an instance of a Gamma function, computed using the Lanczos approximation.
    • GammaLanczos

      public GammaLanczos(double g, int n, int scale)
      Construct an instance of a Gamma function, computed using the Lanczos approximation.

      Recommended settings are

      g = 607.0 / 128.0; n = 15; scale = 30;
      Parameters:
      g - g
      n - n
      scale - precision
  • Method Details

    • evaluate

      public double evaluate(double x)
      Description copied from interface: Gamma
      Evaluate \(\Gamma(z) = \int_0^\infty e^{-t} t^{z-1} dt\).
      Specified by:
      evaluate in interface Gamma
      Specified by:
      evaluate in interface UnivariateRealFunction
      Parameters:
      x - x
      Returns:
      \(\Gamma(z)\)