Re: Re: Re: Significant slow-down with
- To: mathgroup at smc.vnet.net
- Subject: [mg95980] Re: [mg95955] Re: [mg95913] Re: [mg95826] Significant slow-down with
- From: peter <plindsay.0 at gmail.com>
- Date: Sat, 31 Jan 2009 01:15:00 -0500 (EST)
- References: <200901291059.FAA18289@smc.vnet.net>
exactly same results on macbook 2GHz Peter 2009/1/30 van der Burgt, Maarten <Maarten.VanDerBurgt at icos.be>: > The difference is enormous on my system (laptop Vista Centrino dual core > 2.4GHz): > > Timing[RootReduce[x, Method -> "Recursive"]] > {0.297, Root[-2769706384 - 370035819 #1^2 + 324 #1^4 &, 2]} > > Timing[RootReduce[x, Method -> "NumberField"]] > {991.885, Root[-2769706384 - 370035819 #1^2 + 324 #1^4 &, 2]} > > > Best regards, > > Maarten van der Burgt > > -----Original Message----- > From: Adam Strzebonski [mailto:adams at wolfram.com] > Sent: Thursday, 29 January, 2009 12:00 > To: mathgroup at smc.vnet.net > Subject: [mg95955] [mg95913] Re: [mg95826] Significant slow-down with Mathematica > 7 (vs 6). > > In Mathematica 7 RootReduce has a choice of two methods. > > Method->"Recursive" recursively performs algebraic number arithmetic, > in a very similar way to what Mathematica 6 RootReduce was doing > > Method->"NumberField" first converts algebraic numbers in the input > to AlgebraicNumber objects with the same generator and then performs > the arithmetic within the algebraic number field. > > For each of the two methods there are examples where the method > is significantly (by more than a factor of 1000) faster than > the other one. With the default setting Method->Automatic, RootReduce > attempts to heuristically pick the faster method. Unfortunately, > there is no way to tell a priori which method will be faster and > for some examples the heuristic makes the wrong choice. > > For your example the automatic method selection picks the "NumberField" > method, but the "Recursive" method is much faster. > > In[3]:= RootReduce[x, Method->"Recursive"]//Timing > > 2 4 > Out[3]= {1.36009, Root[-2769706384 - 370035819 #1 + 324 #1 & , 2]} > > For comparison, Mathematica 6 run on the same machine gives > > In[3]:= RootReduce[x]//Timing > > 2 4 > Out[3]= {2.85218, Root[-2769706384 - 370035819 #1 + 324 #1 & , 2]} > > so Mathematica 7, with the "Recursive" method is even somewhat faster > than Mathematica 6. > > If you see that Mathematica 7 RootReduce is slower than Mathematica 6 > on a significant portion of examples that appear in your calculations, > you should probably use SetOptions[RootReduce, Method->"Recursive"]. > > I would be grateful if you could send me a few more of the examples, > so that I could use them to better tune the automatic method selection. > > Best Regards, > > Adam Strzebonski > Wolfram Research > > Scott Morrison wrote: > > I use RootReduce extremely heavily (subfactor/planar algebra > > calculations). I've recently discovered that in many cases RootReduce > > in Mathematica 7 runs significantly slower than in Mathematica 6. (Of > > course, I've > > checked on the same machine.) > > > > As an example, try RootReduce[x] with > > > > x = > > (Sqrt[(-1 + Sqrt[17])*(1 + Sqrt[17])]* > > Root[-2 - 3*#1^2 + #1^4 & , 2, 0]* > > Root[128 - 8055*#1^2 + 81*#1^4 & , 4, 0])/ > > 2 + (Sqrt[ > > 5 + Sqrt[17]]*(Sqrt[2*(5 - Sqrt[17])]* > > Root[-32 - 5*#1^2 + #1^4 & , 2, 0]* > > Root[32768 - 78588*#1^2 + 81*#1^4 & , 4, 0] - > > 2*Sqrt[2*(5 - Sqrt[17])]* > > Root[-16384 - 36144*#1^2 + 81*#1^4 & , 1, 0] + > > Sqrt[2*(5 - Sqrt[17])]*Root[-2 - 3*#1^2 + #1^4 & , 2, 0]* > > Root[128 - 8055*#1^2 + 81*#1^4 & , 4, 0]))/ > > 2 + (Sqrt[ > > 5 + Sqrt[17]]*(4*Sqrt[2*(5 - Sqrt[17])]* > > Root[-32 - 5*#1^2 + #1^4 & , 2, 0]* > > Root[32768 - 78588*#1^2 + 81*#1^4 & , 4, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[32 - 23*#1^2 + 4*#1^4 & , 1, > 0]* > > Root[-8192 - 30645*#1^2 + 81*#1^4 & , 1, 0] + > > 9*Sqrt[2*(5 - Sqrt[17])]* > > Root[-16384 - 13347*#1^2 + 81*#1^4 & , 2, 0] - > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-16384 - 13347*#1^2 + 81*#1^4 & , 2, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[-8 + 11*#1^2 + #1^4 & , 1, 0]* > > Root[8192 - 6300*#1^2 + 81*#1^4 & , 1, 0] + > > Sqrt[2*(5 - Sqrt[17])]* > > Root[-1024 - 5499*#1^2 + 81*#1^4 & , 2, 0] - > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-1024 - 5499*#1^2 + 81*#1^4 & , 2, 0]))/ > > 8 + (Sqrt[ > > 5 + Sqrt[17]]*(38*Sqrt[2*(5 - Sqrt[17])]* > > Root[-4 + #1^2 + #1^4 & , 2, 0] + > > 10*Sqrt[34*(5 - Sqrt[17])]*Root[-4 + #1^2 + #1^4 & , 2, 0] - > > 12*Sqrt[2*(5 - Sqrt[17])]* > > Root[-16384 - 36144*#1^2 + 81*#1^4 & , 1, 0] + > > 6*Sqrt[2*(5 - Sqrt[17])]*Root[-8 + 11*#1^2 + #1^4 & , 1, 0]* > > Root[8192 - 6300*#1^2 + 81*#1^4 & , 1, 0] - > > 9*Sqrt[2*(5 - Sqrt[17])]* > > Root[-4096 - 2736*#1^2 + 81*#1^4 & , 2, 0] + > > 3*Sqrt[34*(5 - Sqrt[17])]* > > Root[-4096 - 2736*#1^2 + 81*#1^4 & , 2, 0] + > > 6*Sqrt[2*(5 - Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 2, 0]* > > Root[512 - 2556*#1^2 + 81*#1^4 & , 1, 0]))/ > > 12 + (Sqrt[ > > 5 + Sqrt[17]]*(Sqrt[2*(5 - Sqrt[17])]* > > Root[-16 - 251*#1^2 + 4*#1^4 & , 1, 0] + > > 2*Sqrt[2*(5 - Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 1, 0]* > > Root[512 - 2556*#1^2 + 81*#1^4 & , 4, 0]))/ > > 4 + (Sqrt[ > > 5 + Sqrt[17]]*(2*Sqrt[2*(5 - Sqrt[17])]* > > Root[-1 + 3*#1^2 + 2*#1^4 & , 1, 0]* > > Root[512 - 2556*#1^2 + 81*#1^4 & , 4, 0] - > > 3*Sqrt[2*(5 - Sqrt[17])]* > > Root[-256 - 684*#1^2 + 81*#1^4 & , 1, 0] + > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-256 - 684*#1^2 + 81*#1^4 & , 1, 0]))/ > > 4 + (Sqrt[(-1 + Sqrt[17])*(1 + Sqrt[17])]* > > Root[-1 + 3*#1^2 + 2*#1^4 & , 1, 0]* > > Root[32 - 639*#1^2 + 81*#1^4 & , 1, 0])/ > > 2 + (Sqrt[ > > 5 + Sqrt[17]]*(2*Sqrt[2*(5 - Sqrt[17])]* > > Root[-8 + 11*#1^2 + #1^4 & , 1, 0]* > > Root[8192 - 6300*#1^2 + 81*#1^4 & , 1, 0] - > > 3*Sqrt[2*(5 - Sqrt[17])]* > > Root[-4096 - 2736*#1^2 + 81*#1^4 & , 2, 0] + > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-4096 - 2736*#1^2 + 81*#1^4 & , 2, 0] + > > 2*Sqrt[2*(5 - Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 1, 0]* > > Root[32 - 639*#1^2 + 81*#1^4 & , 1, 0]))/ > > 4 + (Sqrt[(-1 + Sqrt[17])*(1 + Sqrt[17])]* > > Root[2 - 7*#1^2 + 4*#1^4 & , 1, 0]* > > Root[-128 - 12573*#1^2 + 324*#1^4 & , 1, 0])/ > > 2 + (Sqrt[ > > 5 + Sqrt[17]]*(19*Sqrt[2*(5 - Sqrt[17])]* > > Root[-4 + #1^2 + #1^4 & , 2, 0] + > > 5*Sqrt[34*(5 - Sqrt[17])]*Root[-4 + #1^2 + #1^4 & , 2, 0] + > > 3*Sqrt[2*(5 - Sqrt[17])]*Root[32 - 23*#1^2 + 4*#1^4 & , 1, > 0]* > > Root[-8192 - 30645*#1^2 + 81*#1^4 & , 1, 0] + > > 3*Sqrt[2*(5 - Sqrt[17])]*Root[2 - 7*#1^2 + 4*#1^4 & , 1, 0]* > > Root[-128 - 12573*#1^2 + 324*#1^4 & , 1, 0]))/ > > 6 + ((-1 + Sqrt[17])^(3/2)*Sqrt[1 + Sqrt[17]]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0])/ > > 8 + (Sqrt[ > > 5 + Sqrt[17]]*(9*Sqrt[2*(5 - Sqrt[17])]* > > Root[-16384 - 13347*#1^2 + 81*#1^4 & , 2, 0] - > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-16384 - 13347*#1^2 + 81*#1^4 & , 2, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[-8 + 11*#1^2 + #1^4 & , 1, 0]* > > Root[8192 - 6300*#1^2 + 81*#1^4 & , 1, 0] - > > Sqrt[2*(5 - Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0] + > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0]))/ > > 8 + (Sqrt[ > > 5 + Sqrt[17]]*(4*Sqrt[2*(5 - Sqrt[17])]* > > Root[-2 - 3*#1^2 + #1^4 & , 2, 0]* > > Root[128 - 8055*#1^2 + 81*#1^4 & , 4, 0] + > > Sqrt[2*(5 - Sqrt[17])]* > > Root[-1024 - 5499*#1^2 + 81*#1^4 & , 2, 0] - > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-1024 - 5499*#1^2 + 81*#1^4 & , 2, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 2, 0]* > > Root[512 - 2556*#1^2 + 81*#1^4 & , 1, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 1, 0]* > > Root[32 - 639*#1^2 + 81*#1^4 & , 1, 0] + > > 4*Sqrt[2*(5 - Sqrt[17])]*Root[2 - 7*#1^2 + 4*#1^4 & , 1, 0]* > > Root[-128 - 12573*#1^2 + 324*#1^4 & , 1, 0] - > > Sqrt[2*(5 - Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0] + > > Sqrt[34*(5 - Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0]))/ > > 8 + (Sqrt[(1 + Sqrt[17])/ > > 2]*(4*Sqrt[2*(-1 + Sqrt[17])]* > > Root[-2 - 3*#1^2 + #1^4 & , 2, 0]* > > Root[128 - 8055*#1^2 + 81*#1^4 & , 4, 0] + > > 4*Sqrt[2*(-1 + Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 1, > 0]* > > Root[32 - 639*#1^2 + 81*#1^4 & , 1, 0] + > > 4*Sqrt[2*(-1 + Sqrt[17])]*Root[-1 + 3*#1^2 + 2*#1^4 & , 2, > 0]* > > Root[32 - 639*#1^2 + 81*#1^4 & , 4, 0] + > > 4*Sqrt[2*(-1 + Sqrt[17])]*Root[2 - 7*#1^2 + 4*#1^4 & , 1, 0]* > > Root[-128 - 12573*#1^2 + 324*#1^4 & , 1, 0] - > > Sqrt[2*(-1 + Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0] + > > Sqrt[34*(-1 + Sqrt[17])]* > > Root[-256 - 5499*#1^2 + 324*#1^4 & , 2, 0]))/8; > > > > this runs in <2s in Mathematica 6 on my machine, and >30s in > Mathematica7. > > I have other examples where the difference is even worse. > > > > Thanks, > > Scott Morrison > > > >
- References:
- Re: Significant slow-down with Mathematica 7 (vs 6).
- From: Adam Strzebonski <adams@wolfram.com>
- Re: Significant slow-down with Mathematica 7 (vs 6).