How do I really get rid of previous results?
- To: mathgroup at smc.vnet.net
- Subject: [mg29556] How do I really get rid of previous results?
- From: "Fred Simons" <f.h.simons at tue.nl>
- Date: Sun, 24 Jun 2001 22:10:14 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
When studying the very interesting approach of Adam Strzebonski to the question raised by Maarten van den Burg of finding all real roots of an equation, I ran into the following problem. As done by Adam Strzebonski , I define a polynomial and a list of roots. poly=x/20+Normal[Series[Cos[x],{x,0,100}]]; rts=Table[Root[poly,i],{i,14}];//Timing {1.82 Second,Null} Finding the numerical values of the elements of the list takes some time: N[rts] // Timing {27.9 Second,{-38.9752,-19.1433,-18.4538,-13.4028,-11.6152,-7.47114,-4.96317,-1.49 593,1.65357,4.48616,8.28087,10.446,14.984,16.324}} I want to redo this computation. ClearAll[poly, rts];Remove[poly, rts] I redefine the polynomial and the table. Now the construction of the table is more than three times as fast. poly=x/20+Normal[Series[Cos[x],{x,0,100}]]; rts=Table[Root[poly,i],{i,14}];//Timing {0.55 Second,Null} And Mathematica still knows the values of my removed table: N[rts] // Timing {0. Second,{-38.9752,-19.1433,-18.4538,-13.4028,-11.6152,-7.47114,-4.96317,-1.49 593,1.65357,4.48616,8.28087,10.446,14.984,16.324}} It has nothing to do with the removal of the names, as we see by using different names: rts2=Table[Root[poly,i],{i,14}];//Timing {0.55 Second,Null} N[rts2] // Timing {0. Second,{-38.9752,-19.1433,-18.4538,-13.4028,-11.6152,-7.47114,-4.96317,-1.49 593,1.65357,4.48616,8.28087,10.446,14.984,16.324}} What is going on here, and how do I avoid this behaviour? Fred Simons Eindhoven University of Technology