[R] Multiple Integration

Ravi Varadhan rvaradha at jhsph.edu
Mon Apr 28 19:52:44 CEST 2003


You should get an error message from "adapt" since it doesn't 
understand what value to use for x[1]. However, in your case you are 
not getting an error message probably because you already have an 
object named "x" somewhere in your current working directory. This may 
explain the error.

If you want to use "adapt", your integration region must 
be "rectangular", which is not the case in your problem. But using 
indicator function, it is easy to turn your region into a rectangular 
region and then use "adapt".

Hope this helps,

Ravi.


----- Original Message -----
From: N Dey <ndey00 at yahoo.com>
Date: Saturday, April 26, 2003 8:56 am
Subject: [R] Multiple Integration

> Dear all,
> 
> May I do multiple integration using R? I was looking
> adapt but it is saying it integrates a scalar function
> over a multidimensional rectangle. I have integrand of
> several variable and upper, lower limit too variable.
> 
> I wanted to see the result using adapt (though it is
> not for this purpose, I suppose)
> 
> Func<-function(x){(x[1]*x[2])}
> adapt(2, lo=c(0,1), up=c(1,x[1]), functn=Func)
> 
> it is not giving any error(it should, if it is not the
> correct way of putting up) but also not giving correct
> result.
> 
> Is there any package to handle multiple integration in
> R??
> 
> Thanking you,
> with best regards,
> N. Dey
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
>



More information about the R-help mailing list