The function may be called by the names: s14aec, nag_specfun_psi_deriv_real or nag_real_polygamma.
s14aec evaluates an approximation to the th derivative of the psi function given by
where is real with and . For negative noninteger values of , the recurrence relationship
is used. The value of is obtained by a call to s14adc, which is based on the function PSIFN in Amos (1983).
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).
Abramowitz M and Stegun I A (1972) Handbook of Mathematical Functions (3rd Edition) Dover Publications
Amos D E (1983) Algorithm 610: A portable FORTRAN subroutine for derivatives of the psi function ACM Trans. Math. Software9 494–502
1: – doubleInput
On entry: the argument of the function.
must not be ‘too close’ (see Section 6) to a non-positive integer.
2: – IntegerInput
On entry: the function to be evaluated.
3: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
On entry, .
On entry, .
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 7.5 in the Introduction to the NAG Library CL Interface for further information.
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
Evaluation abandoned due to likelihood of overflow.
On entry, x is ‘too close’ to a non-positive integer: and .
Evaluation abandoned due to likelihood of underflow.
All constants in s14adc are given to approximately digits of precision. If 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 . 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 have shown somewhat improved accuracy, except at points near the positive zero of at , where only absolute accuracy can be obtained.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
s14aec is not threaded in any implementation.
This example evaluates at , and prints the results.