Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Peter Pearson Newsgroups: comp.lang.python Subject: Re: Fortran (Was: The "does Python have variables?" debate) Date: 29 May 2014 17:53:16 GMT Lines: 41 Message-ID: References: <87tx91warf.fsf@elektro.pacujo.net> <53873ef7$0$4935$e4fe514c@dreader35.news.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Trace: individual.net 0mlfgjiuCdtgwXUCN2XszAyDUwkNCfMR8f1rdt8iYCj9KOpZUE Cancel-Lock: sha1:IfcdRaNJ5XGBKtgyG49xXPtkJsM= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:72245 On 29 May 2014 14:06:47 GMT, Albert van der Horst wrote: > In article , > Mark H Harris 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. Won't there be an additional speedup resulting from the computation of atan(x) converging faster for x=1/8 than for x=1? -- To email me, substitute nowhere->spamcop, invalid->net.