Class Lanczos
- java.lang.Object
-
- dev.nm.analysis.function.special.gamma.Lanczos
-
public class Lanczos extends Object
The Lanczos approximation is a method for computing the Gamma function numerically, published by Cornelius Lanczos in 1964. This implementation is based on the notes of Paul Godfrey and the discussion of Viktor T. Toth.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
logGamma(double x)
Compute log-gamma for a positive value x.BigDecimal
logGamma(BigDecimal x)
Compute log-gamma for a positive value x to arbitrary precision.double
logGammaQuick(double x)
Compute log-gamma for a positive value x.
-
-
-
Constructor Detail
-
Lanczos
public Lanczos(double g, int n, int scale)
Construct a Lanczos approximation instance. Recommended settings areg = 607.0 / 128.0; n = 15; scale = 30;
- Parameters:
g
- gn
- nscale
- precision
-
Lanczos
public Lanczos()
Construct a Lanczos approximation instance using default parameters. The default parameters are:g = 607.0 / 128.0; n = 15; scale = 30;
-
-
Method Detail
-
logGammaQuick
public double logGammaQuick(double x)
Compute log-gamma for a positive value x. All operations are indouble
precision.- Parameters:
x
- x indouble
- Returns:
lgamma(x)
indouble
-
logGamma
public double logGamma(double x)
Compute log-gamma for a positive value x. The accuracy of this function is only as good as the precision ofdouble
.- Parameters:
x
- x indouble
- Returns:
lgamma(x)
indouble
-
logGamma
public BigDecimal logGamma(BigDecimal x)
Compute log-gamma for a positive value x to arbitrary precision.- Parameters:
x
- x inBigDecimal
- Returns:
lgamma(x)
inBigDecimal
-
-