java.lang.Object
org.opensourcephysics.numerics.specialfunctions.Factorials

public class Factorials extends Object
Computes the factorial of an integer and functions closely related to factorials.
  • Method Summary

    Modifier and Type
    Method
    Description
    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(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

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public static void main(String[] args)