Answer the question
In order to leave comments, you need to log in
Solution of the problem of absolutely elastic collision of two balls?
Is there a solution to the problem of absolutely elastic collision of two balls with initial position, velocity vector, radius in the system of linear equations by standard functions (ode45,..)?
Or just a system of linear equations?
Maybe there is an animation of this in MatLab?
Very necessary…
Answer the question
In order to leave comments, you need to log in
I think if the author has not yet seen this article , you should definitely read it. At one time, I wrote code based on it.
Of course, no differential equations.
Plus, it may not immediately become obvious: to perform a truly accurate calculation, the procedure must be more complicated than just performing the calculation immediately after detecting the overlap of two circles on each other, due to the need to split the simulation step ∆t.
The article contains, among other things, the calculation of the distance of the run before the collision, therefore, without focusing on the formulas themselves, I will give a general plan for iterating the simulator (to implement the plan described below, you will need to borrow the procedures for determining the free run distance before the collision and calculating the velocity vectors after the collision):
I use this solution to emulate the movement and impact of fifteen balls (Object Pascal):
for i:=1 to 15 do // просчитываем соударения шаров
for j:=i+1 to 16 do begin
dist:=sqrt(sqr(balls[i].x-balls[j].x)+sqr(balls[i].y-balls[j].y)); //расстояние между центрами шаров
if dist<diametr then begin //если расстояние меньше диаметра, значит есть факт соударения
a:=balls[i].x-balls[j].x; //вспомогательные переменные типа extended
b:=balls[i].y-balls[j].y;
p1:=a*b/sqr(dist);
p2:=sqr(a/dist);
p3:=sqr(b/dist);
d1:=balls[i].dy*p1+balls[i].dx*p2-balls[j].dy*p1-balls[j].dx*p2;
d2:=balls[i].dx*p1+balls[i].dy*p3-balls[j].dx*p1-balls[j].dy*p3;
balls[i].dx:=balls[i].dx-d1; //меняем значение приращения координаты шаров при движении
balls[i].dy:=balls[i].dy-d2;
balls[j].dx:=balls[j].dx+d1;
balls[j].dy:=balls[j].dy+d2;
p3:=(diametr-dist)/2; //при соударении шары всегда "проникают" друг в друга, поэтому раздвигаем их
p1:=p3*(a/dist);
p2:=p3*(b/dist);
balls[i].x:=balls[i].x+p1;
balls[i].y:=balls[i].y+p2;
balls[j].x:=balls[j].x-p1;
balls[j].y:=balls[j].y-p2;
end;
end;
for i:=1 to 15 do
balls[i].x:=balls[i].x+balls[i].dx; //эмулируем движение
balls[i].y:=balls[i].y+balls[i].dy;
end;
For two balls, everything is solved exactly, without any systems of differential equations. Here, for example, uc.jinr.ru/mirea/classmex/gl_mex_5.pdf
Formulas for calculating the elastic collision of particles are given in almost any book on theoretical mechanics. For example, Landau, Lifshitz "Mechanics", p. 62-65, or Yablonsky, "Course of Theoretical Mechanics", vol. 2 p. 284. Differential equations are not required, a school mathematics course is enough
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question