This simulation shows a single mass on a spring, which is connected to the ceiling. The mass is able to move in 2 dimensions, and gravity operates. Does the motion look random to you? Watch the graph for a while and you'll see its actually an intricate pattern.

Enable the "show controls" checkbox to change gravity, mass, spring stiffness, and friction (damping). You can drag the mass with your mouse to change the starting position.

(If you don't see the simulation try instructions for enabling Java.)

2D spring variables

An immoveable (but draggable) anchor point has a spring and bob hanging below and swinging in two dimensions. Regard the bob as a point mass. Define the following variables:

*θ*= angle (0 = vertical, increases counter-clockwise)*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

*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.
We'll need the standard unit vectors **i**, **j**. We use bold and overline to indicate a vector.

**i**= unit vector in horizontal direction**j**= unit vector in vertical (down) direction

There are three vector forces acting on the bob:
*m*.

These are the equations of motion. It only remains to show how *S* sin *θ* and *S* cos *θ* are functions of the position of the bob. The displacement of the spring *S* is the current length of the spring minus the rest length.

From the pythagorean theorem we can get the length of the spring *L* in terms of from the position of the bob, *u*, and the position of the anchor point, *T*.

The sine and cosine of the angle *θ* are:

- F
_{gravity}=*m**g***j**= gravity acting straight down - F
_{spring}= −*k**S*(sin*θ***i**+ cos*θ***j**) = the spring pulling (or pushing) along the line from bob to anchor point. - F
_{damping}= −*b*(*v*_{x}**i**+*v*_{y}**j**) = damping (friction) acting opposite to the direction of motion of the bob, ie. opposite to its velocity vector.

*m* a = F_{gravity} + F_{spring} + F_{damping}

*m* (*a _{x}*

a = − _{x}^{k}⁄_{m} S sin θ − ^{b}⁄_{m} v
_{x} | (1a) |

a = _{y}g − ^{k}⁄_{m} S cos θ − ^{b}⁄_{m} v
_{y} | (1b) |

S = L − R
| (2) |

(3) |

sin θ = (u − _{x}T)/_{x}L
| (4a) |

cos θ = (u − _{y}T)/_{y}L
| (4b) |

*u _{x}*' =

*u _{y}*' =

*v _{x}*' = −

*v _{y}*' =

This web page was first published April 2001.