Re: Pi upto a Billion Digits
- To: mathgroup at smc.vnet.net
- Subject: [mg75789] Re: Pi upto a Billion Digits
- From: Raj <rajanikanth at gmail.com>
- Date: Thu, 10 May 2007 05:23:40 -0400 (EDT)
- References: <f1msfm$rnf$1@smc.vnet.net>
On May 9, 2:06 am, DrMajorBob <drmajor... at bigfoot.com> wrote: > Calculating N[Pi,2*10^8], I got an abnormal termination from the > C++ library after ten or fifteen minutes. > > So... 10^9 is out of the question on my machine. > > Bobby > > On Tue, 08 May 2007 11:29:51 -0500, Szabolcs Horv=E1t <szhor... at gmail.com> > wrote: > > > > > On 08/05/07, DrMajorBob <drmajor... 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 > > -- > DrMajor... at bigfoot.com Thanks for the replies. It seemed to take a long time(> 1 hour) on my computer...so I was curious if someone already evaluated it. Thanks, Raj