next up previous index
Next: G110 Landau Distribution Up: CERNLIB Previous: G105 Inverse of

G106 Gamma Distribution

Routine ID: G106
Author(s): K.S. KölbigLibrary: MATHLIB
Submitter: Submitted: 01.05.1990
Language: FortranRevised: 15.03.1993

Function subprogram GAMDIS calculates the gamma distribution function (incomplete gamma function)

P(x,a) = 1Γ(a) ∫0x e-t ta-1 dt

for real arguments x ≥0 and a > 0.

Structure:

FUNCTION subprogram
User Entry Name: GAMDIS
Files Referenced: Unit 6
External References: GAMMA (C302), ALGAMA (C304), MTLMTR (N002), ABEND (Z035)

Usage:

In any arithmetic expression, GAMDIS(X,A) has the value P(X,A) ,

where GAMDIS, X and A are of type REAL.

Method:

The method is described in Ref. 1.

Accuracy:

Approximately six digits are correct.

Error handling:

Error G106.1: X<0 or A ≤0 .
Error G106.2: Difficulties of convergence (unlikely).
The function value is set equal to zero, and a message is written on Unit 6, unless subroutine MTLSET (N002) has been called.

Notes:

  1. For greater accuracy, or for the case a ≤0 , use GAPNC (C334). Note, however, that in this case the arguments X and A must be interchanged.
  2. Note that, for integer N ≥1 , GAMDIS(X,N/2.) = 1-PROB(2*X,N) , where PROB (G100) is the upper tail probability of the chi-squared distribution function. PROB (G100) is faster than GAMDIS (G106) in this case.

This subprogram is based on a Fortran program for the incomplete gamma functions published in Ref. 2.

References:

  1. W. Gautschi, A computational procedure for incomplete gamma functions, ACM Trans. Math. Software 5 (1979) 466--481.
  2. W. Gautschi,Algorithm 542, Incomplete gamma functions, Collected Algorithms from CACM (1979).

G110


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995