Re: Re: Pi upto a Billion Digits
- To: mathgroup at smc.vnet.net
- Subject: [mg75727] Re: [mg75672] Re: Pi upto a Billion Digits
- From: DrMajorBob <drmajorbob at bigfoot.com>
- Date: Wed, 9 May 2007 04:34:44 -0400 (EDT)
- References: <f1msfm$rnf$1@smc.vnet.net> <6330655.1178621270967.JavaMail.root@m35>
- Reply-to: drmajorbob at bigfoot.com
On my machine (WinXP, Athlon 3200+, 2GB RAM, Mathematica 6), I estimate 3.4 hours: 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 On Tue, 08 May 2007 04:54:55 -0500, Szabolcs <szhorvat at gmail.com> wrote:= > Raj wrote: >> hi! >> >> Could somebody tell me if they ever tried finding Pi upto a billion >> digits using the N function: >> N[Pi,10^9] and how long did it take? >> >> Thanks, >> >> Raj > > I haven't tried it, but you can estimate how long it takes, like this:= > > d = Table[Update[]; First@Timing[N[Pi, 2^k 10^5]], {k, 1, 6}]/Second= > > {1.437, 3.579, 9.14, 23.375, 58.453, 143.391} > > (Results are from Mathematica 5.2, 1.7 GHz processor.) > > ListPlot[Log@d] > > Now we can extrapolate. Find the slope of Log@d > > slope = Mean@ListConvolve[{1, -1}, Log@d] > > 0.920604 > > 10^9 is approximately 2^12 * 10^5, so you can expect > > Exp[11*slope + d[[1]] ] > > 105202. > > This is approximately 30 hours. Of course this result may be an order = of > magnitude off, but I suspect that the precise result is less than 30 > hours, not more. With a little patience you can get a much better = > estimate. > > Or you can leave the calculation running for a day and hope that you > don't run out of memory (memory usage may be a bigger problem than CPU= > time). If you do run the calculation, please let us know your findings=