naginterfaces.library.specfun.psi_deriv_complex(z, k)[source]

psi_deriv_complex returns the value of the th derivative of the psi function for complex and .

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


The argument of the function.


The function to be evaluated.


The value of the th derivative of the psi function.

(errno )

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

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

Evaluation abandoned due to likelihood of overflow.


psi_deriv_complex evaluates an approximation to the th derivative of the psi function given by

where is complex provided and . If , is real and thus is singular when .

Note that is also known as the polygamma function. Specifically, is often referred to as the digamma function and as the trigamma function in the literature. Further details can be found in Abramowitz and Stegun (1972).

psi_deriv_complex is based on a modification of the method proposed by Kölbig (1972).

To obtain the value of when is real, psi_deriv_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