psi¶
Evaluates the derivative of the log gamma function.
Synopsis¶
psi (x)
Required Arguments¶
- float
x
(Input) - Argument at which the function is to be evaluated.
Return Values¶
The value of the derivative of the log gamma function at x
. NaN is
returned if an error occurs.
Description¶
The psi
function, also called the digamma function, is defined to be
\[\psi(x) = \frac{d}{dx} \ln \mathit{\Gamma}(x)\]
See gamma for the definition of Γ(x).
The argument x
must not be exactly zero or a negative integer, or
\(\psi(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. If
no value can be computed, then NaN is returned.
Example¶
In this example, \(\psi(1.915)\) is evaluated.
from __future__ import print_function
from numpy import *
from pyimsl.math.psi import psi
x = 1.915
ans = psi(x)
print("psi(%f) = %f" % (x, ans))
Output¶
psi(1.915000) = 0.366453
Warning Errors¶
IMSL_NEAR_NEG_INT_WARN |
The result is accurate to less than
one-half precision because “x ”
is too close to a negative integer. |