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 am numerically solving an integral equation that contains a double integral. I have managed to get a solution but it takes forever. I am wondering if there is a way to speed up numerical integration of multidimensional integrals.

Here is the code:

First a couple of functions that enter the calculation (if I don't include them, the integration will be faster)

g = Pi

cs[x_] := 2*ArcCos[x]/Sqrt[1 - x^2];

csh[x_] := 2*ArcCosh[x]/Sqrt[x^2 - 1];

pref[t_, v_, d_] := 
  1/d^2*(1 + 10^(2*(v - t)) (1 - 1/d^2)) / 
    Sqrt[1 - 1/4*((10^(2*t) + 10^(2*v))/10^(t + v) - 10^(v - t)/d^2)^2]

piece[d_,v_] := 
  If[d Astart[v] < 1, cs[d Astart[v]], If[d Astart[v] > 1, csh[d Astart[v]], 2]]

Here is the actual iteration

Clear[Astart, A, precision, values]

precision = 10^-1;

Astart[t_] = -g*t + 1;

values = ParallelTable[{t, 
  1 + g/(Pi^3*2)
    (NIntegrate[Log[10]*10^(v - t)*pref[t, v, d]*((d^2*Astart[v] - 1)*(Pi - g*piece[d,v]) + 
        d*Astart[v]*g^2*csh[g])/(d^2*Astart[v]+ g^2 - 1),
      {v, -Infinity, 0},
      {d, 1/(10^(t - v) + 1), 1/Abs[10^(t - v) - 1]},
      WorkingPrecision -> 12,
      PrecisionGoal -> 3,
      MaxRecursion -> 20,
      AccuracyGoal -> 12,
      Method -> {"SymbolicPreprocessing",  "OscillatorySelection"-> False, "SymbolicProcessing"->0}
    ])},
  {t, Union[Range[-5.6,-1.6, 0.5]~Join~Log10[Range[0.08, 0.98, 0.1]]]}];

 A[t_] = Interpolation[Re@values, t, InterpolationOrder -> 2, Method-> "Spline"]

Perhaps I should also mention that this later on iterated into a while loop until convergence is achieved (just to give a better picture on the amount of total waiting time...)

EDIT: I have added in the code also the method the 'fastest' method that I could find, however it still runs for ages... Given the particular form of the integration limits, is there any better trick to help mathematica? Also, by inspection I can see that the result explodes logarithmically which might be another reason why it is so slow.

share|improve this question
1  
You have to experiment with the methods and strategies provided with NIntegrate. Check the online manual for more information. –  Spawn1701D Apr 15 '13 at 6:37
    
Please provide some codes in your question, so we can exactly know what is your problem. –  ZKT Apr 15 '13 at 6:39
    
@Spawn1701D thank you for your interest! I have tried virtually all methods provided in mathematica documentation, but it seems that my integral doesn't fit into any of the 'patterns' provided there :( –  cami Apr 15 '13 at 6:40
    
What version of Mathematica are you using? Can you provide the actual expression? –  Spawn1701D Apr 15 '13 at 6:44
    
Take a look at Advanced Numerical Integration In Mathematica it might give you some pointers. –  Spawn1701D Apr 15 '13 at 6:48

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.