module Alea::Core::SpecFun::Gamma

Overview

Implementation of the Gamma Special functions (incomplete, incomplete regularized).

Defined in:

Class Method Summary

Class Method Detail

def self.incomplete(a : Float64, x : Float64, uorl : Symbol) : Float64 #

Estimates the Incomplete Gamma Function

When x > (a+1), the upper gamma function can be evaluated as

                -x    a
               e   * x
  G(a,x) ~= --------------
               cf(a,x)

where cf(a,x) is the continued fraction defined above, its coefficients a(i) and b(i) are implemented in #inc_gamma_ctdfr_proc.

When x < (a+1), it is more convenient to apply the following Taylor series that evaluates the lower incomplete gamma function:

                         inf
                        -----
             -x    a    \        G(a)       i
  g(a,x) ~= e   * x  *   >    ---------- * x
                        /      G(a+1+i)
                        -----
                         i=0

Applying the following property of the gamma function:

  G(a+1) = a * G(a)

The Taylor series above can be further simplified to:

                         inf
                        -----              i
             -x    a    \                 x
  g(a,x) ~= e   * x  *   >    -------------------------
                        /      a * (a+1) * ... * (a+i)
                        -----
                         i=0

Once either a lower or an upper incomplete gamma function is evaluated, the other value may be quickly obtained by applying the following property of the incomplete gamma function:

  G(a,x) + g(a,x) = G(a)

@parameters:

  • a: parameter of the Incomplete Gamma function.
  • x: the upper integration limit.
  • uorl: symbol to request the :upper or :lower inc. gamma function.

@exceptions:


def self.incomplete(a : Float32, x : Float32, uorl : Symbol) : Float32 #

Estimates the Incomplete Gamma Function

When x > (a+1), the upper gamma function can be evaluated as

                -x    a
               e   * x
  G(a,x) ~= --------------
               cf(a,x)

where cf(a,x) is the continued fraction defined above, its coefficients a(i) and b(i) are implemented in #inc_gamma_ctdfr_proc.

When x < (a+1), it is more convenient to apply the following Taylor series that evaluates the lower incomplete gamma function:

                         inf
                        -----
             -x    a    \        G(a)       i
  g(a,x) ~= e   * x  *   >    ---------- * x
                        /      G(a+1+i)
                        -----
                         i=0

Applying the following property of the gamma function:

  G(a+1) = a * G(a)

The Taylor series above can be further simplified to:

                         inf
                        -----              i
             -x    a    \                 x
  g(a,x) ~= e   * x  *   >    -------------------------
                        /      a * (a+1) * ... * (a+i)
                        -----
                         i=0

Once either a lower or an upper incomplete gamma function is evaluated, the other value may be quickly obtained by applying the following property of the incomplete gamma function:

  G(a,x) + g(a,x) = G(a)

@parameters:

  • a: parameter of the Incomplete Gamma function.
  • x: the upper integration limit.
  • uorl: symbol to request the :upper or :lower inc. gamma function.

@exceptions:


def self.incomplete_reg(a : Float64, x : Float64, uorl : Symbol) : Float64 #

Estimates the Incomplete Regularized Gamma function in double precision.

@parameters:

  • a: parameter of the Incomplete Gamma function.
  • x: the upper integration limit.
  • uorl: symbol to request the :upper or :lower inc. reg. gamma function.

@references:

@exceptions:


def self.incomplete_reg(a : Float32, x : Float32, uorl : Symbol) : Float32 #

Estimates the Incomplete Regularized Gamma function in single precision.

@parameters:

  • a: parameter of the Incomplete Gamma function.
  • x: the upper integration limit.
  • uorl: symbol to request the :upper or :lower inc. reg. gamma function.

@references:

@exceptions: