Class Factorials
java.lang.Object
org.opensourcephysics.numerics.specialfunctions.Factorials
Computes the factorial of an integer and functions closely related to
factorials.
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
factorial
(int n) Calculates the factorial.static double
gammaln
(double x) Calculates the logarithm of the Gamma function using the Lanczos approximation.static double
logChoose
(int n, int k) Returns the logarithm of the binomial coefficient (n, k) In other notation: log (n choose k) (n choose k) represents the number of ways of picking k unordered outcomes from n possibilitiesstatic double
logFactorial
(int n) Returns log (n!) = log (n * (n-1) * ...static void
static double
poisson
(double nu, int n) Returns the Poisson distribution (nu^n e^(-nu) / n!)
-
Method Details
-
gammaln
public static double gammaln(double x) Calculates the logarithm of the Gamma function using the Lanczos approximation.- Parameters:
x
- double- Returns:
- double
-
factorial
public static double factorial(int n) Calculates the factorial.- Parameters:
n
- int- Returns:
- double
-
logFactorial
public static double logFactorial(int n) Returns log (n!) = log (n * (n-1) * ... 2 * 1)- Parameters:
n
-- Returns:
- log(n!)
-
poisson
public static double poisson(double nu, int n) Returns the Poisson distribution (nu^n e^(-nu) / n!)- Parameters:
nu
-n
-- Returns:
- poisson_nu(n)
-
logChoose
public static double logChoose(int n, int k) Returns the logarithm of the binomial coefficient (n, k) In other notation: log (n choose k) (n choose k) represents the number of ways of picking k unordered outcomes from n possibilities- Parameters:
n
-k
-- Returns:
- log (n choose k)
-
main
-