This simulation shows two objects connected by springs and suspended from an anchor point. The objects are able to move in 2 dimensions and gravity operates. The anchor point is moveable.
You can drag either mass with your mouse. You can also drag the top anchor point. Click the "reset" button to put the masses in a resting equilibrium. Try changing parameters such as gravity, mass, spring stiffness, and friction (damping).
The math behind the simulation is shown below. Also available: source code, documentation and how to customize.
An immoveable (but draggable) anchor point has two spring2 and bobs hanging below and swinging in two dimensions. We regard the bobs as point masses. We label the upper spring and bob as number 1, the lower spring and bob as number 2.
Define the following variables:
Define some constants:
Note that for this simulation the vertical dimension increases downwards.
Here are the equations of motion. The derivation is similar to that given for the Single 2D Spring.
F_{1x} = m_{1} a_{1x} = −k_{1} S_{1} sin θ_{1} − b_{1} v_{1x} + k_{2} S_{2} sin θ_{2}
F_{1y} = m_{1} a_{1y} = −k_{1} S_{1} cos θ_{1} − b_{1} v_{1y} + k_{2} S_{2} cos θ_{2} + m_{1} g
F_{2x} = m_{2} a_{2x} = −k_{2} S_{2} sin θ_{2} − b_{2} v_{2x}
F_{2y} = m_{2} a_{2y} = −k_{2} S_{2} cos θ_{2} − b_{2} v_{2y} + m_{2} g
The spring stretch S_{n} and angles θ_{n} are functions of the positions u_{n} of the bobs as follows:
L_{1} = √((u_{1x} − T_{x})^{2} + (u_{1y} − T_{y})^{2})
L_{2} = √((u_{2x} − u_{1x})^{2} + (u_{2y} − u_{1x})^{2})
S_{1} = L_{1} − R_{1}
S_{2} = L_{2} − R_{2}
cos θ_{1} = (u_{1y} − T_{y})/L_{1}
sin θ_{1} = (u_{1x} − T_{x})/L_{1}
cos θ_{2} = (u_{2y} − u_{1y})/L_{2}
sin θ_{2} = (u_{2x} − u_{1x})/L_{2}
To solve the equations of motion numerically, so that we can drive the simulation, we use the Runge Kutta method for solving sets of ordinary differential equations. We need to convert the four second order equations of motion to eight first order equations.
u_{1x}' = v_{1x}
u_{1y}' = v_{1y}
u_{2x}' = v_{2x}
u_{2y}' = v_{2y}
v_{1x}' = −(k_{1}/m_{1}) S_{1} sin θ_{1} − (b_{1}/m_{1}) v_{1x} + (k_{2}/m_{1}) S_{2} sin θ_{2}
v_{1y}' = −(k_{1}/m_{1}) S_{1} cos θ_{1} − (b_{1}/m_{1}) v_{1y} + (k_{2}/m_{1}) S_{2} cos θ_{2} + g
v_{2x}' = −(k_{2}/m_{2}) S_{2} sin θ_{2} − (b_{2}/m_{2}) v_{2x}
v_{2y}' = −(k_{2}/m_{2}) S_{2} cos θ_{2} − (b_{2}/m_{2}) v_{2y} + g
We keep in mind that the spring stretch S_{n} and angles θ_{n} are functions of the position of the bob u_{n} as given previously.
This web page was first published April 2001.