Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Closely related: mathematica.stackexchange.com/questions/19797/… –  whuber Mar 18 '13 at 21:45

1 Answer 1

You can do :

NIntegrate[func Boole[consts], Evaluate[Sequence @@ limits]]
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.