psi1

Evaluates the second derivative of the log gamma function.

Synopsis

psi1 (x)

Required Arguments

float x (Input)
Argument at which the function is to be evaluated.

Return Value

The value of the second derivative of the log gamma function at x. NaN is returned if an error occurs.

Description

The psi1 function, also called the trigamma function, is defined to be

\[\psi_1(x) = \frac{d^2}{dx^2} \ln \mathit{\Gamma}(x)\]

See gamma for the definition of Γ(x).

The argument x must not be exactly zero or a negative integer, or \(\psi_1(x)\) is undefined. Also, x must not be too close to a negative integer such that the accuracy of the result is less than half precision.

Example

In this example, \(\psi_1 (1.915)\) is evaluated.

from __future__ import print_function
from numpy import *
from pyimsl.math.psi1 import psi1

x = 1.915
ans = psi1(x)
print("psi1(%f) = %f" % (x, ans))

Output

psi1(1.915000) = 0.681164

Warning Errors

IMSL_NEAR_NEG_INT_WARN The result is accurate to less than one-half precision because “x” is too close to a negative integer.