Blame view
fvn_fnlib/gami.f
836 Bytes
38581db0c git-svn-id: https... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
function gami (a, x) c july 1977 edition. w. fullerton, c3, los alamos scientific lab. c c evaluate the incomplete gamma function defined by c c gami = integral from t = 0 to x of exp(-t) * t**(a-1.0) . c c gami is evaluated for positive values of a and non-negative values c of x. a slight deterioration of 2 or 3 digits accuracy will occur c when gami is very large or very small, because logarithmic variables c are used. c external alngam, gamit c if (a.le.0.0) call seteru (25hgami a must be gt zero, 25, 1, 2) if (x.lt.0.0) call seteru (25hgami x must be ge zero, 25, 2, 2) c gami = 0.0 if (x.eq.0.0) return c c the only error possible in the expression below is a fatal overflow. factor = exp (alngam(a) + a*alog(x) ) c gami = factor * gamit(a, x) c return end |