|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.analysis.function.rn2r1.UnivariateRealFunction
com.numericalmethod.suanshu.analysis.function.special.Gamma
public class Gamma
This computes an approximation to the Gamma function, Γ(z), for real numbers.
∞
/
Γ(z)= | tz-1e-t dt
/
0
Γ(z) is an extension of the factorial function to real and complex numbers, with its argument shifted down by 1.
We provide a few ways to compute Γ(z).
Each method differs in accuracy and speed.
For example,
The full Lanczos approximation can be made arbitrarily precise because it is computed using BigDecimal.
The quick Lanczos approximation is quick but could be less precise because the computations are done in double precision.
| Nested Class Summary | |
|---|---|
static class |
Gamma.Method
the methods available to compute Γ(z) |
| Nested classes/interfaces inherited from interface com.numericalmethod.suanshu.analysis.function.Function |
|---|
Function.EvaluationException |
| Constructor Summary | |
|---|---|
Gamma()
Construct an instance to compute for Gamma function using Lanczos approximation with default settings. |
|
Gamma(double g,
int n,
int scale)
Construct an instance to compute for Gamma function using Lanczos approximation. |
|
Gamma(Gamma.Method method)
Construct an instance to compute for Gamma function using a specified method with default settings. |
|
| Method Summary | |
|---|---|
double |
evaluate(double x)
Compute for the Gamma function in the Real domain. |
| Methods inherited from class com.numericalmethod.suanshu.analysis.function.rn2r1.UnivariateRealFunction |
|---|
dimension4Domain, dimension4Range, evaluate |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Gamma()
public Gamma(double g,
int n,
int scale)
Recommended settings are
g = 607.0 / 128.0
n = 15
scale = 30
g - gn - nscale - precisionpublic Gamma(Gamma.Method method)
method - the algorithm to use, c.f., Gamma.Method| Method Detail |
|---|
public double evaluate(double x)
evaluate in class UnivariateRealFunctionx - a real number
Γ(x)
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||