PSI
This function evaluates the derivative of the log gamma function.
Function Return Value
PSI — Function value. (Output)
Required Arguments
X — Argument for which the function value is desired. (Input)
FORTRAN 90 Interface
Generic: PSI (X)
Specific: The specific interface names are S_PSI, D_PSI, and C_PSI.
FORTRAN 77 Interface
Single: PSI (X)
Double: The double precision function name is DPSI.
Complex: The complex name is CPSI.
Description
The psi function, also called the digamma function, is defined to be
See
GAMMA for the definition of
Γ(
x).
The argument x must not be exactly zero or a negative integer, or ψ (x) is undefined. Also, x must not be too close to a negative integer such that the accuracy of the result is less than half precision.
Comments
Informational Error
Type | Code | Description |
---|
3 | 2 | Result of PSI(X) is accurate to less than one‑half precision because X is too near a negative integer. |
Examples
Example 1
In this example, ψ (1.915) is computed and printed.
USE PSI_INT
USE UMACH_INT
IMPLICIT NONE
! Declare variables
INTEGER NOUT
REAL VALUE, X
! Compute
X = 1.915
VALUE = PSI(X)
! Print the results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) X, VALUE
99999 FORMAT (' PSI(', F6.3, ') = ', F6.3)
END
Output
PSI( 1.915) = 0.366
Example 2
In this example, ψ (1.9 + 4.3i) is computed and printed.
USE PSI_INT
USE UMACH_INT
IMPLICIT NONE
! Declare variables
INTEGER NOUT
COMPLEX VALUE, Z
! Compute
Z = (1.9, 4.3)
VALUE = PSI(Z)
! Print the results
CALL UMACH (2, NOUT)
WRITE (NOUT,99999) Z, VALUE
99999 FORMAT (' PSI(', F6.3, ',', F6.3, ') = (', F6.3, ',', F6.3, ')')
END
Output
PSI( 1.900, 4.300) = ( 1.507, 1.255)