Class GammaLanczos
- java.lang.Object
-
- dev.nm.analysis.function.rn2r1.AbstractRealScalarFunction
-
- dev.nm.analysis.function.rn2r1.univariate.AbstractUnivariateRealFunction
-
- dev.nm.analysis.function.special.gamma.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:
- Wikipedia: Lanczos approximation
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
-
Constructor Summary
Constructors Constructor Description GammaLanczos()Construct an instance of a Gamma function, computed using the Lanczos approximation.GammaLanczos(double g, int n, int scale)Construct an instance of a Gamma function, computed using the Lanczos approximation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doubleevaluate(double x)Evaluate \(\Gamma(z) = \int_0^\infty e^{-t} t^{z-1} dt\).-
Methods inherited from class dev.nm.analysis.function.rn2r1.univariate.AbstractUnivariateRealFunction
evaluate
-
Methods inherited from class dev.nm.analysis.function.rn2r1.AbstractRealScalarFunction
dimensionOfDomain, dimensionOfRange
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface dev.nm.analysis.function.Function
dimensionOfDomain, dimensionOfRange
-
-
-
-
Constructor Detail
-
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 areg = 607.0 / 128.0; n = 15; scale = 30;- Parameters:
g- gn- nscale- precision
-
-
Method Detail
-
evaluate
public double evaluate(double x)
Description copied from interface:GammaEvaluate \(\Gamma(z) = \int_0^\infty e^{-t} t^{z-1} dt\).- Specified by:
evaluatein interfaceGamma- Specified by:
evaluatein interfaceUnivariateRealFunction- Parameters:
x- x- Returns:
- \(\Gamma(z)\)
-
-