Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



Re: NDSolve very very slow
Posted:
Oct 25, 2012 11:34 PM


Bob Hanlon and others may have suggestions to speed things up, but note that you are doing your calculations with 40 place precision. Since it is not machine precision, this significantly impacts the speed. How would you do a 40place calculation in C++?
Kevin
On 10/25/2012 1:41 AM, popov.ghost@gmail.com wrote: > M=1; > \[Lambda][l_] = l (l + 1); > rinf = 15000; > $MinPrecision = 40; > wp = $MinPrecision; > ac = $MinPrecision  8; > pg = wp/2; > > eq[\[Omega]_, > l_] := \[CapitalPhi]''[r] + (2 (r  M))/( > r (r  2 M)) \[CapitalPhi]'[ > r] + ((\[Omega]^2 r^2)/(r  2 M)^2  \[Lambda][l]/( > r (r  2 M))) \[CapitalPhi][r] == 0; > > (*The solution:*) > > \[CapitalPhi]out[\[Omega]_, l_] := \[CapitalPhi]out[\[Omega], l] = {\[CapitalPhi], \[CapitalPhi]'} /. > Block[{$MaxExtraPrecision = 100}, > NDSolve[{eq[\[Omega], l], \[CapitalPhi][rinf] == > init, \[CapitalPhi]'[rinf] == > dinit}, {\[CapitalPhi], \[CapitalPhi]'}, {r, 29, > 39}, WorkingPrecision > wp, > AccuracyGoal > ac, PrecisionGoal > pg, > MaxSteps > \[Infinity]]][[1]]; > > (*Run as:*) > > \[CapitalPhi]out[2, 1]//AbsoluteTiming



