for
f(x) = 25*x^3 - 6*x^2 +7*x - 88
using a base point at x = 1
x = 0:0.01: 3.5;
f_x = @(x) 25*x.^3 - 6 * x.^2+7*x -88;
f1_x = @(x) 3* 25*x.^2 - 2* 6 * x.^1+7;
f2_x = @(x) 2* 3* 25*x - 2* 6;
f3_x = @(x) 2* 3* 25;
T_0_1 = f_x(1) * x.^0;
T_1_1 = T_0_1 + f1_x(1) * (x-1).^1;
T_2_1 = T_1_1 + f2_x(1) .* (x-1).^2/2;
T_3_1 = T_2_1 + f3_x(1) * (x-1).^3/6;
hold on
plot(x,f_x(x)) %blue
plot(x, T_0_1, 'r') %red
plot(x, T_1_1, 'm') %magenta
plot(x, T_2_1, 'y') %yellow
%plot(x, T_3_1, 'g') %green
hold off
With the third order Taylor plot hidden, the graph looks like

one can see that the third order taylor exactly follows the original equation. This stands to reason, as it is mentioned in the text that in general, the nth order Taylor series will be exact for an nth order polynomial, and the equation we are approximating has a largest order term of 25x^3, making it 3rd order.
No comments:
Post a Comment