# MyPhysicsLab – Double Spring 2D

This simulation shows a two masses connected by springs and suspended from the ceiling. The masses are able to move in 2 dimensions, and gravity operates.

*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. You can change parameters such as gravity, mass, spring stiffness, and friction (damping). If you don't see the simulation try instructions for enabling Java. Scroll down to see the math!
*
## Physics

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.

double spring variables

Define the following variables:

*θ* = angle (0=vertical)
- S = spring stretch (displacement from rest length)
- L = length of spring
- u = position of bob
- v = u'= velocity of bob
- a = u''= acceleration of bob
- F = net force on a bob

Define some constants:

- R = rest length of spring
- T = position of anchor point
- m = mass of bob
- k = spring constant
- b = damping constant
- g = gravitational constant

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}
## Numerical Solution

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.