Fortran (Was: The "does Python have variables?" debate)

Albert van der Horst albert at spenarnc.xs4all.nl
Thu May 29 10:06:47 EDT 2014


In article <lkoi5v$vfj$1 at speranza.aioe.org>,
Mark H Harris  <harrismh777 at gmail.com> wrote:
>On 5/11/14 1:59 PM, Chris Angelico wrote:
>>>> julia> prec=524288
>>>> 524288
>>>
>>>> julia> with_bigfloat_precision(prec) do
>>>>          println(atan(BigFloat(1)/5)*16 - atan(BigFloat(1)/239)*4)
>>>>        end
>>
>> Would it be quicker (and no less accurate) to represent pi as
>> atan(BigFloat(1))*4 instead? That's how I originally met a
>> pi-calculation (as opposed to "PI = 3.14" extended to however much
>> accuracy someone cared to do).
>
>    No.  Simple experiment will show you. The atan(x<=1) will converge
>faster. For 524288 bits atan(1) formula converged in 3 seconds, and
>Machin's formula atan(x<1) converged in 2 seconds. Where it becomes very
>apparent is 10K and 100K or above.  Also, the difference is much more
>noticeable in Python than in Julia, but it is there no-the-less.
>
>    But here is the cool part: what if your π function could be broken
>down into three very fast converging atan(x<1) functions like this one:
>
> > pi = 24*atan(1/8) + 8*atan(1/57) + 4*atan(1/239)    (Shanks used this)
>
>
>... and then, you have julia send each piece to a separate
>processor|core (it does this at its center) and they converge together,
>then julia pieces them together at the end. Then things get incredibly
>faster.

I know now how to interpret your posts. Using "incredible" for a mere
factor of at most 3. Balanced views are more convincing.

Groetjes Albert
>
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert at spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst




More information about the Python-list mailing list