On a related note, does anyone know how you might go about fixing a simulator that allows collisions to generate more energy/momentum than was initially supplied? Or otherwise violates known invariants?
On a related note, does anyone know how you might go about fixing a simulator that allows collisions to generate more energy/momentum than was initially supplied? Or otherwise violates known invariants?
A classic mistake is to use something like "velocity += acceleration*time" (this is called Euler integration). It looks reasonable, and it's good enough for a toy project, but it doesn't conserve energy unless the timesteps are infinitely small.
A more sophisticated mistake is to use something like Runge-Kutta Integration: highly accurate in terms of position, but it is not symplectic so the total energy will drift over time. Think of your simulated world as a stack of graph paper sheets, where each sheet represents a surface of constant energy. Runge-Kutta will take you very close to the ideal (x,y) point - but not necessarily on the same sheet. Verlet Integration may be a little further from the right point each time, but by its mathematical form it will always stay on the same sheet.