/ Home
S-Archive Download Script
POLYGAMMA   Polygamma Functions
DESCRIPTION
First and second derivatives of log(gamma(x)), the first two polygamma functions.
 
USAGE
digamma(x)
trigamma(x)
logmdig(x)
 
REQUIRED ARGUMENTS
x   numeric or complex object. Missing values (NAs) are allowed.
 
VALUE
Object of same length and dimensions as x giving the digamma function (digamma) or trigamma function (trigamma) of x. The function logmdig returns log(x) - digamma(x).
 
DETAILS
The digamma function is usually denoted by the Greek character psi.

Digamma(x) is asymptotically equivalent to log(x). logmdig(x) computes the difference without subtractive cancellation for large x.

 
REFERENCES
Abramowitz, M., and Stegun, I. A. (1970). Handbook of mathematical functions. Dover, New York.
 
EXAMPLES
x <- c(3,4,5)
digamma(x+1) - digamma(x) # returns 1/x

1 / (trigamma(x) - trigamma(x+1)) # returns x^2

log(10^15) - digamma(10^15) # returns 0
logmdig(10^15) # returns value correct to 15 figures
S-Archive Download Script

Gordon Smyth. Copyright © 1996-2016. Last modified: 10 February 2004