1
$\begingroup$

I am trying to integrate a recursion relation that is formulated via conformal invariance. The expression if copy and pasted from Mathematica to Word is over 20,000 pages long. Below is an infinitesimal sample of it. When I do Monte Carlo I calculate a complex answer which makes no sense. When the range for the w variable is large it is complex, but when it is small it is real as it should be. Can anyone tell me how do I integrate such a complicated beast of a function. Thanks!

-((2.26914 Abs[(1 - (((-E^Subscript[w, 2] Cos[Subscript[θ, 
            2]] + E^Subscript[w, 3]
            Cos[Subscript[θ, 3]])^2 + (-E^Subscript[w, 2]
             Cos[Subscript[ϕ, 2]] Sin[Subscript[θ, 
            2]] + E^Subscript[w, 3]
            Cos[Subscript[ϕ, 3]] Sin[Subscript[θ, 
            3]])^2 + (-E^Subscript[w, 2] Sin[Subscript[θ, 
            2]] Sin[Subscript[ϕ, 2]] + 
          E^Subscript[w, 3]
            Sin[Subscript[θ, 3]] Sin[Subscript[ϕ, 
            3]])^2) ((E^Subscript[w, 1]
            Cos[Subscript[θ, 1]] - 
          E^Subscript[w, 4] Cos[Subscript[θ, 4]])^2 + (E^
           Subscript[w, 1]
            Cos[Subscript[ϕ, 1]] Sin[Subscript[θ, 
            1]] - E^Subscript[w, 4]
            Cos[Subscript[ϕ, 4]] Sin[Subscript[θ, 
            4]])^2 + (E^Subscript[w, 1]
            Sin[Subscript[θ, 1]] Sin[Subscript[ϕ, 
            1]] - E^Subscript[w, 4]
            Sin[Subscript[θ, 4]] Sin[Subscript[ϕ, 
            4]])^2))/(((E^Subscript[w, 1]
            Cos[Subscript[θ, 1]] - 
          E^Subscript[w, 3] Cos[Subscript[θ, 3]])^2 + (E^

           Subscript[w, 1]
            Cos[Subscript[ϕ, 1]] Sin[Subscript[θ, 
            1]] - E^Subscript[w, 3]
            Cos[Subscript[ϕ, 3]] Sin[Subscript[θ, 
            3]])^2 + (E^Subscript[w, 1]
            Sin[Subscript[θ, 1]] Sin[Subscript[ϕ, 
            1]] - E^Subscript[w, 3]
            Sin[Subscript[θ, 3]] Sin[Subscript[ϕ, 
            3]])^2) ((E^Subscript[w, 2]
            Cos[Subscript[θ, 2]] - 
          E^Subscript[w, 4] Cos[Subscript[θ, 4]])^2 + (E^
           Subscript[w, 2]
            Cos[Subscript[ϕ, 2]] Sin[Subscript[θ, 
            2]] - E^Subscript[w, 4]
            Cos[Subscript[ϕ, 4]] Sin[Subscript[θ, 
            4]])^2 + (E^Subscript[w, 2]
            Sin[Subscript[θ, 2]] Sin[Subscript[ϕ, 
            2]] - E^Subscript[w, 4]
            Sin[Subscript[θ, 4]] Sin[Subscript[ϕ, 
            4]])^2)) + (((E^Subscript[w, 1]
            Cos[Subscript[θ, 1]] - 
          E^Subscript[w, 2] Cos[Subscript[θ, 2]])^2 + (E^
           Subscript[w, 1]
            Cos[Subscript[ϕ, 1]] Sin[Subscript[θ, 
            1]] - E^Subscript[w, 2]

            Cos[Subscript[ϕ, 2]] Sin[Subscript[θ, 
            2]])^2 + (E^Subscript[w, 1]
            Sin[Subscript[θ, 1]] Sin[Subscript[ϕ, 
            1]] - E^Subscript[w, 2]
            Sin[Subscript[θ, 2]] Sin[Subscript[ϕ, 
            2]])^2) ((E^Subscript[w, 3]
            Cos[Subscript[θ, 3]] - 
          E^Subscript[w, 4] Cos[Subscript[θ, 4]])^2 + (E^
           Subscript[w, 3]
            Cos[Subscript[ϕ, 3]] Sin[Subscript[θ, 
            3]] - E^Subscript[w, 4]
            Cos[Subscript[ϕ, 4]] Sin[Subscript[θ, 
            4]])^2 + (E^Subscript[w, 3]
            Sin[Subscript[θ, 3]] Sin[Subscript[ϕ, 
            3]] - E^Subscript[w, 4]
            Sin[Subscript[θ, 4]] Sin[Subscript[ϕ, 
            4]])^2))/(((E^Subscript[w, 1]
           Cos[Subscript[θ, 1]] - 
         E^Subscript[w, 3] Cos[Subscript[θ, 3]])^2 + (E^
          Subscript[w, 1]
           Cos[Subscript[ϕ, 1]] Sin[Subscript[θ, 1]] -
          E^Subscript[w, 3]
           Cos[Subscript[ϕ, 3]] Sin[Subscript[θ, 
           3]])^2 + (E^Subscript[w, 1]
           Sin[Subscript[θ, 1]] Sin[Subscript[ϕ, 1]] -

         E^Subscript[w, 3]
           Sin[Subscript[θ, 3]] Sin[Subscript[ϕ, 
           3]])^2) 




Table[(i/i)*NIntegrate[(((
Out[23]/(4*Pi*W)^4)) Sin[Subscript[θ, 1]] Sin[
   Subscript[θ, 2]] Sin[Subscript[θ, 3]] Sin[
   Subscript[θ, 4]])((1/(4 (Cos[Subscript[θ, 1]] 
Cos[Subscript[θ, 2]] - 
Cosh[Subscript[w, 1]] Cosh[Subscript[w, 2]] + 
Cos[Subscript[ϕ, 1] - Subscript[ϕ, 2]] Sin[
Subscript[θ, 1]] Sin[Subscript[θ, 2]] + 
Sinh[Subscript[w, 1]] Sinh[Subscript[w, 2]]) (Cos[
Subscript[θ, 3]] Cos[Subscript[θ, 4]] - 
Cosh[Subscript[w, 3]] Cosh[Subscript[w, 4]] + 
Cos[Subscript[ϕ, 3] - Subscript[ϕ, 4]] Sin[
Subscript[θ, 3]] Sin[Subscript[θ, 4]] + 
Sinh[Subscript[w, 3]] Sinh[Subscript[w, 
          4]])))^(0.5181489`)), {Subscript[w, 1], 0, 
W}, {Subscript[w, 2], 0, W}, {Subscript[w, 3], 0, W}, {Subscript[
w, 4], 0, W}, {Subscript[θ, 1], 0, 
Pi}, {Subscript[θ, 2], 0, Pi}, {Subscript[θ, 3], 0, 
Pi}, {Subscript[θ, 4], 0, Pi}, {Subscript[ϕ, 1], 0, 
2*Pi}, {Subscript[ϕ, 2], 0, 2*Pi}, {Subscript[ϕ, 3], 0, 
2*Pi}, {Subscript[ϕ, 4], 0, 2*Pi}, Method -> "MonteCarlo", 
AccuracyGoal -> 4], {i, 1, 100}]
$\endgroup$
  • 3
    $\begingroup$ TIP: don't use subscripts. $\endgroup$ – AccidentalFourierTransform Aug 23 '18 at 18:40
  • $\begingroup$ So instead of Subscript[w, 2] I should put in w2? $\endgroup$ – Daniel Berkowitz Aug 23 '18 at 18:45
  • 2
    $\begingroup$ @DanielBerkowitz exactly, yes. $\endgroup$ – AccidentalFourierTransform Aug 23 '18 at 20:15
  • $\begingroup$ Or even better, w[2], or maybe myCoefficient[w,2] - that way, you can still use pattern matching on your variables $\endgroup$ – Niki Estner Aug 24 '18 at 5:46
2
$\begingroup$

I would look at using EvaluationMonitor to see if your expression is ever evaluated as complex e.g.

NIntegrate[Sqrt[x], {x, -1, 1}, 
 EvaluationMonitor :> If[Im[Sqrt[x]] != 0, Print[{x, Sqrt[x]}]]]
$\endgroup$
  • $\begingroup$ Thanks a lot I'll try it. $\endgroup$ – Daniel Berkowitz Aug 23 '18 at 18:34

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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