Instructions: drag square or circle with your mouse
Does the motion look random to you? Watch the graph for a while and you'll see its actually an intricate pattern.
An immoveable (but draggable) anchor point has a spring and bob hanging below and swinging in two dimensions. We regard the bob as a point mass. We define the following variables:
and some constants:
Note that for this simulation the vertical dimension increases downwards.
We'll need the standard unit vectors,
There are three vector forces acting on the bob:
Summing these forces and using Newton's second law we get:
m (axi + ayj) = m g j - k S (sin θ i + cos θ j) -b (vxi + vyj)
We can write the vector components of the above equation as separate equations. This gives us two simultaneous equations. We also divide each side by
ay = g - (k/m) S cos θ - (b/m) vy
These are essentially the equations of motion. It only remains to show how
S = L - R
The length is easily derived using the pythagorean theorem from the position of the bob,
The sine and cosine of the angle are given by the following:
cos θ = (uy - Ty)/L
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 only need to convert the two second order equations (1) to four first order equations.
uy' = vy
vx' = -(k/m) S sin θ - (b/m) vx
vy' = g - (k/m) S cos θ - (b/m) vy
We also keep in mind that