PDF version (NAG web site
, 64-bit version, 64-bit version)
NAG Toolbox: nag_specfun_psi_deriv_complex (s14af)
Purpose
nag_specfun_psi_deriv_complex (s14af) returns the value of the th derivative of the psi function for complex and , via the function name.
Syntax
Description
nag_specfun_psi_deriv_complex (s14af) 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).
nag_specfun_psi_deriv_complex (s14af) is based on a modification of the method proposed by
Kölbig (1972).
To obtain the value of
when
is real,
nag_specfun_psi_deriv_real (s14ae) can be used.
References
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
Parameters
Compulsory Input Parameters
- 1:
– complex scalar
-
The argument of the function.
Constraint:
must not be ‘too close’ (see
Error Indicators and Warnings) to a non-positive integer when
.
- 2:
– int64int32nag_int scalar
-
The function to be evaluated.
Constraint:
.
Optional Input Parameters
None.
Output Parameters
- 1:
– complex scalar
The result of the function.
- 2:
– int64int32nag_int scalar
unless the function detects an error (see
Error Indicators and Warnings).
Error Indicators and Warnings
Errors or warnings detected by the function:
-
-
On entry, | , |
or | , |
or | is ‘too close’ to a non-positive integer when . That is, . |
-
-
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.
Accuracy
Empirical tests have shown that the maximum relative error is a loss of approximately two decimal places of precision.
Further Comments
None.
Example
This example evaluates the psi (trigamma) function at , and prints the results.
Open in the MATLAB editor:
s14af_example
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)
© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015