psi
Digamma function and its higher derivatives (polygamma).
Category: Mathematics > Elementary Math
Syntax
Y = psi(X)
Returns the digamma function, the derivative of log(gamma(X)).
Y = psi(k, X)
Returns the k-th derivative of the digamma function (polygamma of order k).
Description
Because gamma extends the factorial, psi extends the harmonic numbers: psi(n+1) equals the sum 1 + 1/2 + ... + 1/n minus the Euler-Mascheroni constant, and psi(1) is that constant negated, about -0.5772. It has poles at zero and at the negative integers.
The higher orders arise in series expansions: psi(1, 1) equals pi^2/6, the sum of the reciprocal squares.
Input arguments
k- Nonnegative integer scalar, the order of the derivative.
psi(0, X)is the same aspsi(X). X- Real array.
Output arguments
Y- Array of the same size as
X.
Example
Digamma and trigamma
psi([1 2 0.5])
psi(1, 1)
pi^2/6
Output
ans = 1×3
-0.5772 0.4228 -1.9635
ans = 1.6449
ans = 1.6449