From cspark at ces.clemson.edu  Sun Feb 29 22:15:02 2004
From: cspark at ces.clemson.edu (cspark@ces.clemson.edu)
Date: Sun Feb 29 22:15:04 2004
Subject: [Rd] digamma with negative arguments (PR#6626)
Message-ID: <20040229211502.EAF3AED90@slim.kubism.ku.dk>

Full_Name: Chanseok Park
Version: 1.8.1
OS: linux-gnu
Submission from: (NULL) (130.127.112.183)


digamma with any negative value does not give a right answer.
It gives -1.797693e+308 for any negative arguments.

For example, digamma(-1.1) gives  -1.797693e+308.

The right answer should be 10.15416

This bug can be easily fixed by using the following digamma identity.

digamma(x) = digamma(1-x) - pi/tan(pi*x) ## if x is negative

> digamma(-1)
[1] -1.797693e+308

## if we use the above math identity, we have the right answer 
##     for any negative arguments.
> 
> x= -1.1
>  digamma(1-x) - pi/tan(pi*x) ## if x is negative
[1] 10.15416
>


[Rd] digamma with negative arguments (PR#6626)
cspark@ces.clemson.edu