The digamma function.
LAX-backend implementation of
psi(). Original docstring below.
psi(x, /, out=None, *, where=True, casting=’same_kind’, order=’K’, dtype=None, subok=True[, signature, extobj])
The logarithmic derivative of the gamma function evaluated at
z (array_like) – Real or complex argument.
out (ndarray, optional) – Array for the computed values of
digamma – Computed values of
- Return type
For large values not close to the negative real axis
psiis computed using the asymptotic series (5.11.2) from 1. For small arguments not close to the negative real axis the recurrence relation (5.5.2) from 1 is used until the argument is large enough to use the asymptotic series. For values close to the negative real axis the reflection formula (5.5.4) from 1 is used first. Note that
psihas a family of zeros on the negative real axis which occur between the poles at nonpositive integers. Around the zeros the reflection formula suffers from cancellation and the implementation loses precision. The sole positive zero and the first negative zero, however, are handled separately by precomputing series expansions using 2, so the function should maintain full accuracy around the origin.