Wednesday, September 16, 2009

PYTHON RECURSIONS FOR 'pi' AND 'e'

FROM THE BASEL PROBLEM

The problem which put Euler on the path of immortality was the BASEL PROBLEM solved in 1735, 91 years since it was proposed . Succinctly put Euler's proof was ;

Using this result to obtain a recursion for pi in Python !

Pic 1. pi.py

At 500 terms the result is 3.13968..... not too far from the sinister 3.1415.....The recursions are good till about 995 terms (3.14063326091) after which one comes across .... RuntimeError: maximum recursion depth exceeded

Similar programs may be devised on more series as given by Euler, as .....


RECURSIONS FOR e

e the base of natural logarithm is yet another important constant in mathematics .... and once again related to Euler .....

A python program on this recursion is designed via the factorial function ....

Pic 2. e.py

The limit of recursion is around n = 170 which yields a very accurate value of e.

Thus in a nutshell .....

"Read Euler, read Euler, he is the master of us all."
-- Pierre-Simon Laplace

REFERENCES
(1) Recursive functions for phi and root two
(2) Other pi recursions in Python

1 comment:

Under Water Coconut said...

Amazing theory! Thank you for the informative post. Emperor Clubs is an Online Casino in Malaysia that offers more than just casino games. We offer more than 100 Slot Games Malaysia that really can help reduce stress, have fun as well as refreshing your mind.