mytaylor.mw

> myplot:=proc(x,f,x0,xmin,xmax,N)
local y;
y:=convert(taylor(f(x),x=x0,N+1),polynom);
plot([y,f(x)],x=xmin..xmax,color=[red,blue],caption=typeset("Degree of Taylor polynomial ",N));
end proc;
 

proc (x, f, x0, xmin, xmax, N) local y; y := convert(taylor(f(x), x = x0, `+`(N, 1)), polynom); plot([y, f(x)], x = xmin .. xmax, color = [red, blue], caption = typeset(
proc (x, f, x0, xmin, xmax, N) local y; y := convert(taylor(f(x), x = x0, `+`(N, 1)), polynom); plot([y, f(x)], x = xmin .. xmax, color = [red, blue], caption = typeset(
proc (x, f, x0, xmin, xmax, N) local y; y := convert(taylor(f(x), x = x0, `+`(N, 1)), polynom); plot([y, f(x)], x = xmin .. xmax, color = [red, blue], caption = typeset(
proc (x, f, x0, xmin, xmax, N) local y; y := convert(taylor(f(x), x = x0, `+`(N, 1)), polynom); plot([y, f(x)], x = xmin .. xmax, color = [red, blue], caption = typeset(
proc (x, f, x0, xmin, xmax, N) local y; y := convert(taylor(f(x), x = x0, `+`(N, 1)), polynom); plot([y, f(x)], x = xmin .. xmax, color = [red, blue], caption = typeset(
 

> myplot(x,exp,0,-1,1,2);
 

Plot_2d
 

> myplot(x,exp,0,-1,1,4);
 

Plot_2d
 

> myplot(x,exp,0,-3,3,4);
 

Plot_2d
 

> myplot(x,sin,0,-Pi,Pi,3);
 

Plot_2d
 

> myplot(x,sin,0,-Pi,Pi,5);
 

Plot_2d
 

> g:=x->cos(x^2)-sin(x^3);
 

proc (x) options operator, arrow; `+`(cos(`*`(`^`(x, 2))), `-`(sin(`*`(`^`(x, 3))))) end proc
 

> myplot(x,g,0,-2,2,4);
 

Plot_2d
 

> myplot(x,g,0,-2,2,8);
 

Plot_2d
 

> myplot(x,g,0,-2,2,3);
 

Plot_2d
 

> with(plots):
 

> L:=[seq(myplot(x,sin,0,-Pi,Pi,2*k+1),k=0..5)]:
 

> display(L,insequence=true);
 

Plot_2d
 

> L1:=[seq(myplot(x,exp,0,-2,2,k),k=0..5)]:
 

> display(L1,insequence=true);
 

Plot_2d
 

> L1:=[seq(myplot(x,exp,1,-2,3,k),k=0..5)]:
 

> display(L1,insequence=true);
 

Plot_2d
 

> L1:=[seq(myplot(x,tan,0.3,-1,1,k),k=0..9)]:
 

> plots:-display(L1,insequence=true);
 

Plot_2d
 

>
 

>