List Archives > 
Maple User Group List Archive > 
Archive by date > 
This Month By Date > 
This Month By Topic
[MUG] Animation of drawing a function point-by-point
| [MUG] Animation of drawing a function point-by-point |
|
Author: Sandy Yates
Posted: Thu, 31 Oct 2002 21:24:15 -0000
|
>> From: "Sandy Yates" "S.Yates"
Dear MUG,
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.
Can anybody suggest a neat way of doing this?
Many thank,
Sandy
Department of Chemistry
UMIST
Sackville Street
Manchester M60 1QD
United Kingdom
|
| [MUG] Re: Animation of drawing a function point-by-point |
|
Author: Maple User Group
Posted: Mon, 4 Nov 2002 10:23:49 -0500 (
|
>> From: Maple User Group "maple_gr"
From: "Sandy Yates" "S.Yates"
| 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.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 1 Nov 2002 08:46:35 -0800 (PST)
From: Robert Israel "israel"
To: "maple-list"
Subject: Animation of drawing a function point-by-point
> with(plots):
display([seq(plot(f(t),t=0..20*j, numpoints=3*j), j=1..30)],
insequence=true);
Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
From: "Dr Francis J. Wright" "F.J.Wright"
To: "S.Yates"
Subject: Animation of drawing a function point-by-point
Date: Fri, 1 Nov 2002 17:14:43 -0000
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.)
Francis
---
Dr Francis J. Wright
School of Mathematical Sciences, Queen Mary
University of London, Mile End Road, London E1 4NS, UK
Tel: 020 7882 5453 (direct); Fax: 020 8981 9587 (dept.)
"F.J.Wright" http://centaur.maths.qmul.ac.uk/
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 01 Nov 2002 09:42:23 -0800
To: "maple-list"
From: David Harrington "dharr"
Subject: Animation of drawing a function point-by-point
A little crude because the moving point is connected to the axis (discont =
true seems not to work here):
with(plots):animate(
sin(x)*Heaviside(t-x),x=0..10,t=0..10,frames=50,numpoints=100);
Your function is harder to do because of overflow problems
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 01 Nov 2002 11:09:11 -0800
From: Allan Wittkopf "awittkop"
Subject: Animation of drawing a function point-by-point
To: "maple-list"
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.
- Allan
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Fri, 1 Nov 2002 15:30:26 -0500 (EST)
From: Denis Sevee "dsevee"
To: "maple-list" "maple-list"
Subject: Animation of drawing a function point-by-point
Here's one way:
>f:=t->sin(t):
>for i to 10 do p[i]:=plot(f(t),t=0...2*i,color=black) od:
>plots[display]([seq(p[i],i=1..10)], insequence=true);
The second line creates the frames of the animation (in this case 10
frames). The third line displays them as an animation.
Denis Sevee
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sat, 2 Nov 2002 03:40:38 -0500 (EST)
From: Carl Devore "devore"
To: "maple-list"
Subject: Animation of drawing a function point-by-point
The range 0..600 seems much too big to do justice to this graph, but if
that's what you really want:
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.
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Sun, 3 Nov 2002 07:04:15 -0500 (EST)
From: Carl Devore "devore"
To: "maple-list"
Subject: Animation of drawing a function point-by-point
Here is another solution in addition to the one that I just posted. 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
);
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Mon, 04 Nov 2002 11:04:01 +0100
From: Koch-Beuttenmueller "Heike.Koch-Beuttenmueller"
To: "maple-list"
Subject: Animation of drawing a function point-by-point
May-be animatecurve( .... ) is the function you need ? (after
with(plots) )
Best regards,
Heike Koch-Beuttenmueller
|
Previous by date: [MUG] plotsetup in maplets!, Avelino Sousa
Next by date: [MUG] Re: filter transformations -- basic algebraic manipulations, Maple User Group
Previous thread: [MUG] filter transformations -- basic algebraic manipulations, Ben Nevile
Next thread: [MUG] filter transformations -- basic algebraic manipulations, Ben Nevile
|