Hi all,
I am currently implementing a python version of the swing pendulum for my own work and noticed that there seems to be an issue with the SwingPendulum.java simulation.
From what I can tell, it is using euler's method to step the physics and includes an adjustable timestep. It seems that the timestep is not multiplying all the forces the way it should and will therefore cause the dynamics to change as the timestep is changed (more so than just the gain or loss of approximation accuracy) . It appears to me that the impulse thetaAcceleration at line 61 should be:
double thetaAcceleration = Stepsize * (-velocity + Mass * G * Length * Math.sin(theta) + torque);
Otherwise the gravity and torque of the system would effectively get stronger as timesteps get smaller. In order to fix this issue and not affect most existing code, you could increase the default mass and max/min torque to keep the dynamics unchanged when using the default timestep (e.g. new_default_mass = default_mass / default_timestep). This would be the best solution in my opinion.
Let me know if I made a mistake in my reasoning,
Clement