NAG Library Function Document

nag_complex_polygamma (s14afc)

 Contents

    1  Purpose
    7  Accuracy

1
Purpose

nag_complex_polygamma (s14afc) returns the value of the kth derivative of the psi function ψz for complex z and k=0,1,,4.

2
Specification

#include <nag.h>
#include <nags.h>
Complex  nag_complex_polygamma (Complex z, Integer k, NagError *fail)

3
Description

nag_complex_polygamma (s14afc) 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_complex_polygamma (s14afc) 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_real_polygamma (s14aec) can be used.

4
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

5
Arguments

1:     z ComplexInput
On entry: the argument z of the function.
Constraint: z.re must not be ‘too close’ (see Section 6) to a non-positive integer when z.im=0.0.
2:     k IntegerInput
On entry: the function ψkz to be evaluated.
Constraint: 0k4.
3:     fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_COMPLEX
On entry, z.re is ‘too close’ to a non-positive integer when z.im=0.0: z.re=value, nintz.re=value.
NE_INT
On entry, k=value.
Constraint: k4.
On entry, k=value.
Constraint: k0.
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
NE_OVERFLOW_LIKELY
Evaluation abandoned due to likelihood of overflow.

7
Accuracy

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

8
Parallelism and Performance

nag_complex_polygamma (s14afc) is not threaded in any implementation.

9
Further Comments

None.

10
Example

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

10.1
Program Text

Program Text (s14afce.c)

10.2
Program Data

Program Data (s14afce.d)

10.3
Program Results

Program Results (s14afce.r)

© The Numerical Algorithms Group Ltd, Oxford, UK. 2017