Skip to content

Multiple Integration

2 messages · N Dey, Spencer Graves

#
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
#
Have you considered Monte Carlo integration?  If the function is 
bounded on the rectangular region of integration (or if its square is 
integrable), then you can generate N random points inside the rectangle, 
and evaluate the function at each point.  Their mean is the integral, 
and from their sample variance, you can get a confidence interval on 
that estimate.  With modern computers, you can get any degree of 
accuracy you want just by waiting longer.

	  You can improve on this using kernals, but I'm not familiar with 
those methods.

hope this helps.  spencer graves
N Dey wrote: