File: depart\math\maple\animate.mws Date: 9-jun-1999 By: bob jantzenplottools in animationThe plottools package has some nice commands like circle, ellipse, rotate, etc. These can be used in animations. Here are a couple examples.Maple User Group MessageFrom: SMTP%"maple-list@daisy.uwaterloo.ca" 16-OCT-1997 18:46:48.99
Subj: [MUG] Re: plottools in animations
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Wed, 8 Oct 97 17:35:37 -0700
From: Robert Israel <israel@math.ubc.ca>
To: maple-list@daisy.uwaterloo.ca
Subject: plottools in animations
Manuel Ruiz Delgado <mrd@faia.upm.es> wrote:
| Is there a way to use several plottools together in an animation?
| I can do:
| with(plottools):with(plots):
| c:=disk([t/10,0],0.2,color=red) $t=1..10:
| display(c,insequence=true);
| But I cannot show two or more tools at the same time, e.g., a disk and an
| arrow, or mix them with an animation.
Yes, you can. All you have to do is build a list of frames, and display
it with insequence=true. Each frame can itself be the result of a
display command (with out the insequence=true), and thus it can combine
whatever plot elements you wish.
Here, for example, is a cute animation where each frame has two disks and
some text. It's best viewed in "continuous" mode.
> frame:= theta -> display([
ellipse([cos(theta), 0], sin(theta)/(1-.2*sin(theta)),1/(1-.2*sin(theta)),
style=patch,filled=true, color=red),
ellipse([-cos(theta),0], sin(theta)/(1+.2*sin(theta)),1/(1+.2*sin(theta)),
style=patchnogrid,filled=true,color=blue),
textplot([0,1.3,`q`],font= [SYMBOL,12],align={LEFT,BOTTOM}),
textplot([0,1.3,sprintf(` = %4.2f`,evalf(theta))], font=[HELVETICA,10],
align={RIGHT,BOTTOM}) ]):
> display([seq(frame((n+.5)*Pi/10),n=0 .. 9)], insequence=true,
scaling=constrained, axes=none);
Robert Israel israel@math.ubc.ca
Department of Mathematics (604) 822-3629
University of British Columbia fax 822-6074
Vancouver, BC, Canada V6T 1Y4
-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-=*=-
Date: Thu, 09 Oct 1997 09:24:29 +0100
To: maple-list@daisy.uwaterloo.ca
From: Stanley J Houghton <S.J.Houghton@Bradford.ac.uk>
Subject: plottools in animations
Manuel
You can use nested calls to display and seq for your sequence to acheive
the desired result. I use it all the time to include text on animations
(eg cycle number, etc).
Try
with(plottools):with(plots):
> display([seq(display([
> disk([t/10,0],0.2,color=red),
> disk([(10-t)/10,0],0.1,color=green)
> ]),t=1..10)],insequence=true);
note that strictly according to the definition, the first parameter should
be a list or set of the desired frames (not simply a sequence). However, a
sequence seems to work too as your example proves!
Hope it helps.
Stanley Houghtonwith(plottools): with(plots):
frame:= theta -> display([
ellipse([cos(theta), 0], sin(theta)/(1-.2*sin(theta)),1/(1-.2*sin(theta)),
style=patch,filled=true, color=red),
ellipse([-cos(theta),0], sin(theta)/(1+.2*sin(theta)),1/(1+.2*sin(theta)),
style=patchnogrid,filled=true,color=blue),
textplot([0,1.3,`q`],font= [SYMBOL,12],align={LEFT,BOTTOM}),
### WARNING: sprintf now outputs strings; nprintf can be used if names are wanted
textplot([0,1.3,sprintf(` = %4.2f`,evalf(theta))], font=[HELVETICA,10],
align={RIGHT,BOTTOM}) ]):display([seq(frame((n+.5)*Pi/10),n=0 .. 9)], insequence=true,
scaling=constrained, axes=none);
display([seq(display([
disk([t/10,0],0.2,color=red),
disk([(10-t)/10,0],0.1,color=green)
]),t=1..10)],insequence=true);
another maple user group messageaa := display(
[circle([1,2],k,color=red),
rectangle([-2,2],[2,-k],color=blue)]) $ k=0..4:
display([aa],insequence=true);
another related MAPLE user group message: order of plotslater. see the example.restart:
with(plots):
with(plottools):
p1:=plot(x^2,x=-1..2,thickness=5,color=red):
p2:=disk([1,1],0.2,color=black):
P1:=display([p1,p2]): P1;
P2:=display([p2,p1]): P2;
p3:=disk([1.1,1],0.2,color=blue):
display([p2,p3]);
display([p3,p2]);more MUGrestart:with(plottools): with(plots):
plt1:=n->plot([0,sin(n*x)],x=0..2*Pi,color=[grey,red]):
plt2:=n->plot([0,cos(n*x)],x=0..2*Pi,color=[grey,blue]):
### WARNING: calls to `translate` from the `polytools` package should be replaced by polytools[translate]
plt:=n->display(plt1(n),translate(plt2(n),0,2.5)):
display(seq(plt(5/20*i),i=1..20),insequence=true);
LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUkjbWlHRiQ2JVEhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0Yn