Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write down the python code and screen capture the results. Thank you! Q1In this question, you will use Python to approximate the function f(x)
Please write down the python code and screen capture the results. Thank you!
Q1In this question, you will use Python to approximate the function f(x) = e4* using Taylor's approximation. + t t 1. Compute the forth order Taylor's approximation of f(x) around x = 0. (Calculate the Taylor's expansion on the paper) 2. In Python, generate an array of 50 equally-spaced numbers between 0 and 0.5 and name it X. 3. For every point in X, plot f(x) and its oth order, ist order, 2nd order, 3rd order and 4th order Taylor's approximations around xi = 0. See the hint at the end of the question.- Include the plot in your report. 4. What will happen as the order of approximation increases? - 5. For every point in X, plot the percentage of the absolute value of the true relative error of the oth order, 1st order, 2nd order, 3rd order and 4th order Taylor's approximations of f(x) around xi = 0. t Include the plot in your report. + 6. What will happen to the error as x increases? - t Include your code in your report. Hint: 1-you can compute and plot e2* using the following commands:- import numpy as np + import matplotlib.pyplot as plt- x=np.linspace(0.01, 0.5, 50) y=np.exp(2*x) # multiplies each element of x by 2 and computes the exponential of the result. plt.plot(x, y, label = "f(x)") #plots y as a function of x and labels it as f(x)- plt.legend #plots the label plt.figure #creates a new figure 2- you can compute using the following command:- a) v2= np.power(x, 2)/ np.math.factorial (2)#raises each element of x to the power of 2 and divides the result by 2! 3-Calculate each term in Taylor's approximation using the command above. Then, sum up the terms to compute the Taylor's approximationStep 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