GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
dgami.f
Go to the documentation of this file.
1 
2 *DECK DGAMI
3  DOUBLE PRECISION FUNCTION dgami (A, X)
4 C***BEGIN PROLOGUE DGAMI
5 C***PURPOSE Evaluate the incomplete Gamma function.
6 C***LIBRARY SLATEC (FNLIB)
7 C***CATEGORY C7E
8 C***TYPE DOUBLE PRECISION (GAMI-S, DGAMI-D)
9 C***KEYWORDS FNLIB, INCOMPLETE GAMMA FUNCTION, SPECIAL FUNCTIONS
10 C***AUTHOR Fullerton, W., (LANL)
11 C***DESCRIPTION
12 C
13 C Evaluate the incomplete gamma function defined by
14 C
15 C DGAMI = integral from T = 0 to X of EXP(-T) * T**(A-1.0) .
16 C
17 C DGAMI is evaluated for positive values of A and non-negative values
18 C of X. A slight deterioration of 2 or 3 digits accuracy will occur
19 C when DGAMI is very large or very small, because logarithmic variables
20 C are used. The function and both arguments are double precision.
21 C
22 C***REFERENCES (NONE)
23 C***ROUTINES CALLED DGAMIT, DLNGAM, XERMSG
24 C***REVISION HISTORY (YYMMDD)
25 C 770701 DATE WRITTEN
26 C 890531 Changed all specific intrinsics to generic. (WRB)
27 C 890531 REVISION DATE from Version 3.2
28 C 891214 Prologue converted to Version 4.0 format. (BAB)
29 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
30 C***END PROLOGUE DGAMI
31  DOUBLE PRECISION a, x, factor, dlngam, dgamit
32 C***FIRST EXECUTABLE STATEMENT DGAMI
33  IF (a .LE. 0.d0) CALL xermsg('SLATEC', 'DGAMI',
34  + 'A MUST BE GT ZERO', 1, 2)
35  IF (x .LT. 0.d0) CALL xermsg('SLATEC', 'DGAMI',
36  + 'X MUST BE GE ZERO', 2, 2)
37 C
38  dgami = 0.d0
39  IF (x.EQ.0.0d0) RETURN
40 C
41 C THE ONLY ERROR POSSIBLE IN THE EXPRESSION BELOW IS A FATAL OVERFLOW.
42  factor = exp(dlngam(a) + a*log(x))
43 C
44  dgami = factor * dgamit(a, x)
45 C
46  RETURN
47  END