Animation points

Hello,
I have animation trajectory of motion. I have displayed as line it. But I need displayed as point, which will move.

How to do it?
Thank you. I am sorry for my  English language.
= diff(x(t), t) = -(x(t)-y(t))/sqrt(x(t)^2+y(t)^2): vy := diff(y(t), t) = -(x(t)+y(t))/sqrt(x(t)^2+y(t)^2):
animate(DEplot, [sys, [x(t), y(t)], t = 0 .. T, x = -1 .. 1, y = -1 .. 1, init, stepsize = 0.1e-1, thickness = 1, arrows = none, title = "Animation", linecolor = [red, blue, gold, black]], T = 0.1e-2 .. sqrt(2));

Sorry, once

Sorry, once more:

restart;

with(DEtools):with(plots):

vx := diff(x(t), t) = -(x(t)-y(t))/sqrt(x(t)^2+y(t)^2);

vy := diff(y(t), t) = -(x(t)+y(t))/sqrt(x(t)^2+y(t)^2);

sys := {vx, vy}:

init := [[x(0) = 1, y(0) = 1], [x(0) = 1, y(0) = -1], [x(0) = -1, y(0) = -1], [x(0) = -1, y(0) = 1]]:

animate(DEplot, [sys, [x(t), y(t)], t = 0 .. T, x = -1 .. 1, y = -1 .. 1, init, stepsize = 0.1e-1, thickness = 1, arrows = none, title = "Animace", linecolor = [red, blue, gold, black]], T = 0.1e-2 .. sqrt(2));

 

Robert Israel's picture

animation of points

S:= [seq(subs(dsolve(sys union {op(v)}, numeric, output=listprocedure),[x(t),y(t)]),v=init)];
display([seq](pointplot(S(sqrt(2)*j/50),colour=[red,blue,gold,black]),j=1..50),insequence=true);

OK, thank you. And when I

OK, thank you.

And when I want display trajectory as line and as point in one graph?

 

Robert Israel's picture

Combined

display([seq](
 display([pointplot(S(j*sqrt(2)/50),colour=[red,blue,gold,black]),
 DEplot(sys, [x(t), y(t)], t = 0 .. j*sqrt(2)/50, x = -1 .. 1, y = -1 .. 1, init,  
  thickness = 1, arrows = none, title = sprintf("Animace\n T = %4.4f",j*sqrt(2)/50), 
  linecolor = [red, blue, gold, black])]),
 j=1..50),insequence=true);

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
}