Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

% Write a program to solve t aylor series expan sion from zero to third % order

ID: 3550305 • Letter: #

Question

% Write a program to solve taylor series expansion from zero to third

% order to predict f(3) for: f(x)= 25x^3+ 6x^2 - 7x-88

% Display results in array

x= 1;

z= 3;

h= z-x;

n(1)= 1;

f_n(1)= 25* x^(3)- 6*x^(2)+7*x- 88;

f_n(2)= 75* x^(2)- 12*x^(1)+7;

f_n(3)= 150*x-12;

f_n(4)= 150;

exact = 25*3^(3)-6*3^(2)+7*3-88;

array=0;

for i=1:4

    Taylor=(f_n(i)/ factorial(i-1))*(h^(i-1));

    n(i+1)= Taylor + n(i);

    error= ((exact- n(i+1))/ (exact))*100;

    approx= abs((n(i+1)-n(i))/n(i+1))* 100 ;       

end

L=[f_n() n(i+1) error];

fprintf ('  Function Value       Exact Value       True Percent Error ');

fprintf ('  %4.0f                %4.0f              %4.0f n',L);

disp (approx)


Problem: not all the results are displaying, please help.

Explanation / Answer

Check this: Errors corrected. Please ask if anything you need.