Robert Jerrard escribi?:
> Can anybody help me with the following animation:
>
> f:%e^(-x)*sin(x)$
> movie(n):=
> block([],
> for k:1 thru n step 1 do
> (plot2d([f,taylor(f,x,0,k)],
> [x,-1,5],[y,-1,2],
> [style, [lines,5,1],[lines,2,2]],
> [gnuplot_preamble, concat("set xrange [-1:5];
> set yrange [-1:2];
> set terminal png;\
> set out 'temp/file",k,".png'")])))$
> movie(11);
> system("animate -delay 120 temp/file?.png temp/file??.png");
>
You can try the draw package,
f:%e^(-x)*sin(x)$
load(draw)$
/* screen animation */
movie(n):=
for k:1 thru n step 1 do
draw2d(
color = blue,
explicit(f,x,0,k),
color = red,
explicit(taylor(f,x,0,k),x,0,k),
xrange = [-1,5],
yrange = [-1,2])$
movie(11);
/* animated gif file */
movie2(n):=
apply(
draw,
append(
[terminal = animated_gif, delay = 20],
makelist(
gr2d(
color = blue,
explicit(f,x,0,k),
color = red,
explicit(taylor(f,x,0,k),x,0,k),
xrange = [-1,5],
yrange = [-1,2]),
k, 1, n)))$
movie2(11);
If this is not exactly what you want, you can fine tune the code above.
More info:
http://www.telefonica.net/web2/biomates/maxima/gpdraw/animation
--
Mario Rodriguez