Re: Multiple Integrals
- To: mathgroup at smc.vnet.net
- Subject: [mg117589] Re: Multiple Integrals
- From: Ray Koopman <koopman at sfu.ca>
- Date: Thu, 24 Mar 2011 06:26:22 -0500 (EST)
- References: <imc95n$1kl$1@smc.vnet.net>
On Mar 23, 12:57 am, schomi <jeanmichel.benk... at gmail.com> wrote: > Hi everybody > > I'm having troubles with multiple integrals in Mathematica and hope > that you guys might be able to help me. > > Calculating a multiple integral per se is not such a big deal, for > instance for n=2 the code would be of the form > > Integrate[f(x, y), {x, x_min, x_max}, {y, y_min,y_max}]. > > What I'd like to have is a general formula for computing an intergral > in R^n, ie of the form > > Integrate[f(x1, x2, ...., xn), {x1, x1_min, x1_max}, {x2, > x2_min,x2_max}, ...., {xn, xn_min, xn_max}] > > The dots .... should of course be replaced by code. Is there a way to > build something of this form? > > Any help would be appreciated. In case I am not making myself clear, > do not hesitate to ask question and I'll try to give you a better > explanation. > > Thanks a lot! > > schomi mint[f_,lims_] := Block[{X,x}, X = Array[x,Length@lims]; Integrate[f@X,Sequence@@MapThread[Prepend,{lims,X}]]] func = Times@@(#^Range@Length@#)& ; ab = {{a1,b1},{a2,b2},{a3,b3}}; mint[func,ab] == Integrate[x1 x2^2 x3^3, {x1,a1,b1},{x2,a2,b2},{x3,a3,b3}] True Note that the argument that is passed to f is a *list* {x[1],...,x[n]}, not a *sequence* x[1],...,x[n].