gamma_log_complex returns the value of the logarithm of the gamma function for complex , .

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


The argument of the function.


The value of .

(errno )

On entry, is ‘too close’ to a non-positive integer when .


gamma_log_complex evaluates an approximation to the logarithm of the gamma function defined for by

where is complex. It is extended to the rest of the complex plane by analytic continuation unless , in which case is real and each of the points is a singularity and a branch point.

gamma_log_complex is based on the method proposed by Kölbig (1972) in which the value of is computed in the different regions of the plane by means of the formulae

where , are Bernoulli numbers (see Abramowitz and Stegun (1972)) and is the largest integer . Note that care is taken to ensure that the imaginary part is computed correctly, and not merely modulo .

The function uses the values and . The remainder term is discussed in Accuracy.

To obtain the value of when is real and positive, gamma_log_real() can be used.


Abramowitz, M and Stegun, I A, 1972, Handbook of Mathematical Functions, (3rd Edition), Dover Publications

Kölbig, K S, 1972, Programs for computing the logarithm of the gamma function, and the digamma function, for complex arguments, Comp. Phys. Comm. (4), 221–226