# Non elastic collision?

I am new here and still learning Mathematica in order to make use of it in my studies (physics). I am encountering one "issue". I wish to include non - elastic collision in simulation below: When particle's path intercepts condenser's plate, it should behave like in non elastic collision(dotted line should be "stopped" as in picture. In attachment are my code, current simulation and wanted output. Any help in what I should do and add in code will be highly appreciated! :) P.S. Here's the code:

Manipulate[
Grid[{{
Show[
Graphics[{
Text[Style["+", Large], {25, d/2}],
Text[Style["-", Large], {25, -d/2}],
Arrow[{{-2, 0}, {0, 0}}],
Line[{{0, d/2}, {22, d /2}}],
Line[{{0, -d /2}, {22, -d /2}}]
}],
d1 = d;
ParametricPlot[{v*t*Cos[a],
Piecewise[{
{0, t < 0},
{If[
c == "-", (v*t*Sin[a]) + U q/(2 d m) (t)^2, (v*t*Sin[a]) -
U q/(2 d m)*(t )^2], t > 0}}]}, {t,
0, (v^2*Sin[2*a]/ (U q/(d m )))},
PlotStyle -> {Red, Dashing[Small]}
],
Axes -> {True, True},
AxesOrigin -> {0, 0},
PlotRange -> {{-25, 25}, {-d/2, d/2}},
AspectRatio -> 0.5,
ImageSize -> 1.3 {400, 200}]},
{Text@Grid[{
{"Jačina el. polja " , "=", NumberForm[N[ U / d], {4, 2}] ,
"V/m" },
{"Domet " , "=",
NumberForm[N[ v^2*Sin[2*a]/ (U q/(d m ))], {4, 2}], "m"}},
Alignment -> Right]
}}],
{{d, 2, "Širina kondenzatora (m)"}, 1, 5, Appearance -> {"Labeled"}},
{{U, 50, "Napon na kondenzatoru (V)"}, 10, 100,
Appearance -> "Labeled"},
{{v, 5, "Početna brzina čestice (m/s)"}, 1, 10,
Appearance -> "Labeled"},
{{m, .5, "Masa čestice (kg)"}, .1, 1, Appearance -> "Labeled"},
{{q, 5, "Naelektrisanje čestice (C)"}, 1, 10,
Appearance -> "Labeled"},
{{a, Pi/3, "Upadni ugao"}, 0, 6.28, Appearance -> "Labeled"},
{{c, "+", "Znak naelektrisanja"}, {"+", "-"}}, ControlPlacement -> Top
]


]1[]2

• Welcome. You should post code instead of screenshot of code. By non-elastic (= not a perfect rebound), you mean inelastic (= absolutely no rebound), right? Jan 16, 2018 at 23:24
• Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! Jan 17, 2018 at 0:34
• Thank you @anderstood, I have added a real code. By that I do mean inelastic. Particle should have absolutely no rebound. Jan 17, 2018 at 8:50
• @anderstood ........ Jan 17, 2018 at 15:49
• If I follow correctly you mean this boundary is "absorbing". Jan 17, 2018 at 16:24

Strictly speaking, this is not an answer to you question. But, since you are studying physics, you might consider using NDSolve for this work. The code below describes the trajectory of an object moving inside a chamber, under the influence of it's initial conditions and gravity, with a lossy reflection each time it hits a wall.

eqs = {
x''[t] == 0, y''[t] == -2.1, x'[0] == 1, y'[0] == 5, x[0] == 0,
y[0] == .5,
WhenEvent[x[t] < 0 || x[t] > 1, x'[t] -> -.8 x'[t]],
WhenEvent[y[t] < 0 || y[t] > 1, y'[t] -> -.8 y'[t]]};

sol = NDSolveValue[eqs, {x[t], y[t]}, {t, 0, 10}];

ParametricPlot[sol, {t, 0, 10}, Prolog -> Rectangle[{0, 0}, {1, 1}]]


• WhenEvent works as long as the "coefficient of restitution" (in your code, 0.8) is $>0$. If you set it at 0 as required by the OP, the event will be triggered at each time step and the constraint might be violated. Jan 18, 2018 at 22:10
Manipulate[
Grid[{{Show[
Graphics[{Text[Style["+", Large], {25, d/2}],
Text[Style["-", Large], {25, -d/2}], Arrow[{{-2, 0}, {0, 0}}],
Line[{{0, d/2}, {22, d/2}}], Line[{{0, -d/2}, {22, -d/2}}]}],

Module[{t1, t2},
t1 = t2 /.
Solve[{(v*t2*Sin[a]) - U q/(2 d m)*(t2)^2 == 0, t2 > 0}, t2];
If[t1 === {}, t1 = Infinity, t1 = First[Sort@t1]];
ParametricPlot[{Piecewise[{{v*t*Cos[a], t < t1/2}, {t,
t > t1}}],
Piecewise[{{0,
t < 0}, {If[
c == "-", (v*t*Sin[a]) + U q/(2 d m) (t)^2, (v*t*Sin[a]) -
U q/(2 d m)*(t)^2], 0 < t < t1}, {d/2,
t >= t1/2}}]}, {t, 0, (2 v^2*Sin[2*a]/(U q/(d m)))},
PlotStyle -> {Red, Dashing[Small]}]], Axes -> {True, True},
AxesOrigin -> {0, 0}, PlotRange -> {{-25, 25}, {-d/2, d/2}},
AspectRatio -> 0.5, ImageSize -> 1.3 {400, 200}]}, {Text@
Grid[{{"Jačina el. polja ", "=", NumberForm[N[U/d], {4, 2}],
"V/m"}, {"Domet ", "=",
NumberForm[N[v^2*Sin[2*a]/(U q/(d m))], {4, 2}], "m"}},
Alignment -> Right]}}],
{{d, 5., "Širina kondenzatora (m)"}, 1, 5,
Appearance -> {"Labeled"}}, {{U, 10., "Napon na kondenzatoru (V)"},
10, 100, Appearance -> "Labeled"}, {{v, 9.5,
"Početna brzina čestice (m/s)"}, 1, 10,
Appearance -> "Labeled"}, {{m, .95, "Masa čestice (kg)"}, .1, 1,
Appearance -> "Labeled"}, {{q, 5, "Naelektrisanje čestice (C)"}, 1,
10, Appearance -> "Labeled"}, {{a, Pi/3, "Upadni ugao"}, 0, 6.28,
Appearance -> "Labeled"}, {{c, "+", "Znak naelektrisanja"}, {"+",
"-"}}, ControlPlacement -> Top]


• Thank you very much. This answers my questin but only if there is a "collision with a plate. In other cases I receive something like in the last picture. Jan 18, 2018 at 21:23