I don't seem to get a problem with this. Have you tried a Monte Carlo approach to verify that you are getting incorrect answers?
For me, I get when the upper is 1 that > integrate(e2, lower = 0, upper = 1) -0.2820948 with absolute error < 5e-05 > sum(e2(runif(10000)))/10000 [1] -0.2825667 which seems to be consistent, while for upper = 0.75 I get > 0.75*sum(e2(runif(10000, min=0, max=0.75)))/10000 [1] -0.2333506 > integrate(e2,lower=0,upper = 0.75) -0.2341178 with absolute error < 7.8e-05 On Oct 23, 2:52 pm, fuzuo xie <xiefu...@gmail.com> wrote: > e2 <- function(x) { > out <- 0*x > for(i in 1:length(x)) > out[i] <-integrate(function(y) qnorm(y),lower=0,upper=x[i])$value > out } > integrate(e2,lower=0, upper=a)$value > > above is my code , when a is small , say a<0.45 the result is right . > however , when a>0.5 > the result is incorrect . why ? thank you . > > [[alternative HTML version deleted]] > > ______________________________________________ > r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.