[Tutor] Re: concerning Monte Python method you suggested for pi, also PiPoem I found

Daniel Yoo dyoo@hkn.EECS.Berkeley.EDU
Tue, 29 Aug 2000 02:50:48 -0700 (PDT)

On Tue, 29 Aug 2000, Charles Gruschow, Jr. wrote:

> I did a little statistics on that program.
> 10000 loops of 10000 "arrows" (used getPi(10000) 10000 times)
> It took about 4 hours.
> One ?--->why are all our ratios coming out to 3 or 4 digits, is it because
> we are dividing by 10000?

Exactly --- For every additional power of 10 we dedicate, we get one more
digit of un-precision.  *grin* It's a very bad method if you want to get
Pi quickly.  Nevertheless, it is pretty cool to get Pi out of randomness,

> This method doesn't seem too accurate or quick, does it.

A traditional method of getting Pi involves summing up a partial sum (the
derivation comes from trigonometic identities), and I'm sure there are
many other methods that perform far better than dart throwing.  My
Calculus is rusty, but I can look it up again in my dusty textbook, if you

I do remember seeing a very interesting method of getting Pi rapidly using
some sort of sequence-accelerating function.  It's in the book, "Structure
and Interpretation of Computer Programs", the best CS textbook, period.  
I heartily recommend it --- it's the best book on programming that I've
ever read.  The language they use in the book is Scheme, which is a
wonderful medium for getting ideas across.  The authors are Abelson and

If I have time, I'll see if that Pi-accelerator translates well to Python.