both are from the same question. they\'re just separated by page. Problem 5. Con
ID: 3704788 • Letter: B
Question
both are from the same question. they're just separated by page.
Problem 5. Consider the function f(x) -e- Produce a general formula (without proof) for the degree n Taylor polynomial Po (x) about a = 0 a) b) The exact error of the Taylor polynomial P.(o) is defined Ex) () P.) which is equal to Taylor's remainder term R, (x)Derive an exact expression for the function cr (x) that appears in R (x). Moreover, use MATLAB to graph the- function c,o) in the interval [-33] for n-1and n-3 and verify graphically that c,(x) e[ax]Explanation / Answer
Solution:
code:
X = -3:0.01:3;
C = zeros(size(X));
for n=[1,3]
% For n = 1 and n = 3
for i=1:length(X)
C(i) = c_x(X(i), n);
end
figure;
plot(X, C);
title(['N = ', num2str(n)]);
end
%% Define the n-th order taylor polynomial
function n_poly = taylor_n(x, n)
% Returns the n-th order Taylor Polynomial for f(x) = e^x - 1
n_poly = 0;
for i=1:n
n_poly = n_poly + (x.^i / factorial(i));
end
end
%% Function to determine R_n(x)
function c = c_x(x, n)
% Returns c_x(x) for R_n(x) = f(x) - p_n(x)
p = taylor_n(x, n); % Get the n-th order polynomial
c = log( ((exp(x) - 1 - p) .* factorial(n+1)) ./ (x.^(n+1)) );
if (x == 0)
c = 0; % Explicitly Calculated Using Limits
end
end
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.