|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.special.Gamma
public class Gamma
This is a utility class that provides computation methods related to the Gamma family of functions.
Field Summary | |
---|---|
private static double |
C_LIMIT
C limit. |
private static double |
DEFAULT_EPSILON
Maximum allowed numerical error. |
static double |
GAMMA
Euler-Mascheroni constant |
private static double |
HALF_LOG_2_PI
Avoid repeated computation of log of 2 PI in logGamma |
private static double[] |
LANCZOS
Lanczos coefficients |
private static double |
S_LIMIT
S limit. |
Constructor Summary | |
---|---|
private |
Gamma()
Default constructor. |
Method Summary | |
---|---|
static double |
digamma(double x)
Computes the digamma function of x. |
static double |
logGamma(double x)
Returns the natural logarithm of the gamma function Γ(x). |
static double |
regularizedGammaP(double a,
double x)
Returns the regularized gamma function P(a, x). |
static double |
regularizedGammaP(double a,
double x,
double epsilon,
int maxIterations)
Returns the regularized gamma function P(a, x). |
static double |
regularizedGammaQ(double a,
double x)
Returns the regularized gamma function Q(a, x) = 1 - P(a, x). |
static double |
regularizedGammaQ(double a,
double x,
double epsilon,
int maxIterations)
Returns the regularized gamma function Q(a, x) = 1 - P(a, x). |
static double |
trigamma(double x)
Computes the trigamma function of x. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double GAMMA
private static final double DEFAULT_EPSILON
private static final double[] LANCZOS
private static final double HALF_LOG_2_PI
private static final double C_LIMIT
private static final double S_LIMIT
Constructor Detail |
---|
private Gamma()
Method Detail |
---|
public static double logGamma(double x)
x
- Value.
public static double regularizedGammaP(double a, double x)
a
- Parameter.x
- Value.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedGammaP(double a, double x, double epsilon, int maxIterations)
a
- the a parameter.x
- the value.epsilon
- When the absolute value of the nth item in the
series is less than epsilon the approximation ceases to calculate
further elements in the series.maxIterations
- Maximum number of "iterations" to complete.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedGammaQ(double a, double x)
a
- the a parameter.x
- the value.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedGammaQ(double a, double x, double epsilon, int maxIterations)
a
- the a parameter.x
- the value.epsilon
- When the absolute value of the nth item in the
series is less than epsilon the approximation ceases to calculate
further elements in the series.maxIterations
- Maximum number of "iterations" to complete.
MaxCountExceededException
- if the algorithm fails to converge.public static double digamma(double x)
Computes the digamma function of x.
This is an independently written implementation of the algorithm described in Jose Bernardo, Algorithm AS 103: Psi (Digamma) Function, Applied Statistics, 1976.
Some of the constants have been changed to increase accuracy at the moderate expense of run-time. The result should be accurate to within 10^-8 absolute tolerance for x >= 10^-5 and within 10^-8 relative tolerance for x > 0.
Performance for large negative values of x will be quite expensive (proportional to |x|). Accuracy for negative values of x should be about 10^-8 absolute for results less than 10^5 and 10^-8 relative for results larger than that.
x
- Argument.
public static double trigamma(double x)
x
- Argument.
digamma(double)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |