I'd heartily suggest you read some basic R references before trying to engage this question: a cursory glance over your code suggests it can (and should) be entirely rewritten without for loops using vectorization and possibly a product function like this one that I'll provide you with:
product <- function(x) exp(sum(log(x))) I'd do it myself, but to be honest, I don't really understand how its supposed to work. What is the point of "looping" from 1 to 1 so many times? As to your question, your first error comes from trying to apply multivariate integration techniques to a function of a single variable. Specifically, you give R secondary and (possibly) tertiary arguments and tell it to hand them to a univariate function -- hence the error. Your second error is probably caused by the fact that you now have a function of four variables -- x,g, i, j -- where i is never used other than the iterator (and you can't trick R so don't even go down that path), g is overwritten before being accessed, and j just doesn't appear at all. Michael On Wed, Oct 5, 2011 at 5:07 PM, sevenfrost <linshuan...@gmail.com> wrote: > cuhre is a function in package R2Cuba for multidimensional integration. > > There are three kind of variables to integrate. I just use y,w,t to > distinguish them from each other. Is there any problem ? > > -- > View this message in context: > http://r.789695.n4.nabble.com/cuhre-usage-multidimensional-integration-tp3873478p3876182.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > ______________________________________________ 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.