gamma, gammainc, gammaln

Purpose

Gamma function.

Synopsis

y = gamma(a)
y = gammainc(x,a)
y = gammaln(a)

Description

y = gamma(a) returns the gamma function evaluated at the elements of a. The gamma function is defined by the integral:

The gamma function interpolates the factorial function. For integer n

gamma(n+1) = n! = prod(1:n)
y = gammainc(x,a) returns the incomplete gamma function defined by

y = gammaln(a) returns the logarithm of the gamma function,

gammaln(a) = log(gamma(a))
gammaln avoids the underflow and overflow that may occur if it is computed directly using log(gamma(a)).

Algorithm

The computations of gamma and gammaln are based on algorithms outlined in [1]. Several different minimax rational approximations are used depending upon the value of a. Computation of the incomplete gamma function is based on the algorithm in [2].

References

[1] J. Cody, An Overview of Software Development for Special Functions, Lecture Notes in Mathematics, 506, Numerical Analysis Dundee, G. A. Watson (ed.), Springer Verlag, Berlin, 1976.

[2] M. Abramowitz and I.A. Stegun, Handbook of Mathematical Functions, National Bureau of Standards, Applied Math. Series #55, Dover Publications, 1965, sec. 6.5.

(c) Copyright 1994 by The MathWorks, Inc.