gamma_log_real_vector returns an array of values of the logarithm of the gamma function, .

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

xfloat, array-like, shape

The argument of the function, for .

ffloat, ndarray, shape

, the function values.

ivalidint, ndarray, shape

contains the error code for , for .

No error.


is too large and positive. The threshold value is the same as for = 2 in gamma_log_real().

(errno )

On entry, .

Constraint: .

(errno )

On entry, at least one value of was invalid.

Check for more information.


gamma_log_real_vector calculates an approximate value for for an array of arguments , for . It is based on rational Chebyshev expansions.

Denote by a ratio of polynomials of degree in the numerator and in the denominator. Then:

for ,

for ,

for ,

for ,

and for ,

For each expansion, the specific values of and are selected to be minimal such that the maximum relative error in the expansion is of the order , where is the maximum number of decimal digits that can be accurately represented for the particular implementation (see machine.decimal_digits).

Let denote machine precision and let denote the largest positive model number (see machine.real_largest). For the value is not defined; gamma_log_real_vector returns zero and exits with = 1. It also exits with = 1 when , and in this case the value is returned. For in the interval , the function to machine accuracy.

Now denote by the largest allowable argument for on the machine. For the term in Equation (1) is negligible. For there is a danger of setting overflow, and so gamma_log_real_vector exits with = 2 and returns .


NIST Digital Library of Mathematical Functions

Cody, W J and Hillstrom, K E, 1967, Chebyshev approximations for the natural logarithm of the gamma function, Math.Comp. (21), 198–203