Hi R-users.

I'm having difficulty with an integration in R via
the package "cubature". I'm putting it with a simple example here.  I wish
to integrate a function like:
f(x1,x2)=2/3*(x1+x2) in the interval 0<x1<x2<7. To be sure I tried it
by hand and got 114.33, but the following R code is giving me 102.6667.

-------------------------------------------------------------------
library(cubature)
f<-function(x) { 2/3 * (x[1] + x[2] ) }
adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(x[2],7))

-------------------------------------------------------------------

I guess something is wrong with the way I have assigned limits
in my codes. May I seek some advice from you.

Many thanks.

Regards,

Jamil.

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to