Re: Re: Pi upto a Billion Digits
- To: mathgroup at smc.vnet.net
- Subject: [mg75732] Re: [mg75672] Re: Pi upto a Billion Digits
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Wed, 9 May 2007 04:37:29 -0400 (EDT)
- References: <f1msfm$rnf$1@smc.vnet.net> <6330655.1178621270967.JavaMail.root@m35> <op.tr0m9xlequ6oor@monster.ma.dl.cox.net> <16477279.1178641983790.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
Version 6 may cache differently than 5.2, in some way that Update[] doesn't affect. Whatever the case may be, version 6 is faster than 5.2 at my machine. Version 5.2 timings: Update[] Timing[N[Pi,4*10^5];] Timing[N[Pi,8*10^5];] Update[] Timing[N[Pi,8*10^5];] Update[] Table[Timing[N[Pi,k 4*10^5];],{k,2}] Update[] Table[Update[];Timing[N[Pi,k 4*10^5];],{k,2}] {1.515 Second,Null} {2.922 Second,Null} {4.047 Second,Null} {{1.562 Second,Null},{2.907 Second,Null}} {{1.562 Second,Null},{3.984 Second,Null}} Update[] Timing[N[Pi, 4*10^5];] Timing[N[Pi, 8*10^5];] Update[] Timing[N[Pi, 8*10^5];] Update[] Table[Timing[N[Pi, k 4*10^5];], {k, 2}] Update[] Table[Update[]; Timing[N[Pi, k 4*10^5];], {k, 2}] {0.796, Null} {1.954, Null} {1.875, Null} {{0.813, Null}, {1.89, Null}} {{0.812, Null}, {1.907, Null}} Bobby On Tue, 08 May 2007 11:29:51 -0500, Szabolcs Horvát <szhorvat at gmail.com> wrote: > On 08/05/07, DrMajorBob <drmajorbob at bigfoot.com> wrote: >> On my machine (WinXP, Athlon 3200+, 2GB RAM, Mathematica 6), I estimate >> 3.4 hours: > > Did you run the calculation? > > >> >> Timing[data = >> Table[Update[]; >> Log@{#, First@Timing[N[Pi, #]]} &[2^k 10^5], {k, 1, 8}]] >> >> {231.921, {{Log[200000], -1.06711}, {Log[400000], -0.226901}, {Log[ >> 800000], 0.669879}, {Log[1600000], 1.50741}, {Log[3200000], >> 2.37052}, {Log[6400000], 3.21451}, {Log[12800000], >> 4.05123}, {Log[25600000], 4.87675}}} >> >> (I doubled two steps more than Szabolcs did.) >> >> The log-log data is VERY linear: >> >> Needs["LinearRegression`"] >> AdjustedRSquared /. Regress[data, x, x] >> >> 0.999901 >> >> Clear[a, b, z, logSecs, hours] >> model = a + b z; >> logSecs[z_] = model /. FindFit[data, model, {a, b}, z] >> hours[z_] := Exp[logSecs[Log[z]]]/60^2 >> hours[10^9] >> >> -16.0424 + 1.22792 z >> >> 3.37132 >> >> Also note, omitting Update[] has NO effect on the timings: >> >> Timing[data = >> Table[Log@{#, First@Timing[N[Pi, #]]} &[2^k 10^5], {k, 1, 8}]] >> >> {231.703, {{Log[200000], -1.07002}, {Log[400000], -0.207024}, {Log[ >> 800000], 0.628609}, {Log[1600000], 1.52126}, {Log[3200000], >> 2.36471}, {Log[6400000], 3.21133}, {Log[12800000], >> 4.04989}, {Log[25600000], 4.8771}}} >> >> Bobby > > Update[] forces Mathematica to recalculate everything instead of using > cached values. If it has no effect in Mathematica 6 that is very > strange (it would mean that Mathematica 6 doesn't cache results in > this case, and that the performance may be worse than in 5.2). Does it > have an effect when you don't use it in Table[], but evaluate the > expressions separately? > > In 5.2 it has a very noticeable effect: > > In[178]:= > Update[] > > In[179]:= > Timing[N[Pi,4*10^5];] > > Out[179]= > {3.25 Second,Null} > > In[180]:= > Timing[N[Pi,8*10^5];] > > Out[180]= > {5.579 Second,Null} > > In[181]:= > Update[] > > In[182]:= > Timing[N[Pi,8*10^5];] > > Out[182]= > {8.187 Second,Null} > > In[183]:= > Update[] > > In[184]:= > Table[Timing[N[Pi,k 4*10^5];],{k,2}] > > Out[184]= > {{3.156 Second,Null},{5.625 Second,Null}} > > In[185]:= > Update[] > > In[186]:= > Table[Update[];Timing[N[Pi,k 4*10^5];],{k,2}] > > Out[186]= > {{3.11 Second,Null},{8.062 Second,Null}} > > Szabolcs > -- DrMajorBob at bigfoot.com