Taylorovy polynomy zadané funkce: exp(x) 

> # initialize
restart;
with(plots);
f:=exp(x);
# nmax is the maximum approximation order (the order of the Taylor polynomial + 1)
nmax:=7;
setoptions(thickness=2);
 

 

 

[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
[animate, animate3d, animatecurve, arrow, changecoords, complexplot, complexplot3d, conformal, conformal3d, contourplot, contourplot3d, coordplot, coordplot3d, densityplot, display, dualaxisplot, fiel...
exp(x)
7 (1)
 

> # initialize the lists T and R
T:=[seq(0,i=1..nmax+1)];
R:=T;
# now calculate the Taylor polynomials
for n from 1 to nmax do
T[n]:=convert(taylor(f,x,n),polynom);
R[n]:=f-T[n];
end do;
n:='n';
 

                               
[0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0]
1
`+`(exp(x), `-`(1))
`+`(1, x)
`+`(exp(x), `-`(1), `-`(x))
`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))))
`+`(exp(x), `-`(1), `-`(x), `-`(`*`(`/`(1, 2), `*`(`^`(x, 2)))))
`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 6), `*`(`^`(x, 3))))
`+`(exp(x), `-`(1), `-`(x), `-`(`*`(`/`(1, 2), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))))
`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 24), `*`(`^`(x, 4))))
`+`(exp(x), `-`(1), `-`(x), `-`(`*`(`/`(1, 2), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `-`(`*`(`/`(1, 24), `*`(`^`(x, 4)))))
`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 24), `*`(`^`(x, 4))), `*`(`/`(1, 120), `*`(`^`(x, 5))))
`+`(exp(x), `-`(1), `-`(x), `-`(`*`(`/`(1, 2), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `-`(`*`(`/`(1, 24), `*`(`^`(x, 4)))), `-`(`*`(`/`(1, 120), `*`(`^`(x, 5)))))
`+`(1, x, `*`(`/`(1, 2), `*`(`^`(x, 2))), `*`(`/`(1, 6), `*`(`^`(x, 3))), `*`(`/`(1, 24), `*`(`^`(x, 4))), `*`(`/`(1, 120), `*`(`^`(x, 5))), `*`(`/`(1, 720), `*`(`^`(x, 6))))
`+`(exp(x), `-`(1), `-`(x), `-`(`*`(`/`(1, 2), `*`(`^`(x, 2)))), `-`(`*`(`/`(1, 6), `*`(`^`(x, 3)))), `-`(`*`(`/`(1, 24), `*`(`^`(x, 4)))), `-`(`*`(`/`(1, 120), `*`(`^`(x, 5)))), `-`(`*`(`/`(1, 720), ...
n (2)
 

Graf funkce a jejího n-tého Taylorova polynomu 

> # n goes from 0 to nmax-1 to represent the order of the Taylor polynomial
plots[animate](plot,[[f,T[n+1]],x=-5..5,y=-10..10],n=[seq(i,i=0..nmax-1)]);
 

Plot_2d
 

Graf zbytku po n-tém Taylorově polynomu 

> animate(plot,[R[n+1],x=-5..5,y=-10..10],n=[seq(i,i=0..nmax-1)]);
 

Plot_2d
 

>