Class GammaFunction

  • All Implemented Interfaces:
    java.io.Serializable

    public abstract class GammaFunction
    extends java.lang.Object
    implements java.io.Serializable
    Base class for implementations of the Gamma function. Use getGammaFunction() to obtain an instance. The exact instance can be controlled by property gamma.function For consistency when computing logarithms of the gamma function, all implementations assume positive input values. In practice, as the gamma function can generate large values, normal usage should use compute_log() anyway.

    Properties:

    • gamma.function - class name of the Gamma function implementation.
    Defaults to use WikipediaLanczosGammaFunction
    Since:
    3.0
    Author:
    Craig Macdonald
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      GammaFunction()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract double compute​(double number)
      Get the value of the gamma function for the specified number.
      abstract double compute_log​(double number)
      Get the value of the log of gamma function for the specified number.
      static long factorial​(long n)
      Compute factorial of n, for 0 < n < 21.
      static GammaFunction getGammaFunction()
      Obtain an instance of GammaFunction
      static void main​(java.lang.String[] args)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GammaFunction

        public GammaFunction()
    • Method Detail

      • compute

        public abstract double compute​(double number)
        Get the value of the gamma function for the specified number.
        Parameters:
        number - for which is required
        Returns:
        (n-1)!
      • compute_log

        public abstract double compute_log​(double number)
        Get the value of the log of gamma function for the specified number.
        Parameters:
        number - for which is required
        Returns:
        log(n-1)!
      • getGammaFunction

        public static final GammaFunction getGammaFunction()
        Obtain an instance of GammaFunction
      • main

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

        public static final long factorial​(long n)
        Compute factorial of n, for 0 < n < 21.
        Parameters:
        n - number to compute for
        Returns:
        factorial of n