surprising comparison of Mathematica 5.2 and 7.0
- To: mathgroup at smc.vnet.net
- Subject: [mg111168] surprising comparison of Mathematica 5.2 and 7.0
- From: mathfanda <KKratky at seznam.cz>
- Date: Thu, 22 Jul 2010 05:44:42 -0400 (EDT)
Dear Mathematica friends, the following program runs 4.7 times faster and uses 22.7 times less memory in Mathematica 5.2 than in Mathematica 7.0. Fortunately, it gives the same result. ClearAll["Global`*"]; c[1] = 2; Table[ a = Sum[c[i] r^i,{i,1,n}] + O[r]^(n+1); s = 4(1-1/(1+1/3+r-a*Cos[2t]))//Normal//TrigReduce; Table [ b[2i]= Coefficient[s,Cos[2i*t]]/2,{i,n}]; b[0] = s-2*Sum[b[2i]*Cos[2i*t],{i,n}]//Simplify; b[x_?OddQ]=0; m=Table[If[i==j,b[0]-(n+1-i)^2,b[Abs[i-j]]],{i,2n+1},{j,2n+1}]; m=Simplify[m]; d=Det[m]+O[r]^(n+1)//Simplify//Normal; c[n-1]=c[n-1]/.First[Solve[d==0,c[n-1]]]; ,{n,3,5}]; Print[$Version]; Print["c[4]=",c[4]]; Print["time=",TimeUsed[]]; Print["memory=",MaxMemoryUsed[]/2^20.," MB"]; Here are the results: 5.2 for Linux x86 (64 bit) (June 20, 2005) 38475 c[4]=-(-----) 16384 time=0.98 memory=6.07137 MB 7.0 for Linux x86 (64-bit) (February 18, 2009) 38475 c[4]=-(-----) 16384 time=4.61 memory=136.313 MB The conclusion might be: do not uninstall Mathematica 5.2 yet :-) Or am I wrong? Pavel