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
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:
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.nm.analysis.function.Function
Function.EvaluationException
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct 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
Modifier and TypeMethodDescriptiondouble
evaluate
(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 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 areg = 607.0 / 128.0; n = 15; scale = 30;
- Parameters:
g
- gn
- nscale
- 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 interfaceGamma
- Specified by:
evaluate
in interfaceUnivariateRealFunction
- Parameters:
x
- x- Returns:
- \(\Gamma(z)\)
-