# naginterfaces.library.specfun.gamma_​vector¶

naginterfaces.library.specfun.gamma_vector(x)[source]

gamma_vector returns an array of values of the gamma function .

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

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/s/s14anf.html

Parameters
xfloat, array-like, shape

The argument of the function, for .

Returns
ffloat, ndarray, shape

, the function values.

ivalidint, ndarray, shape

contains the error code for , for .

No error.

is too large and positive. contains the approximate value of at the nearest valid argument. The threshold value is the same as for = 1 in gamma().

is too large and negative. contains zero. The threshold value is the same as for = 2 in gamma().

is too close to zero. contains the approximate value of at the nearest valid argument. The threshold value is the same as for = 2 in gamma().

is a negative integer, at which values are infinite. contains a large positive value.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

Warns
NagAlgorithmicWarning
(errno )

On entry, at least one value of was invalid.

Notes

gamma_vector evaluates an approximation to the gamma function for an array of arguments , for . The function is based on the Chebyshev expansion:

where and uses the property . If where is integral and then it follows that:

 for N>0, Γ(x)=(x−1)(x−2)⋯(x−N)Γ(1+u), for N=0, Γ(x)=Γ(1+u), for N<0, Γ(x)=Γ(1+u)x(x+1)(x+2)⋯(x−N−1).

There are four possible failures for this function:

1. if is too large, there is a danger of overflow since could become too large to be represented in the machine;

2. if is too large and negative, there is a danger of underflow;

3. if is equal to a negative integer, would overflow since it has poles at such points;

4. if is too near zero, there is again the danger of overflow on some machines. For small , , and on some machines there exists a range of nonzero but small values of for which is larger than the greatest representable value.

References

NIST Digital Library of Mathematical Functions