00001 00002 *DECK DGAMI 00003 DOUBLE PRECISION FUNCTION DGAMI (A, X) 00004 C***BEGIN PROLOGUE DGAMI 00005 C***PURPOSE Evaluate the incomplete Gamma function. 00006 C***LIBRARY SLATEC (FNLIB) 00007 C***CATEGORY C7E 00008 C***TYPE DOUBLE PRECISION (GAMI-S, DGAMI-D) 00009 C***KEYWORDS FNLIB, INCOMPLETE GAMMA FUNCTION, SPECIAL FUNCTIONS 00010 C***AUTHOR Fullerton, W., (LANL) 00011 C***DESCRIPTION 00012 C 00013 C Evaluate the incomplete gamma function defined by 00014 C 00015 C DGAMI = integral from T = 0 to X of EXP(-T) * T**(A-1.0) . 00016 C 00017 C DGAMI is evaluated for positive values of A and non-negative values 00018 C of X. A slight deterioration of 2 or 3 digits accuracy will occur 00019 C when DGAMI is very large or very small, because logarithmic variables 00020 C are used. The function and both arguments are double precision. 00021 C 00022 C***REFERENCES (NONE) 00023 C***ROUTINES CALLED DGAMIT, DLNGAM, XERMSG 00024 C***REVISION HISTORY (YYMMDD) 00025 C 770701 DATE WRITTEN 00026 C 890531 Changed all specific intrinsics to generic. (WRB) 00027 C 890531 REVISION DATE from Version 3.2 00028 C 891214 Prologue converted to Version 4.0 format. (BAB) 00029 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ) 00030 C***END PROLOGUE DGAMI 00031 DOUBLE PRECISION A, X, FACTOR, DLNGAM, DGAMIT 00032 C***FIRST EXECUTABLE STATEMENT DGAMI 00033 IF (A .LE. 0.D0) CALL XERMSG ('SLATEC', 'DGAMI', 00034 + 'A MUST BE GT ZERO', 1, 2) 00035 IF (X .LT. 0.D0) CALL XERMSG ('SLATEC', 'DGAMI', 00036 + 'X MUST BE GE ZERO', 2, 2) 00037 C 00038 DGAMI = 0.D0 00039 IF (X.EQ.0.0D0) RETURN 00040 C 00041 C THE ONLY ERROR POSSIBLE IN THE EXPRESSION BELOW IS A FATAL OVERFLOW. 00042 FACTOR = EXP (DLNGAM(A) + A*LOG(X)) 00043 C 00044 DGAMI = FACTOR * DGAMIT (A, X) 00045 C 00046 RETURN 00047 END