4 ms·
There's a terrific test of the accuracy of a pendulum simulation, one that many workers overlook. The test is based on the fact that, for a swinging pendulum, g
by lutusp 10y ago
There's a terrific test of the accuracy of a pendulum simulation, one that many workers overlook. The test is based on the fact that, for a swinging pendulum, gravitational potential energy (GPE) and kinetic energy (KE) must sum to a constant everywhere in the arc. The reason is that energy is conserved. So if a simulator shows a deviation from this constant sum, there's something wrong with the simulator and/or the underlying mathematics.
This thinking also applies to orbital simulations -- in an elliptical orbit, an object's radius from the central mass, and its velocity, are constantly changing, but (barring friction) its energy, the sum of GPE and KE, must be a constant.
- mikeash 10y agoIs it possible to apply that test for a multi-body simulation? I guess you could look at the combined GPE + KE of the entire system, but not individual bodies?
- grondilu 10y agoYou can apply it for any system with only conservative forces. And gravitation is conservative. https://en.wikipedia.org/wiki/Conservative_force https://en.wikipedia.org/wiki/Conservative_force
- santaclaus 10y ago> So if a simulator shows a deviation from this constant sum, there's something wrong with the simulator and/or the underlying mathematics. Not necessarily so -- many (most) discrete integrators do not exactly conserve the Hamiltonian. In fact, large classes of geometric integrators yield noticeable (but bounded) amounts of 'noise' on top of the true Hamiltonian.
- lutusp 10y ago>> So if a simulator shows a deviation from this constant sum, there's something wrong with the simulator and/or the underlying mathematics. > Not necessarily so But the "constant sum" I refer to is the sum of gravitational potential energy and kinetic energy in the system. If that were not true, if the sum were not a constant (and remembering this is an ideal model without friction), then energy would not be conserved. So, yes, necessarily so.