nag_specfun_gamma_log_complex (s14ag) 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.
nag_specfun_gamma_log_complex (s14ag) 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.
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
None.
The remainder term
satisfies the following error bound:
Thus
and hence in theory the function is capable of achieving an accuracy of approximately
significant digits.
None.
function s14ag_example
fprintf('s14ag example results\n\n');
z = -1.5 + 2.5i;
[lgz, ifail] = s14ag(z);
disp(' z ln(Gamma(z))');
fprintf('%5.1f%+5.1fi', real(z), imag(z));
fprintf(' %12.4e%+12.4ei\n', real(lgz), imag(lgz));