math.numerics
Class Factorials

java.lang.Object
  extended by math.numerics.Factorials

public class Factorials
extends java.lang.Object


Method Summary
static 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 possibilities
static double logFactorial(int n)
          Returns log (n!) = log (n * (n-1) * ...
static void main(java.lang.String[] args)
           
static double poisson(double nu, int n)
          Returns the poisson distribution (nu^n e^nu / n!)
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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

public static void main(java.lang.String[] args)