comppi



"van Nek" <van.nek at arcor.de> writes:

> Am 15 Oct 2007 um 12:27 hat Raymond Toy (RT/EUS) geschrieben:
>
>> Richard Fateman wrote:
>> > I haven't looked at it, but I think I copied it from some continued fraction
>> > approximation in Hakmem, probably written out by Bill Gosper.
>> > There are likely faster-converging formulas known now.
>> 
>> For the record, here is a very brief translation of the algorithm.  I 
>> have no idea what the algorithm is, but perhaps this translation will help.
>> 
>> comppi computes pi to n bits, and (comppi n) / 2^n is pi.
>> 
>> comppi(n) :=
>>    block([a : 2^n, b, c],
>>      b : floor(a/8),
>>      c : 3*a+b,
>>      for i : 4 step 2 while b > 0 do
>>        block([],
>>          b : floor((b*(i-1)^2)/(4*i*(i+1))),
>>          c : c + b),
>>      c)$
>
> Thanks to Richard and Raymond for answering.
>
> I already did this translation by myself. To me it looks like a series 
> pi = 3 + 1/8 + ... 
> but I didn't find this in any of my books or articles.

Neither did I find it, although I have looked into a book specially devoted
to the computation of Pi.  Thus, I would also be interested in a reference
to the algorithm. 

Nicolas 

P.S.: My best guess (unfortunately only based on the observation that b
behaves like b:=b/4) is that it is a clever form of writing the series
(Adamchik, Wagon 1997):
  pi = sum_{k=0}^infty (-1)^n/4^n * (2/(4n+1) + 2/(4n+2) + 1/(4n+3))