[R] help with adapt function

Faheem Mitha faheem at email.unc.edu
Sun Jul 14 02:29:42 CEST 2002


Dear People,

I'm trying to use the function adapt, from the adapt library package,
which does multidimensional numerical integration. I think I must be using
the wrong syntax or something, because even a simple example does not
work. Consider

 foo <- function(x){x[1]*x[2]}

and

adapt(2, lo = c(-1,-1), up = c(1,1), functn = foo)

This simply hangs. A more complicated example crashes R, but never
mind that for the moment. Perhaps some kind person could explain what
I am doing wrong here?

The help page says

"functn an R function which should take a single vector argument and
        possibly some parameters and return the function value at that
        point. functn must return a single numeric value."

which is what I think I am doing here, but I expect I am missing
something as usual.

By the way, the help page does not say this explicitly, but I assume
that the first component in the vectors "lower" and "upper" correspond
respectively to the lower and upper limits of the integral for the
first component of the vector argument in the function, and so on?

                                       Sincerely, Faheem Mitha.

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list