2
$\begingroup$

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 ?

$\endgroup$

1 Answer 1

1
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ I'm unable to get the animation (I'm using Maple 13). Why the [> ? And why the f1, f2 and f3 ? Isn't there a "dot" or ball primitive in Maple ? $\endgroup$
    – Cham
    May 16, 2017 at 13:25
  • $\begingroup$ the command animate3d has been deprecated. We should use the superseding command plots[animate] instead, but I'm still unable to get an animation. $\endgroup$
    – Cham
    May 16, 2017 at 13:34
  • $\begingroup$ It is interesting that I am unable to see what I enclosed above!! :-)) But you can remove [> and I added it because on making the codes real as they appear in a Maple sheet. $\endgroup$
    – Mikasa
    May 18, 2017 at 13:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .