Untitled

Animation Example Using Maple


This shows how to animate the solution to a mass-spring system. First we load in some graphics packages. We define a function A(t) that with be our solution. L1 is a graphic object representing the spring. L2 represents the object on the end of the spring. Normally you'd click on the animation image to start it playing. On this web output it just runs as a sequence of GIF images. Play around with this on one of the computers in the Math lab.

> restart;

> with(plots):with(plottools):

> A := t-> 5*sin(t)+3*sin(3*t);

A := proc (t) options operator, arrow; 5*sin(t)+3*sin(3*t) end proc

> L1 := line([0, 10], [0, A(a)], thickness = 4);

L1 := CURVES([[0., 10.], [0., 5.*sin(a)+3.*sin(3.*a)]], THICKNESS(4))

> L2 := line([-1, A(a)], [1, A(a)], thickness = 30, color = green);

L2 := CURVES([[-1., 5.*sin(a)+3.*sin(3.*a)], [1., 5.*sin(a)+3.*sin(3.*a)]], COLOUR(RGB, 0., 1.00000000, 0.), THICKNESS(30))

> A1 := animate(display, [L1, L2], a = 0 .. 10, view = [-2 .. 10, -10 .. 10], frames = 100):

> A2 := animate(plot, [A(t), t = 0 .. a, color = red], a = 0 .. 10, view = [-2 .. 10, -10 .. 10], frames = 100):

> display(A1,A2);

[Plot]

>