Estimating e

For this program we want to estimate Euler’s number, giving the user the control of how many decimals are to be exact. 

The source code of the program is here in GitHub

What it does is simply ask the user for the number of decimals as an argument to the function calculate_e.

The function calculate_e solves the formula for the infinte series of the euler’s number. For this another function of factorial is defined for the part of the denominator.

Originally the for cycle would repeat the precision times; but after some runs I started seeing that you had three numbers less than the one we asked, that’s why we have that +4 in the range of the for loop.

Then the function just does the summatory of the values that it has calculated in order to estimate the value of e.

There is note in the GitHub commit, where I explain that I have found that some times it appears that it has calcualted more decimals than you had asked, and I have found that there are some values that may appear so I state there that the number typed by the user are the numbers that are sure to be exact to the Euler’s number.

This is my of my  

CC BY 4.0 Estimating e by Manuel Lepe is licensed under a Creative Commons Attribution 4.0 International License.

Comments are closed.