Question: In python: In the freefall example we used smaller time steps to decrease the truncation error in our Euler approximation. Another way to decrease approximation
In python:
In the freefall example we used smaller time steps to decrease the truncation error in our Euler approximation. Another way to decrease approximation error is to continue expanding the Taylor series. Consider the function f(x)
()=^=1++^2/2!+^3/3!+^4/4!+...
We can approximate ^ as 1+ (first order), 1++^2/2 (second order), and so on each higher order results in smaller error.
a. Use the given exptaylor function to approximate the value of exp(1) with a second-order Taylor series expansion. What is the relative error compared to np.exp(1)?
b. Time the solution for a second-order Taylor series and a tenth-order Taylor series. How long would a 100,000-order series take (approximate this, you don't have to run it)
c. Plot the relative error as a function of the Taylor series expansion order from first order upwards. (Hint: use method (4) in the comparison methods from the "Truncation and roundoff error accumulation in log-log plot" figure)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
