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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started