Question: Write a functionapproxE(precision)that calculates the value of e using the iterative approximation method where: e = sum of a_i where a_i = 1/i! Example: 3

Write a functionapproxE(precision)that calculates the value of e using the iterative approximation method where: e = sum of a_i where a_i = 1/i!

Example: 3 term approximation is 1/0! + 1/1! + 1/2!

The function uses the input parameterprecisionwhich is a floating point input. The function will iterate as few times as possible to approximate e until its value versus the actual value (math.e) is within theprecisionamount.

The function will thenreturnthe value of e that was approximated and also print out a message of how many iterations were used to calculate the value of e.

For example,approxE(.01)will print out the following message and return the following value of 2.70833333333

The value of e with precision .01 was calculated using 5 iterations. 

This is Python, Thank You!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!