Package samer.functions
Class Gamma
- java.lang.Object
-
- samer.functions.Gamma
-
public class Gamma extends java.lang.ObjectImplementation of the real (incomplete) Gamma function.This class provides an implementaion of the real Gamma function
and its sibling, the incomplete Gamma function:Γ( z ) = ∫0∞ tz-1e-tdtΓ( a, x ) = ∫0xta-1e-tdtThe Implementation follows the ideas of C.Lanczos and their realizations presented in Numerical Recipes in C.
Further reading:
- C.Lanczos, 1964, SIAM Journal of Numerical Analysis, ser. B, vol. 1, pp. 86-96. - W.H.Press, S.A.Teukolsky, W.T.Vetterling, B.P.Flannery. Numerical Recipes in C. Cambridge University Press, 1992.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static doublegamma(double z)Retunrs the gamma function atz.static doublegamma(double a, double x)Returns the incomplete gamma function ata, x.static doublegamma(double a, double x, double gammaOfA)Returns the incomplete gamma function ata, x.static doublelogOfGamma(double z)Retunrs the logarithm of the gamma function atz.
-
-
-
Method Detail
-
gamma
public static double gamma(double z)
Retunrs the gamma function atz.- Parameters:
z- a real number- Returns:
Γ( z ) = ∫0∞ tz-1e-tdt
-
logOfGamma
public static double logOfGamma(double z)
Retunrs the logarithm of the gamma function atz.- Parameters:
z- a real number- Returns:
log( Γ( z ) ) = log ( ∫0∞ tz-1e-tdt )
-
gamma
public static double gamma(double a, double x, double gammaOfA)Returns the incomplete gamma function ata, x. The algorithms for the incomplete gamma function needs to computeΓ(a); providing this value will therefor lead to an optimization if you need this value also for a diffrent porpuse.- Parameters:
a- a positive real numberx- a real number greater thana- Returns:
Γ( a, x ) = ∫0∞ tz-1e-tdt
-
gamma
public static double gamma(double a, double x)Returns the incomplete gamma function ata, x.- Parameters:
a- a positive real numberx- a real number greater thana- Returns:
Γ( a, x ) = ∫0∞ tz-1e-tdt
-
-