2 Specification

3 Description

nag_real_polygamma (s14aec) evaluates an approximation to the kth derivative of the psi function ψx given by

ψkx=dkdxkψx=dkdxkddxloge⁡Γx,

where x is real with x≠0,-1,-2,… and k=0,1,…,6. For negative non-integer values of x, the recurrence relationship

ψkx+1=ψkx+dkdxk1x

is used. The value of -1k+1ψkxk! is obtained by a call to a function based on PSIFN in Amos (1983).

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

6 Error Indicators and Warnings

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.

NE_OVERFLOW_LIKELY

The evaluation has been abandoned due to the likelihood of overflow. The result is returned as zero.

NE_REAL

On entry, x=value.
Constraint: x must not be ‘too close’ to a non-positive integer. That is, x-nintx≥machine precision× nintx.

NE_UNDERFLOW_LIKELY

The evaluation has been abandoned due to the likelihood of underflow. The result is returned as zero.

7 Accuracy

All constants in the underlying functions are given to approximately 18 digits of precision. If t denotes the number of digits of precision in the floating point arithmetic being used, then clearly the maximum number in the results obtained is limited by p=mint,18. Empirical tests by Amos (1983) have shown that the maximum relative error is a loss of approximately two decimal places of precision. Further tests with the function -ψ0x have shown somewhat improved accuracy, except at points near the positive zero of ψ0x at x=1.46…, where only absolute accuracy can be obtained.