How to create an animation of particles in Maple?

423 Views Asked by At

Using Maple, I numerically solved some differential equations describing a set of interacting particles. I can plot the trajectories in 3D space, and the output is pretty. But I also need to show the motion of all the particles (animation). How can I do this with Maple ? I'm not an experienced user of Maple and the help system doesn't help me much with this.

For exemple, here's the Maple code to show the trajectories in 3D (of course, that code won't compile on your system since it's just a small part of the whole code) :

plots[odeplot](Trajectory,
    [
        [xA0(t), yA0(t), zA0(t)],
        [xA1(t), yA1(t), zA1(t)],
        [xA2(t), yA2(t), zA2(t)],
        [xB0(t), yB0(t), zB0(t)],
        [xB1(t), yB1(t), zB1(t)],
        [xB2(t), yB2(t), zB2(t)]
    ],
    T1..T2,
    numpoints = 10000, axes = boxed, scaling = constrained,
    thickness = [2, 1, 1, 2, 1, 1],
    color = ["Magenta", "Green", "Blue", "Brown", "Gray", "Cyan"],
    labels = ["X", "Y", "Z"]);

The animation should show the 6 particles as small dots moving in time. The particles should use the same colors as defined in the code above.

Any suggestion on how to achieve this ?

1

There are 1 best solutions below

3
On

I did something like you wish years ago. I hope you can get what you want:

[> with(plots);
  f1 := proc (rho, phi, theta) options operator, arrow; rho*cos(theta)*sin(phi) end proc;
  f2 := proc (rho, phi, theta) options operator, arrow; rho*sin(theta)*sin(phi) end proc;
  f3 := proc (rho, phi, theta) options operator, arrow; rho*cos(phi) end proc;
  s := spacecurve([cos(2*t), sin(2*t), t], t = 0 .. 10, axes = normal, color = red, thickness = 2, numpoints = 200);
  w := animate3d([cos(2*t)+f1(0.3e-1, phi, theta), sin(2*t)+f2(0.3e-1, phi, theta), t+f3(0.3e-1, phi, theta)], phi = -4 .. 4, theta = -4 .. 4, t = 0 .. 10, frames = 50);
  display(s, w);

enter image description here