hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_specfun_psi_deriv_complex (s14af)


    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example


nag_specfun_psi_deriv_complex (s14af) returns the value of the kth derivative of the psi function ψz for complex z and k=0,1,,4, via the function name.


[result, ifail] = s14af(z, k)
[result, ifail] = nag_specfun_psi_deriv_complex(z, k)


nag_specfun_psi_deriv_complex (s14af) evaluates an approximation to the kth derivative of the psi function ψz given by
ψ k z=dkdzk ψz=dkdzk ddz logeΓz ,  
where z=x+iy is complex provided y0 and k=0,1,,4. If y=0, z is real and thus ψ k z is singular when z=0,-1,-2,.
Note that ψ k z is also known as the polygamma function. Specifically, ψ 0 z is often referred to as the digamma function and ψ 1 z as the trigamma function in the literature. Further details can be found in Abramowitz and Stegun (1972).
nag_specfun_psi_deriv_complex (s14af) is based on a modification of the method proposed by Kölbig (1972).
To obtain the value of ψ k z when z is real, nag_specfun_psi_deriv_real (s14ae) 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


Compulsory Input Parameters

1:     z – complex scalar
The argument z of the function.
Constraint: Re(z) must not be ‘too close’ (see Error Indicators and Warnings) to a non-positive integer when Im(z)=0.0.
2:     k int64int32nag_int scalar
The function ψkz to be evaluated.
Constraint: 0k4.

Optional Input Parameters


Output Parameters

1:     result – complex scalar
The result of the function.
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
On entry,k<0,
orRez is ‘too close’ to a non-positive integer when Imz=0.0. That is, abs Rez - nintRez < machine precision × nint absRez .
The evaluation has been abandoned due to the likelihood of overflow. The result is returned as zero.
An unexpected error has been triggered by this routine. Please contact NAG.
Your licence key may have expired or may not have been installed correctly.
Dynamic memory allocation failed.


Empirical tests have shown that the maximum relative error is a loss of approximately two decimal places of precision.

Further Comments



This example evaluates the psi (trigamma) function ψ 1 z at z=-1.5+2.5i, and prints the results.
function s14af_example

fprintf('s14af example results\n\n');

z =  -1.5 + 2.5i;
k = int64(1);
[pk, ifail] = s14af(z, k);

disp('      z        k      (d^K/dx^K)psi(z)');
fprintf('%5.1f%+5.1fi%5d', real(z), imag(z), k);
fprintf('  %12.4e%+12.4ei\n', real(pk), imag(pk));

s14af example results

      z        k      (d^K/dx^K)psi(z)
 -1.5 +2.5i    1   -1.9737e-01 -2.4271e-01i

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015