So I am trying to animate an elastic collision, but I have a problem with the ruler when using Manipulatefunction:

S1i[t_, V1i_] := 0.2 + t*V1i;
S2i[t_, V2i_] := 0.8 + t*V2i;
ts := (0.6 - r1 - r2)/(V1ie - V2ie);
y = 0.4;
r1 = 0.06;
r2 = 0.06;
V1ie = 0.4;
V2ie = 0.1;
xy[t_] := {S1i[t, V1ie], y};
zy[t_] := {S2i[t, V2ie], y};
traj1 := Table[xy, {t, 0, ts, 0.1}];
traj2 := Table[zy, {t, 0, ts, 0.1}];
 Show[ListPlot[traj1], ListPlot[traj2], ListPlot[traj3], 
  {Black, Circle[xy[t], r1], Red, Circle[zy[t], r2]}],
  AspectRatio -> Automatic], {t, 0, 10}]

My question is, why doesn't the movement of the circles stop at ts when ts<10?. To make it more clear, ts is the time of the impact.

  • 1
    $\begingroup$ I think traj{1,4} should use "=" not ":=". Also, the Manipulate doesn't evaluate for me. If I cut it off after the "ti", then I get something that shows circles moving as the value of ti changes. Manipulate[ Show[ListPlot[traj1], ListPlot[traj2], Graphics[{Black, Circle[xy[ti], r1], Red, Circle[zy[ti], r2]}], AspectRatio -> Automatic], {ti, 0, 15}] $\endgroup$ – Mark R Feb 7 at 18:25
  • $\begingroup$ It also looks like the traj1, etc. should have xy[t], right? Finally, I'm not seeing values for m1, m2, V1i, V2i to make the S1f and S2f evaluate. $\endgroup$ – Mark R Feb 7 at 18:32
  • $\begingroup$ What are traj3 and traj4? Not seeing their definition. $\endgroup$ – MikeY Feb 7 at 19:49
  • $\begingroup$ Crossposted here. $\endgroup$ – Rohit Namjoshi Feb 8 at 3:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.