Sign up ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

EDIT: I need to evaluate a very complicated multi-dimensional Integral. The dimension of the Integral depends on a variable j. Let's make my point clear with the following example:

j = 1;
b = 5;
xvars = Table[Symbol["x" <> ToString[i]], {i, 1, j + 1}];
xrange = Table[{xvars[[i]], 0, b}, {i, 1, j + 1}];
yvars = Table[Symbol["y" <> ToString[i]], {i, 1, j}];
yrange = Table[{yvars[[i]], -1, 1}, {i, 1, j}];
kvars = Table[Symbol["k" <> ToString[i]], {i, 1, j + 1}];
krange = Table[{kvars[[i]], 0, 1}, {i, 1, j + 1}];

f := 9.706509465469745` E^(-1.3507509720280906` k1^2 - 
   0.6753754860140453` k2^2 - 0.05555555555555558` x1 - y1^2/2)
   Sin[1.7289432000093294` k2] Sin[7.748120838924868` k1 x1] Sin[
   7.748120838924868` k2 x2] Sin[
   7.748120838924868` k1 (x2 + (0.` + 0.15` I) y1)]

expression0 = Sum[f, Evaluate[Sequence @@ krange]]
expression1 = Integrate[expression0, Sequence @@ xrange]
Integrate[expression1, Sequence @@ yrange]

This integral is evaluated rather fast but my function f get's more and more complicated as the index j grows.

So do you have any tipps to speed up the calculation of the Integral, or which method should I use. Im not that familiar with numerical integration rules, especially multidimensional.

I used in the example Integrate which I think is not as fast as NIntegrate but I can't make NIntegrate work. How can I use NIntegratein this example? And which method would you recommend? Any tipps greatly appreciated.

share|improve this question
For a high-dimension integral, Monte Carlo usually works well. Have you tried Method->"AdaptiveMonteCarlo"? – Xerxes Feb 6 '13 at 21:19
Yes, I thought that MC would be the best choice. But I can't get the code to run with NIntegrate. Thats my biggest problem right now – rainer Feb 7 '13 at 7:34
If i use NIntegrate[expression1,Sequence@@yrange, Method->"AdaptiveMonteCarlo"] I get the error: Sequence@@yrange is not ofthe form {x,xmin,..,xmax}. Which is weird because yrange is in this format – rainer Feb 7 '13 at 15:18
You just need to add an Evaluate around that Sequence. – Xerxes Feb 7 '13 at 18:53 – Searke Feb 7 '13 at 19:30

Your Answer


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

Browse other questions tagged or ask your own question.