MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Re: Pi upto a Billion Digits

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75728] Re: [mg75672] Re: Pi upto a Billion Digits
  • From: "Szabolcs Horvát" <szhorvat at gmail.com>
  • Date: Wed, 9 May 2007 04:35:18 -0400 (EDT)
  • References: <f1msfm$rnf$1@smc.vnet.net>

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


  • Prev by Date: Re: Eigenvalues in Mathematica 6.0.0 are SLOW
  • Next by Date: Re: Re: Format->Magnification does not work
  • Previous by thread: Re: Re: Pi upto a Billion Digits
  • Next by thread: Re: Re: Pi upto a Billion Digits