4.13 Use zero- through third-order Taylor series expansion:s to predict f(3) for
ID: 3168257 • Letter: 4
Question
4.13 Use zero- through third-order Taylor series expansion:s to predict f(3) for f(x) = 25x3-6x2 + 7x-88 using a base point at x = 1 . Compute the true percent relative error for each approximation. 4.16 Use forward and backward difference approximations of O(h) and a centered difference approximation of O(h2) to estimate the first derivative of the function examined in Prob. 4.13. Evaluate the derivative at x = 2 using a step size of h 0.25. Compare your results with the true value of the derivative. Interpret your results on the basis of the remain- der term of the Taylor series expansion.Explanation / Answer
%%%%%%% Matlab code %%%%%%%%
clc;
clear all;
close all;
format short
%%% restoredefaultpath %%%
syms x
f=25*x^3-6*x^2+7*x-88;
h=0.25;
x0=2;
%%% Actual value
f_x_actu=subs(diff(f),x0);
fprintf('True value of derivatives : %f ',f_x_actu);
%%% forword difference approximation
f_xf=(subs(f,x0+h)-subs(f,x0))/h;
fprintf('Forword diffrence approximation : %f ',f_xf);
%%% Backword difference approximation
f_xb=(subs(f,x0)-subs(f,x0-h))/h;
fprintf('Backword diffrence approximation : %f ',f_xb);
%%%% cetral difference approximation
f_xc=(subs(f,x0+h)-subs(f,x0-h))/(2*h);
fprintf('Central diffrence approximation : %f ',f_xc);
OUTPUT:
True value of derivatives : 283.000000
Forword diffrence approximation : 320.562500
Backword diffrence approximation : 248.562500
Central diffrence approximation : 284.562500
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.