Probabilities.trigamma Method

Double trigamma(Double x)

Returns the trigamma function psi^((1))(x).

#NameTypeDescription
1xDoublescalar

Returns: Double

Remarks:

The trigamma function is the second derivative of the logarithm of the Gamma function (equivalently the first derivative of the digamma function):

psi^((1))(x) = d^2/dx^2lnGamma(x) = sum_(k=0)^(inf)1/((x+k)^2) .

It satisfies the recurrence psi^((1))(x+1)=psi^((1))(x)-1/x^2, the special values psi^((1))(1)=pi^2/6 and psi^((1))(1/2)=pi^2/2, and is positive and strictly decreasing for x > 0.

Domain: x > 0. Defined behavior: returns NAN for x <= 0.

The algorithm was adapted from:

The algorithm "AS 121" from "Applied Statistics" (1978) vol 27, no. 1 Available in Fortran at: http://lib.stat.cmu.edu/apstat/121