Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « scipy.special »

Fonction psi - module scipy.special

Signature de la fonction psi

Description

psi.__doc__

psi(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])

psi(z, out=None)

The digamma function.

The logarithmic derivative of the gamma function evaluated at ``z``.

Parameters
----------
z : array_like
    Real or complex argument.
out : ndarray, optional
    Array for the computed values of ``psi``.

Returns
-------
digamma : ndarray
    Computed values of ``psi``.

Notes
-----
For large values not close to the negative real axis, ``psi`` is
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 ``psi`` has 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.

References
----------
.. [1] NIST Digital Library of Mathematical Functions
       https://dlmf.nist.gov/5
.. [2] Fredrik Johansson and others.
       "mpmath: a Python library for arbitrary-precision floating-point arithmetic"
       (Version 0.19) http://mpmath.org/

Examples
--------
>>> from scipy.special import psi
>>> z = 3 + 4j
>>> psi(z)
(1.55035981733341+1.0105022091860445j)

Verify psi(z) = psi(z + 1) - 1/z:

>>> psi(z + 1) - 1/z
(1.55035981733341+1.0105022091860445j)