The R Project SVN R

Rev

Rev 64891 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 64891 Rev 64895
Line 130... Line 130...
130
## higher psigamma:
130
## higher psigamma:
131
all.equal(psigamma(1, deriv=c(1,3,5)),
131
all.equal(psigamma(1, deriv=c(1,3,5)),
132
          pi^(2*(1:3)) * c(1/6, 1/15, 8/63), tolerance = 32*Meps)
132
          pi^(2*(1:3)) * c(1/6, 1/15, 8/63), tolerance = 32*Meps)
133
x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length=61), 5.1, 77)
133
x <- c(-100,-3:2, -99.9, -7.7, seq(-3,3, length=61), 5.1, 77)
134
## Intel icc showed a < 1ulp difference in the second.
134
## Intel icc showed a < 1ulp difference in the second.
135
stopifnot(all.equal( digamma(x), psigamma(x,0), 2*Meps),
135
stopifnot(all.equal( digamma(x), psigamma(x,0), tolerance = 2*Meps),
136
          all.equal(trigamma(x), psigamma(x,1), 2*Meps))# TRUE (+ NaN warnings)
136
          all.equal(trigamma(x), psigamma(x,1), tolerance = 2*Meps))# TRUE (+ NaN warnings)
137
## very large x:
137
## very large x:
138
x <- 1e30 ^ (1:10)
138
x <- 1e30 ^ (1:10)
139
a.relE <- function(appr, true) abs(1 - appr/true)
139
a.relE <- function(appr, true) abs(1 - appr/true)
140
stopifnot(a.relE(digamma(x),   log(x)) < 1e-13,
140
stopifnot(a.relE(digamma(x),   log(x)) < 1e-13,
141
          a.relE(trigamma(x),     1/x) < 1e-13)
141
          a.relE(trigamma(x),     1/x) < 1e-13)