Re: Multiple Integrals
- To: mathgroup at smc.vnet.net
- Subject: [mg117617] Re: Multiple Integrals
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Thu, 24 Mar 2011 06:31:34 -0500 (EST)
On 3/23/11 at 2:56 AM, jeanmichel.benkert at gmail.com (schomi) wrote: >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? Yes. Here is an example for a double integral. In[18]:= expr = x y; limits = {{1, 2}, {3, 4}}; vars = {x, y}; Obviously, the lists above could be extended to arbitrary length and created via code. Here is the integral using the above: In[21]:= Integrate[expr, Sequence @@ MapThread[Flatten@{##} &, {vars, limits}]] Out[21]= 21/4 And to demonstrate the same result is obtained by conventional entry In[22]:= Integrate[x y, {x, 1, 2}, {y, 3, 4}] Out[22]= 21/4