gammaIncomplete

Evaluates the incomplete gamma function γ(a, x).

Synopsis

gammaIncomplete (a, x)

Required Arguments

float a (Input)
Parameter of the incomplete gamma function is to be evaluated. It must be positive.
float x (Input)
Point at which the incomplete gamma function is to be evaluated. It must be nonnegative.

Return Value

The value of the incomplete gamma function γ(a, x).

Description

The incomplete gamma function, γ(a, x), is defined to be

\[\gamma(a,x) = \int_0^x t^{a-1} e^{-t} dt \text{ for } x > 0\]

The incomplete gamma function is defined only for a > 0. Although γ (a, x) is well defined for x > -∞, this algorithm does not calculate γ(a, x) for negative x. For large a and sufficiently large x, γ(a, x) may overflow. γ(a, x) is bounded by Γ (a), and users may find this bound a useful guide in determining legal values for a.

../../_images/Fig9-8.png

Figure 9.15 — Plot of γ(a, x)

Example

Evaluate the incomplete gamma function at \(a=1\) and \(x=3\).

from __future__ import print_function
from numpy import *
from pyimsl.math.gammaIncomplete import gammaIncomplete

x = 3.0
a = 1.0
ans = gammaIncomplete(a, x)
print("gammaIncomplete(%f,%f) = %f" % (a, x, ans))

Output

gammaIncomplete(1.000000,3.000000) = 0.950213

Fatal Errors

IMSL_NO_CONV_200_TS_TERMS The function did not converge in 200 terms of Taylor series.
IMSL_NO_CONV_200_CF_TERMS The function did not converge in 200 terms of the continued fraction.