Maclaurin and Taylor Pollynomials
tan(x), esp(x), ln(x)
| > | with(plots): | 
Warning, the name changecoords has been redefined
tan(x)
| > | evalf(tan(0.2)); | 
| > | evalf(0.2+0.2^3/3); | 
| > | evalf(tan(Pi/4)); | 
| > | evalf(Pi/4+(Pi/4)^3/3); | 
| > | Order:=10; | 
| > | t:=taylor(tan(x),x=0); | 
Convert to a polynomial and then a function.
| > | p:=convert(t,polynom); | 
| > | f:=p; | 
| > | eval(f,x=Pi/4); | 
| > | evalf(%); | 
Here I graph tan(x) and the third and ninth Maclaurin polynomials.
| > | P3:=plot(x+x^3/3,x=-Pi/2..Pi/2,y=-10..10,thickness=3,color=blue,labels=[x,y]): | 
| > | P9:=plot(f,x=-Pi/2..Pi/2,y=-10..10,thickness=3,color=green,labels=[x,y]): | 
| > | TanGraph:=plot(tan(x),x=-Pi/2..Pi/2,y=-10..10,thickness=3,color=red,labels=[x,y]): | 
| > | display(P3,P9,TanGraph); | 
Construct and graph the tenth Maclaurin polynomial for exp(x).
| > | Order:=11; | 
| > | te10:=taylor(exp(x),x=0); | 
| > | pe10:=convert(te10,polynom); | 
| > | pe10Graph:=plot(pe10,x=-10..10,y=-10..10000,thickness=3,color=blue,labels=[x,y]): | 
| > | ExpGraph:=plot(exp(x),x=-10..10,y=-10..10000,thickness=3,color=red,labels=[x,y]): | 
| > | display(pe10Graph,ExpGraph); | 
Below we see exp(2) being approximated by 10th and 20th Maclaurin polynomials.
| > | f:=pe10; | 
| > | eval(f,x=2); | 
| > | evalf(%); | 
| > | evalf(exp(2)); | 
| > | Order:=21; | 
| > | t20:=taylor(exp(x),x=0); | 
| > | pe20:=convert(t20,polynom); | 
| > | f:=pe20; | 
| > | eval(f,x=2); | 
| > | evalf(%); | 
| > | evalf(exp(2)); | 
Here I graph ln(x) and the 10th Taylor polynomial for ln(x) centered at 1 and approximate ln(1.2) using the 10th Taylor polynomial centered at 1.
| > | Order:=11; | 
| > | tln10:=taylor(ln(x),x=1); | 
| > | pln10:=convert(tln10,polynom); | 
| > | lnGraph:=plot(ln(x),x=0..2,thickness=3,color=red,labels=[x,y]): | 
| > | pln10Graph:=plot(pln10,x=0..2,thickness=3,color=blue,labels=[x,y]): | 
| > | display(lnGraph,pln10Graph); | 
| > | fln10:=pln10; | 
| > | eval(fln10,x=1.2); | 
| > | eval(ln(1.2)); | 
| > |