function w = Tapprox
%MATLAB routine for visualizing Taylor approximations
%Created by Winfried Just, department of Mathematics, Ohio University
%Last modified: January 29, 2003
syms x
disp(' ')
input('Enter the formula for your function. \n');
f = ans
g = f;
disp(' ')
input('Enter the value of a. \n');
a = ans
P = subs(f , a);
disp(' ')
input('Enter the left endpoint of your interval. \n');
left = ans
disp(' ')
input('Enter the right endpoint of your interval. \n');
right = ans
disp(' ')
input('Enter the lower limit of the y-axis. \n');
lower = ans
disp(' ')
input('Enter the upper limit of the y-axis. \n');
upper = ans
n = 1;
while 0 < 1
disp(' ')
disp('Hit ENTER to continue of Ctrl^C to quit')
pause
disp('The degree of the Taylor polynomial is: ')
disp(n)
hold off
ezplot(f, [left , right])
g = diff(g)/n;
P = P + subs(g, a)*(x - a)^n;
hold on
ezplot(P, [left , right])
axis([left right lower upper])
n = n + 1;
end