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
]