Package smile.math.special
Class Gamma
java.lang.Object
smile.math.special.Gamma
The gamma, digamma, and incomplete gamma functions.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
digamma
(double x) The digamma function is defined as the logarithmic derivative of the gamma function.static double
gamma
(double x) Gamma function.static double
inverseRegularizedIncompleteGamma
(double a, double p) The inverse of regularized incomplete gamma function.static double
lgamma
(double x) The log of the Gamma function.static double
regularizedIncompleteGamma
(double s, double x) Regularized Incomplete Gamma Function P(s,x) = ∫0x e-t t(s-1) dtstatic double
regularizedUpperIncompleteGamma
(double s, double x) Regularized Upper/Complementary Incomplete Gamma Function Q(s,x) = 1 - P(s,x) = 1 - ∫0x e-t t(s-1) dt
-
Method Details
-
gamma
public static double gamma(double x) Gamma function. Lanczos approximation (6 terms).- Parameters:
x
- a real number.- Returns:
- the function value.
-
lgamma
public static double lgamma(double x) The log of the Gamma function. Lanczos approximation (6 terms)- Parameters:
x
- a real number.- Returns:
- the function value.
-
regularizedIncompleteGamma
public static double regularizedIncompleteGamma(double s, double x) Regularized Incomplete Gamma Function P(s,x) = ∫0x e-t t(s-1) dt- Parameters:
s
-s >= 0
x
-x >= 0
- Returns:
- the function value.
-
regularizedUpperIncompleteGamma
public static double regularizedUpperIncompleteGamma(double s, double x) Regularized Upper/Complementary Incomplete Gamma Function Q(s,x) = 1 - P(s,x) = 1 - ∫0x e-t t(s-1) dt- Parameters:
s
-s >= 0
x
-x >= 0
- Returns:
- the function value.
-
digamma
public static double digamma(double x) The digamma function is defined as the logarithmic derivative of the gamma function.- Parameters:
x
- a real number.- Returns:
- the function value.
-
inverseRegularizedIncompleteGamma
public static double inverseRegularizedIncompleteGamma(double a, double p) The inverse of regularized incomplete gamma function.- Parameters:
a
-a > 0
p
- a real number.- Returns:
- the function value.
-