public class GammaFunction
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static double[] |
L15
Coefficients for Lanczos approximation to log(Γ(x)).
|
static double |
LOG_2PI_OVER_2
log(2π)/2
|
Constructor and Description |
---|
GammaFunction() |
Modifier and Type | Method and Description |
---|---|
static double |
gamma(double x)
TODO: tests fail for non-integer values, for some reason
|
static double |
logGamma(double x)
Uses Lanczos approximation with g = 607/128 and 15 terms
|
public static final double LOG_2PI_OVER_2
public static final double[] L15
public static double gamma(double x)
x
- argument for which to compute gamma function. Must be < 21java.lang.IllegalArgumentException
- if x ≤ 0public static double logGamma(double x)
x
- argument for finding log(Γ(x))