[R] multidimensional integration not over a multidimensionalrectangle

Lynette Sun
Thu, 03 Nov 2005 18:28:42 -0000

Hi,

anyone knows about any functions in R can get multidimensional integration
not over a multidimensional rectangle (not adapt).

For example, I tried the following function f(x,n)=x^n/n!

phi.fun<-function(x,n)
{ if (n==1) {
	x
	}else{
		integrate(phi.fun, lower=0, upper=x, n=n-1)$value
		}
}

I could get f(4,2)=4^2/2!=8, but failed in f(4,3)=4^3/3! Thanks

Best,
Lynette