4

I wish to use NIntegrate to compute multidimensional integrals. However, I don't want to manually input the limits for the dimensions. I want to store the integration limits in a list and have NIntegrate to run with the limits in that list.

I hope the following example is illustrative:

vars = {x, y, z, u, v};
func = x + y + u + z;
limits = Table[{vars[[i]], -∞, ∞},{i, 1, Length[vars]}]

{{x, -∞, ∞}, {y, -∞, ∞}, {z, ∞, ∞}, {u, -∞, ∞}, {v, -∞, ∞}}

Now I add constraints on the integration variables:

consts = 
  x >= 0 && 
  3152 + 81 y - 4 (788+20 y) >= 0 && 
  -3572 + u + 4 v + 16 x - 76 y - 4 (314 + 13 y) + 6 (788 + 20 y)+2 z >= 0 && 
  1649 - 4 u - 15 v - 66 x + 28 y + 6 (314 + 13 y) - 4 (788 + 20 y) - 6 z >= 0 && 
  788 + 6 u + 20 v + 111 x + 20 y - 4 (314 + 13 y) + 6 z >= 0;

I now try the syntax which seems intuitive to me, for integrating over the limits specified by limits :

NIntegrate[func Boole[consts], limits]

During evaluation of the above, I get the result:

NIntegrate::vars: Integration range specification limits is not of the form {x, xmin, ..., xmax}. >>
NIntegrate[func Boole[consts], limits]

Could anyone kindly help me find the right syntax to achieve integration over the limits specified in limits?

m_goldberg
  • 107,779
  • 16
  • 103
  • 257
Pavithran Iyer
  • 981
  • 1
  • 11
  • 16
  • Closely related: http://mathematica.stackexchange.com/questions/19797/3n-dimensional-integral – whuber Mar 18 '13 at 21:45

1 Answers1

9

You can do :

NIntegrate[func Boole[consts], Evaluate[Sequence @@ limits]]
b.gates.you.know.what
  • 20,103
  • 2
  • 43
  • 84