van.nek at arcor.de
Mon Oct 15 12:26:28 CDT 2007
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
> b : floor((b*(i-1)^2)/(4*i*(i+1))),
> c : c + b),
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.
b:floor(a/8) instead of simply b:a/8 I don't understand, since a is a power of 2.
> Something I would much rather see is that people document what they
> find. Most of maxima is uncommented, so if you've spent a fair amount
> of time figuring out how something works, please write a few comments
> about how it works or what it's supposed to do, or whatever. Then the
> next person won't have to spend as much time to figure it all out again,
> and again and again.
Definitely YES, and open source code should also show what is the underlying
If I remember right, the coders of YaCAS do so. Code, which refers to an article can be
proved quite easily and can be a fantastic inspiration for learning mathematics.
I am thankful for any comments in the source files. Many thanks to the one, who has written
;; COMPPI computes PI to N bits.
;; That is, (COMPPI N)/(2.0^N) is an approximation to PI.
without this I surely wouldn't have understood anything.
Thanks in advance for more comments on comppi.
Volker van Nek
More information about the Maxima