[R] multidimensional integration not over a multidimensional rectangle

Lynette Sun fuyaonv at hotmail.com
Tue Nov 1 23:30:36 CET 2005


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




More information about the R-help mailing list