SciPy

scipy.special.polygamma

scipy.special.polygamma(n, x)[source]

Polygamma function n.

This is the nth derivative of the digamma (psi) function.

Parameters:
n : array_like of int

The order of the derivative of psi.

x : array_like

Where to evaluate the polygamma function.

Returns:
polygamma : ndarray

The result.

Examples

>>> from scipy import special
>>> x = [2, 3, 25.5]
>>> special.polygamma(1, x)
array([ 0.64493407,  0.39493407,  0.03999467])
>>> special.polygamma(0, x) == special.psi(x)
array([ True,  True,  True], dtype=bool)