On Fri, 2008-09-12 at 00:24 +0200, Mario Rodriguez wrote:
> 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
>
Thanks Mario, I got the animated gif to work, and look the way I want
it.
I still do not understand why the plot2d effort I tried has issues. The
screen animation you gave also produced some error messages I can not
eliminate and I could not get control of the speed of the animation. A
delay = 300 did not help. The animated gif worked nicely with the delay
and from the documentation I am guessing that the delay will not work
with the screen animation.
However, I do have a working version. Thanks!
Bob
--
Dr. Robert J. Jerrard, Professor of Mathematics,
Concordia University College of Alberta,
7128 Ada Blvd., Edmonton, Alberta, T5B 4E4, Canada.
Phone: (780) 479-9291, Fax: (780) 474-1933.