taylor_cosine
> t:=taylor(cos(x),x=0,5+1); Sets up the Taylor series in a formal way.
> P5:=convert(t,polynom); Converts it to a polynomial.
> P1:=convert(taylor(cos(x),x=0,2),polynom); First order approximation.
> P2:=convert(taylor(cos(x),x=0,3),polynom); Second order approximation.
> plot({cos(x),P1,P2,P5},x=-6..6,y=-1.5..1.5); Plot all four together.
> P10:=convert(taylor(cos(x),x=0,11),polynom); Tenth order approximation.
> plot({cos(x),P10},x=-6..6,y=-1.5..1.5);