Class Gamma

  • java.lang.Object
    • samer.functions.Gamma


  • public class Gamma
    extends java.lang.Object
    Implementation of the real (incomplete) Gamma function.

    This class provides an implementaion of the real Gamma function

    Γ( z ) = ∫0 tz-1e-tdt

    and its sibling, the incomplete Gamma function:

    Γ( a, x ) = ∫0xta-1e-tdt

    The Implementation follows the ideas of C.Lanczos and their realizations presented in Numerical Recipes in C.

    Further reading:

    - C.Lanczos, 1964, SIAM Journal of Numerical Analysis, ser. B, vol. 1, pp. 86-96.
    - W.H.Press, S.A.Teukolsky, W.T.Vetterling, B.P.Flannery. Numerical Recipes in C. Cambridge University Press, 1992.

    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static double gamma(double z)
      Retunrs the gamma function at z.
      static double gamma(double a, double x)
      Returns the incomplete gamma function at a, x.
      static double gamma(double a, double x, double gammaOfA)
      Returns the incomplete gamma function at a, x.
      static double logOfGamma(double z)
      Retunrs the logarithm of the gamma function at z.
      • Methods inherited from class java.lang.Object

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

      • gamma

        public static double gamma(double z)
        Retunrs the gamma function at z.
        Parameters:
        z - a real number
        Returns:
        Γ( z ) = ∫0 tz-1e-tdt
      • logOfGamma

        public static double logOfGamma(double z)
        Retunrs the logarithm of the gamma function at z.
        Parameters:
        z - a real number
        Returns:
        log( Γ( z ) ) = log ( ∫0 tz-1e-tdt )
      • gamma

        public static double gamma(double a,
                                   double x,
                                   double gammaOfA)
        Returns the incomplete gamma function at a, x. The algorithms for the incomplete gamma function needs to compute Γ(a); providing this value will therefor lead to an optimization if you need this value also for a diffrent porpuse.
        Parameters:
        a - a positive real number
        x - a real number greater than a
        Returns:
        Γ( a, x ) = ∫0 tz-1e-tdt
      • gamma

        public static double gamma(double a,
                                   double x)
        Returns the incomplete gamma function at a, x.
        Parameters:
        a - a positive real number
        x - a real number greater than a
        Returns:
        Γ( a, x ) = ∫0 tz-1e-tdt