naginterfaces.library.specfun.gamma_incomplete_vector(a, x, tol)[source]

gamma_incomplete_vector computes an array of values for the incomplete gamma functions and .

For full information please refer to the NAG Library document for s14bn

afloat, array-like, shape

The argument of the function, for .

xfloat, array-like, shape

The argument of the function, for .


The relative accuracy required by you in the results. If gamma_incomplete_vector is entered with greater than or less than machine precision, then the value of machine precision is used instead.

pfloat, ndarray, shape

, the function values.

qfloat, ndarray, shape

, the function values.

ivalidint, ndarray, shape

contains the error code for and , for .

No error.



Algorithm fails to terminate.

(errno )

On entry, .

Constraint: .

(errno )

On entry, at least one value of was invalid.

Check for more information.


gamma_incomplete_vector evaluates the incomplete gamma functions in the normalized form, for an array of arguments , for .

with and , to a user-specified accuracy. With this normalization, .

Several methods are used to evaluate the functions depending on the arguments and , the methods including Taylor expansion for , Legendre’s continued fraction for , and power series for . When both and are large, and , the uniform asymptotic expansion of Temme (1987) is employed for greater efficiency – specifically, this expansion is used when and .

Once either or is computed, the other is obtained by subtraction from . In order to avoid loss of relative precision in this subtraction, the smaller of and is computed first.

This function is derived from the function GAM in Gautschi (1979b).


Gautschi, W, 1979, A computational procedure for incomplete gamma functions, ACM Trans. Math. Software (5), 466–481

Gautschi, W, 1979, Algorithm 542: Incomplete gamma functions, ACM Trans. Math. Software (5), 482–489

Temme, N M, 1987, On the computation of the incomplete gamma functions for large values of the parameters, Algorithms for Approximation, (eds J C Mason and M G Cox), Oxford University Press