Problem: The number e can be estimated as an infinite series:
e = 1 +( 1/1) +(1/1?2)+(1/1?2?3)......
Write a MATLAB script called estimate_e where a while loop is used to obtain an estimate of e. Use appropriate logic to terminate the while loop when the relative change between estimates (tol) is less than 1×10-6.
Then, make a plot of the residual between your estimate and the more accurate value from Matlab's built-in function (which can be obtained by calling exp(1)) versus the iteration number. Use the function semilogy to plot your results. Repeat for tol = 1×10-9
Question: How does your actual accuracy compare to the relative tolerance you chose?
Can you provide the answer as soon as possible and use basic MATLAB concepts to make this program?