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:
- When there is a large change in force, decrease the time step.
- 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?