I am not very experienced with Maple (v7). I am trying to ANIMATE drawing an (x, f(x) ) function where for each iteration I would like to draw more of the function, i.e, incrementing x for each step animation step.
For example, I would like to plot
f:= t -> exp(-t/100)*cos(t); plot(f(t),t=0..600,numpoints=400);
so that each stage of the animation more points are included. I would hope that the plot gives the impression that data points are being acquired and plotted with time. This is for some illustrations I have in mind.
with(plots): display([seq(plot(f(t),t=0..20*j, numpoints=3*j), j=1..30)], insequence=true);
I discuss this type of animation in my book "Computing with Maple"; see http://centaur.maths.qmul.ac.uk/CwM/ for details.
I suggest you take a look at the cardioid animation under "Graphics examples" on that web page. If that does essentially what you want, then you might like to download the solutions to the exercises for Chapter 3, which are available as a Maple 6 worksheet under "Exercise solutions".
(Of course, I would also encourage you to buy the book!)
This worksheet also runs in Maple 7. (In fact, I have just fixed a problem in it caused by the fact that Maple 7 will not accept a zero-length parametric curve, whereas Maple 6 would.)
The following is quite short and will give you what you need:
f:= t -> exp(-t/100)*cos(t); nf := 11: plots[display]([ seq( plot(f(t),t=0..(i-1)/(nf-1)*600+1e-15, numpoints=max(2,trunc(1+(i-1)/(nf-1)*400))), i=1..nf) ],insequence=true);
In the above ’nf’ is the number of frames, and can be adjusted to suit - the 600 is the last
time value, and the 400 is the number of points in the last frame - notice, they are defined as
ratios of the final values in terms of '(i-1)/(nf-1)'
.
This can be made more efficient, but it is much less elegant.
plots[animate]( `if`(t<x, f(t), undefined) ,t= 0..600 ,x= 0..600 ,numpoints= 400 ,frames= 100 );
Of course, you can change the ranges and the number of frames to whatever you want.
Here is another solution. This one works much, much faster and gives a smoother animation, but it is more difficult to understand for a new user.
TracePlot:= proc(P::specfunc(anything, PLOT)) local A,C,C0,Cn,Pn,np,chunk,fr,f; fr:= 16; # Defaukt number of frames hasoption([args[2..-1]], 'frames', 'fr'); C:= op(1,P); C0:= op(0,C); A:= op(1,C); Cn:= op(2..-1,C); Pn:= op(2..-1,P); np:= nops(A); chunk:= np/fr; PLOT(ANIMATE(seq([C0(A[1..trunc(chunk*f)], Cn), Pn], f= 0..fr))) end proc: And call it as: TracePlot( plot(exp(-t/100)*cos(t), t= 0..100, numpoints= 400) ,frames= 100 );
May-be animatecurve( .... ) is the function you need ? (after with(plots) )