0

Goal: I am interested creating a simple gravity simulation and was wondering if it was possible to describe two objects motions through time with percision. All other parameters are known (acceleration, velocity, position, mass, etc.).

Current Approach: I have a 2d plane and every 1/60 seconds the position, velocity, and acceleration of all objects in the system are calculated then updated using simple Newtonian mechanics ($F = ma$, $x = x_0 + v_0t + \frac{1}{2} at^2$, etc.).

Issues: When two objects come very close together the calculated force becomes huge leading to sudden increases in acceleration, velocity, and position. This causes the two particles to suddenly jump away from each other in the following frame and continue on into infinity while their velocities slowly decrease.

Solutions:

  1. When there is a large change in force, decrease the time step.
  2. Calculate initial potential/kinetic energy and ensure that the sum stays approximately constant

Final Thoughts: Maybe I am naïve because I have only recently began to explore physics, but it seems like there must be a way to predict precisely how 2 or more objects will evolve through space. I have heard that Newtonian mechanics can lead to imprecision in calculations like the orbit of Mercury around the sun over time. Is this issue similar or unrelated? Is there a more accurate approach than Newtonian mechanics or would I run into the same timestep issue?

  • As a sidenote: your very last question is completely unrelated to the problems you are encountering. Your problem are numerical errors, whereas the discrepancy between Newtonian prediction and experimental observation of the perihelion precession of Mercury is due to relativistiv effects, that are especially important for Mercury, because he is closest to the sun. – Samuel Mar 21 '23 at 17:11
  • Realized this question has already more or less been answered. A good answer I found – Bryan Turns Mar 21 '23 at 17:02

0 Answers0