Fancy1.mws


parametric plot

animation - animating two items together - animating parametric plots (monkey-hunter)

do multiple plots on the same graph

plotting multiple parametric plots using a loop

3-D plot (simple example)

sum


This is a basic parametric plot: x=cos(t), y=sin(t), for t from 0..2 Pi

Exercise : make a plot of an ellipse with a 2:1 x:y ratio.

Here is a template for animating a simple function of x and t :

Note that you have to click on the graph, then use the player controls to run the animation. Turning on 'balloon help' under Help will make understanding the controls easier!

Exercise: using this basic plan, create an animation of a wave traveling in the +x direction y=A cos(kx-wt)

Here is a way to make multiple plots on the same graph. The first two lines 'save up' one plot each. Notice the colons at the end of the line to suppress output on h and j.
Then the 'display' plots them both.

The same idea can be applied to animations.


Next we illustrate using parametric plots in animations. The following lines were designed as a monkey-hunter template. Students need to first make the ball hit the monkey with no gravity turned on. Then they must predict what will happen when gravity is turned on for both projectile and target, and after that change the Maple code to make it happen.


The idea of 'saving up' and displaying can be automated in a loop. Here are several offset circles, each a parametric plot, all done at once.


Here is an example of a plot3D command.
It plots functions of x and y.

plot3d(100*sin(x*y)^2,x=-1..1,y=-Pi..Pi,view=-200..200,grid=[40,40]);

Click on this plot and note the menu bar at the top. You can grab the image with the mouse and reorient the view. Then click the red 'R' box to render the revised image. You can also click for various forms of axes to be plotted, and for various styles of plot. To get a new plot, click the red 'R' box at the top to render the new image.

It is worth playing with these controls on the top bar for a few minutes to see what they do to 3D plots.

The sum command is a very convenient one in certain situations. Here is an example.


End of Fancy1.mws

Fancy1.mws

parametric plot animation plot multiple functions on the same graph

plotting multiple parametric plots using a loop

3-D plot (simple example)

sum

> restart; with(plots):

basic parametric plot: x=cos(t), y=sin(t), for t from 0..2 Pi

> plot([cos(t),sin(t),t=0..2*Pi]); > Exercise : make a plot of an ellipse with a 2:1 x:y ratio. > Here is a template for animating a simple function of x and t : > animate(t*cos(x),x=-3..3,t=0..1,frames=20,numpoints=50,color=blue); > Note that you have to click on the graph, then use the player controls to run the animation. Turning on 'balloon help' under Help will make understanding the controls easier!

Exercise: Using this basic plan, create an animation of a wave traveling in the +x direction y=A cos(kx-wt) > Here is a way to make multiple plots on the same graph. The first two lines 'save up' one plot each. Notice the colons at the end of the line to suppress output on h and j. Then the 'display' plots them both. > > h:=plot(x^2,x=0..6,color=blue): > j:=plot(15-3*x,x=0..6,color=red): > display({h,j},title=`two functions on the same graph`); > The same idea can be applied to animations. > > c:=animate(cos(5*x-3*t),x=-3..3,t=0..2,frames=20,color=blue): > d:=animate(cos(5*x+3*t),x=-3..3,t=0..2,frames=20,color=red): > display({c,d}); (Click on the animation and use the 'Play' buttton (black triangle) to run it.)

Turning on 'balloon help' will help you to understand the animation player controls!

Next we illustrate using parametric plots in animations. The following lines were designed as a monkey-hunter template. Students need to first make the ball hit the monkey with no gravity turned on. Then they must predict what will happen when gravity is turned on for both projectile and target, and after that change the Maple code to make it happen.

Here is a parametric plot for a circle of radius 0.2, centered at x=a, y=b). > circ:=[0.2*cos(theta)+a,0.2*sin(theta)+b,theta=0..2*Pi]; > plot(subs(a=5,b=3,circ)); # parametric plot of a circle Now plot the projectile at the origin and target on the same plot, to 1:1 scale > plot({subs(a=0,b=0,circ),subs(a=5,b=3,circ)},color=black,scaling=constrained); Now for the animation command, to illustrate time duration and number of frames > animate({subs(a=10*t,b=8*t,circ),subs(a=5,b=3,circ)},t=0..1/2,frames=10,color=black,scaling=constrained); (Click on the animation and use the 'Play' buttton (black triangle) to run it.) >

The idea of 'saving up' and displaying can be automated in a loop. Here are several offset circles, each a parametric plot, all done at once. > > N:=20;radius:=20; > for k from 1 to N do > circ.k:=[k/5+radius*cos(t),2*k+radius*sin(t),t=-Pi..Pi]: > od: > plot({circ.(1..N)},color=black,title=`wind speed increases with height`);

Here is an example of a plot3D command. It plots functions of x and y plot3d(100*sin(x*y)^2,x=-1..1,y=-Pi..Pi,view=-200..200,grid=[40,40]); > plot3d(100*sin(x*y)^2,x=-1..1,y=-Pi..Pi,view=-200..200,grid=[40,40]); > > plot3d(100*sin(x*y)^2,x=-1..1,y=-Pi..Pi,view=-200..200,grid=[40,40]); Click on this plot and note the menu bar at the top. You can grab the image with the mouse and reorient the view. Then click the red 'R' box to render the revised image. You can also click for various forms of axes to be plotted, and for various styles of plot. To get a new plot, click the red 'R' box at the top to render the new image.

It is worth playing with these for a few minutes to see what they do to 3D plots.

The sum command is a very convenient one in certain situations. Here is an example. > k:='k'; # free up k > y:=sum(k^3,k=1..m); > simplify(y); >