next up previous index
Next: C335 Complex Error Up: CERNLIB Previous: C332 Dilogarithm Function

C334 Incomplete Gamma Functions

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

Function subprograms RGAPNC, DGAPNC and RGAGNC, DGAGNC calculate the incomplete gamma function

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

e-x xa M (1,a + 1,x)Γ(a + 1) (a ≤0),

.

and the complementary incomplete gamma function

G(a,x) =
1Γ(a) ∫x&inf; e-t ta-1 dt (a > 0)

ex x-ax&inf; e-t ta-1 dt (a ≤0),

.

respectively, for real arguments x ≥0 and a. M(a,b,x) is Kummer's function (see Ref. 3).

On CDC and Cray computers, the double-precision versions DGAPNC and DGAGNC are not available.

Structure:

FUNCTION subprograms
Uses Entry Names: RGAPNC, RGAGNC, DGAPNC, DGAGNC
Obsolete User Entry Names: GAPNC RGAPNC, GAGNC RGAGNC
Files Referenced: Unit 6
External References: ALGAMA, DLGAMA (C304), MTLMTR (N002), ABEND (Z035)

Usage:

In any arithmetic expression, RGAPNC(A,X) or DGAPNC(A,X) has the value P(A,X) ,
RGAGNC(A,X) or DGAGNC(A,X) has the value G(A,X) ,

where RGAPNC and RGAGNC are of type REAL, DGAPNC and DGAGNC are of type DOUBLE PRECISION, A and X have the same type as the function name.

Method:

The method is described in Ref. 1.

Accuracy:

RGAPNC and RGAGNC (except on CDC and Cray computers) have full single-precision accuracy. For most values of the arguments, DGAPNC, DGAGNC (and RGAPNC, RGAGNC on CDC and Cray computers) have an accuracy of approximately two significant digits less than the machine precision.

Restrictions:

For P(a,x) : Either (i) X > 0 , or (ii) X = 0 and A ≥0 .
For G(a,x) : Either (i) X > 0 , or (ii) X = 0 and A ≠0 .

Error handling:

Error C334.1: X<0 .
Error C334.2: For RGAPNC and DGAPNC: A<0 and X=0 ; for RGAGNC and DGAGNC: A=X=0 .
Error C334.3: Problems with convergence (unlikely).
In all cases, the function value is set equal to zero, and a message is written on Unit 6, unless subroutine MTLSET (N002) has been called.

Notes:

When speed is more important than accuracy, e.g. for applications in statistics, use GAMDIS (G106) for computing P(a,x) . Note, however, that in this case the arguments A and X must be interchanged.

The subprograms are 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).
  3. M. Abramowitz and I.A. Stegun (Eds.), Handbook of Mathematical Functions, Chapter 13, Confluent Hypergeometric Functions, 9th printing with corrections, (Dover, New York 1972).

C335



next up previous index
Next: C335 Complex Error Up: CERNLIB Previous: C332 Dilogarithm Function


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