s14ae returns the value of the th derivative of the psi function for real and .
Syntax
C# |
---|
public static double s14ae( double x, int k, out int ifail ) |
Visual Basic |
---|
Public Shared Function s14ae ( _ x As Double, _ k As Integer, _ <OutAttribute> ByRef ifail As Integer _ ) As Double |
Visual C++ |
---|
public: static double s14ae( double x, int k, [OutAttribute] int% ifail ) |
F# |
---|
static member s14ae : x : float * k : int * ifail : int byref -> float |
Parameters
- x
- Type: System..::..DoubleOn entry: the argument of the function.Constraint: must not be ‘too close’ (see [Error Indicators and Warnings]) to a non-positive integer.
- k
- Type: System..::..Int32On entry: the function to be evaluated.Constraint: .
- ifail
- Type: System..::..Int32%On exit: unless the method detects an error or a warning has been flagged (see [Error Indicators and Warnings]).
Return Value
s14ae returns the value of the th derivative of the psi function for real and .
Description
s14ae 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 s14ad, which is based on the method 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).
References
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. Software 9 494–502
Error Indicators and Warnings
Errors or warnings detected by the method:
On entry, , or , or x is ‘too close’ to a non-positive integer. That is, .
- The evaluation has been abandoned due to the likelihood of underflow. The result is returned as zero.
- The evaluation has been abandoned due to the likelihood of overflow. The result is returned as zero.
Accuracy
All constants in s14ad 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.
Parallelism and Performance
None.
Further Comments
None.
Example
This example evaluates at , and prints the results.
Example program (C#): s14aee.cs