Psi Digamma Function


For n a positive integer the Digamma function Psi(n) = −gamma + 1 + 1/2 + 1/3 + ... + 1/(n−1) = Sum{k=1, n−1}[1/k], where gamma = −Psi(1) = 5.77215,66490,15328,6...E−1 is Euler's constant. Psi is defined for all values of x except for integers <= 0 where it is infinite.

For example, Psi(2) = −0.5772156649... + 1 = 0.422784335... .

Here are some notes from my program XPCalc - Extra Precision Floating-Point Calculator http://www.oocities.org/hjsmithh/download.html#XPCalc :

Psi(x) = DigammaFunction(x):

Psi(x) = logarithmic derivative of the Gamma function d/dx(Ln(Gam(x))) = Gam'(x) / Gam(x). For x >= −5, the asymptotic formula with Bernoulli numbers is used to compute this. If x is an integer <= zero, an alarm is displayed. For non-integer negative x < −5, the reflection formula is used:

Psi(x) = Psi(y) + Pi / (Tan(Pi * y)), where y = 1 − x.

For large x (x > n),

Psi(x) =~ Ln(x) − 1/2*x − Sum{k=1,2,...}[B(2*k) / (2*k*x^(2*k))],

where B(2*k) are Bernoulli numbers. For small x,

Psi(x) = Psi(n + x) − 1/(n−1+x) − 1/(n−2+x) − ... − 1/(1+x) − 1/x.

This is based on Psi(x) = Psi(x+1) − 1/x. n is computed by a heuristic, n = max( (int)((digits^1.5) / 13.0 + 1 − x), 0), where digits is the current decimal digits in a computed mantissa.

See: Digamma Function -- From MathWorld
And: Wolfram Function Evaluation -- PolyGamma (1-arg, PolyGamma[z] = PolyGamma[0, z])

Return to Number Theory, Algorithms, and Real Functions
Return to Harry's Home Page


This page accessed times since April 7, 2005.
Page created by: hjsmithh@sbcglobal.net
Changes last made on Monday, 06-Aug-07 20:47:32 PDT