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 want to be able to do high dimensional integrals like,

(..naively I wrote it as this..)

Nc = 12; Nn = 12; 
f [x_] := (Sin[x])^2;
g[n_, x_] := Cos[n*(x)];
Integrate[ (Times @@ 
      f[(a[i] - a[j])/2], {i, 1, Nc - 1}, {j, i + 1, Nc}])*
  SeriesCoefficient [ 
   Series [ 
    Exp[ Plus @@ 
      Flatten@Table [   ((4)/(n (x^(-n/2) + x^(n/2))))*(Plus @@ 
            Table[g[n, a[i] - a[j]], {i, 1, Nc}, {j, 1, Nc}]), {n, 1, 
         Nn}] ], {x, 0, 1}], 1/2], {a[1], -\[Pi], \[Pi]} , {a[
   2], -\[Pi], \[Pi]}  , {a[3], -\[Pi], \[Pi]} , {a[
   4], -\[Pi], \[Pi]}, {a[5], -\[Pi], \[Pi]}, {a[
   6], -\[Pi], \[Pi]}, {a[7], -\[Pi], \[Pi]}, {a[
   8], -\[Pi], \[Pi]}, {a[9], -\[Pi], \[Pi]} , {a[
   10], -\[Pi], \[Pi]}, {a[11], -\[Pi], \[Pi]}, {a[12], -\[Pi], \[Pi]}]

But the above has been like running for ages without an output.

I would like to know how I can optimize this work so that I can push this to higher levels. For instance I would like to extract higher powers of $x$ rather than $1/2$ as in the above example and also to more variables than $12$ as above.

share|improve this question
...I don't think it's reasonable to expect a 12-fold integral with some amount of complexity to execute quickly. You may want to figure out if you can simplify the beastie further (e.g. integrating "easy parts") before proceeding further. –  J. M. Oct 25 '12 at 16:42
I think there was a bug that required becalming. Is 0 the expected result? –  Daniel Lichtblau Oct 25 '12 at 22:15
The results for Nc from 1 to 6 seem to be {8*Pi, 8*Pi^2, 3*Pi^3, (3*Pi^4)/8, (15*Pi^5)/1024, (45*Pi^6)/262144} so I do not think it will be 0 for 12 –  Rolf Mertig Oct 26 '12 at 14:21
@RolfMertig I also get ` (15*Pi^5)/1024` using the method described below for n=5. –  chris Oct 26 '12 at 20:45
@RolfMertig and (45Pi^6)/262144 for n=6 ;-) –  chris Oct 26 '12 at 21:05
show 6 more comments

1 Answer

up vote 1 down vote accepted

This integral is doable using the following method:

1) Expand the integrant

2) TrigExpand the result

3) apply the following rule (to collect for a[1])

 Exp[x_] :> Exp[Collect[x, a[1]]]

4) apply (possibly in //) this rule to the terms which do not involve a[1]

 Exp[Complex[0, c_] a[1] +  b_.] -> (2*E^b*Sinh[Pi*(Complex[0, c])])/(Complex[0, c])}

(which corresponds to integrating over a[1]) and multiply terms which do not involve a[1] by 2Pi

5) iterate step 3 and 4) but for a[2]... a[12]

In short, we just tell give mathematica a rule for each brick element integration. I tried it for 1/63th of the terms involved in step 1 and it works. Interestingly this part of the integration did give me a zero contribution for terms depending on a[1].

I can't give you the full answer because my laptops gets too hot ;-) I ll run it on a workstation and let you know.

share|improve this answer
Sure, I did something similar, but I cannot get the answer for 12 this way. For 6 I need 45 seconds. –  Rolf Mertig Oct 26 '12 at 21:35
add comment

Your Answer


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.