MyPhysicsLab – Dangle Stick

vertical:    horizontal: graph type:


Can you find the bug in this simulation? Play with it for a while and see if you can determine when the bug occurs. Perhaps you can even have a theory for why it occurs. The answer is found below.


We have a massless rigid stick with a point mass on each end. One end of the stick is attached to a spring, and gravity acts.

The equations of motion are derived by the Lagrangian method. The variables are:

First we calculate the kinematics. That is, we find expressions for the positions of the two masses in terms of the above variables. Then we differentiate to get the velocities of the masses. Up to now this is purely an exercise in geometry, there is no information about the forces involved at all.

Next we get separate expressions for the kinetic energy and potential energy of the system. The difference of the two is the Lagrangian. The Lagrangian expression is then evaluated (with its various partial derivatives) once for each of the three variables. This yields three equations. We then solve the three equations simultaneously to isolate the second derivatives on the left-hand side. This is then ready for the Runge-Kutta algorithm to numerically solve the equations.

The derivation of the equations of motion is shown here in Adobe PDF format.

A Bug

There is a problem in the equations of motion when the length of the spring goes to zero, because then one of the second derivatives goes to infinity. If you play with the simulation long enough you will likely see this happen.

Here is my idea for why it blows up: The rate that the angle of the spring changes depends on the torque (twist) applied, which is partially dependent on the length of the spring. When the length goes to zero, the torque goes to infinity.

In the real world, springs never reach zero length. To eliminate this bug, we would need to model the spring with a non-linear force. As the spring compressed to near zero (or to near its smallest possible length) the force would go to infinity.