[Rd] digamma with negative arguments (PR#6626)

cspark at ces.clemson.edu cspark at ces.clemson.edu
Sun Feb 29 22:15:02 MET 2004


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
>



More information about the R-devel mailing list