edu.northwestern.at.utils.math

## Class Factorial

- java.lang.Object
- - edu.northwestern.at.utils.math.Factorial

-     public class Factorial
      extends java.lang.Object

  Defines methods for factorials.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static double[]` | `doubleFactorials`
    `protected static long[]` | `longFactorials`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Factorial()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `factorial(int n)` Compute factorial of an integer.
    `static double` | `logFactorial(int n)` Computes the natural log of n factorial.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### longFactorials

          protected static final long[] longFactorials

    - #### doubleFactorials

          protected static final double[] doubleFactorials

  - ### Constructor Detail

    - #### Factorial

          public Factorial()

  - ### Method Detail

    - #### factorial

          public static double factorial(int n)

      Compute factorial of an integer.
      Parameters:
        `n` - Number for which to compute factorial.
      Returns:
        n!

    - #### logFactorial

          public static double logFactorial(int n)

      Computes the natural log of n factorial.
      Parameters:
        `n` - The number for which the log factorial is desired.
      Returns:
        The natural log of n! .

        We use the LogGamma function to compute log(n!) using the relation:

        log(n!) = logGamma( n + 1 )