My first Python program.. Calculating pi geometrically.
Ron Adam
radam2 at tampabay.rr.com
Sat Nov 1 03:06:09 EST 2003
On Sat, 01 Nov 2003 06:49:55 GMT, Ron Adam <radam2 at tampabay.rr.com>
wrote:
>
>Hi, I'm having fun learning Python and want to say thanks to everyone
>here for a great programming language.
>
>Below is my first Python program (not my first program) and I'd
>apreciate any feedback on how I might do things differently to make it
>either more consice, readable, or faster. ie... are there better ways
>to do it in Python?
>
>It won't break any records for calculating pi, that wasn't my goal,
>learning Python was. But it might be good for testing floating point
>and decimal performance. It also might make a good demo of the same.
>
>
>Anyway, here it is, any feedback would be apreciated.
>
>_Ron
>
>
BTW, I do know I can do this and get pi much much faster.
>>>import gmpy
>>>gmpy.pi(1000000)
That gives me over 300,000 decimal places in 2 to 3 minutes.
Which is very impressive. :-)
Doing it geometrically was strictly a learning exercise. And I did
learn quite a bit by doing it.
_Ron
More information about the Python-list
mailing list