Question: Plotting a function and its third order taylor polynomial

I want to plot my function f(x)=sin(e^x +1) and its third order taylor polynomial on the same graph. My code so far (which is giving me an error when I try to define i) is:

f:=x->sin(exp(x)+1);

with(Student[NumericalAnalysis]):

g:=TaylorPolynomial(f(x),x,order=3);

unapply(g,x);

h:=plot(f,0..3,-2..2,color=blue);

i:=plot(g,0..3,-2..2,color=red);

with(plots):

display({h,i},axes=boxed,title=`The function f and its Third Order Taylor Polynomial`);

 

Thanks.

 

Please Wait...