Physics-based simulation of a simple pendulum.
Modify gravity, mass or friction (damping). Drag the pendulum to change the starting position. Or click below to set initial conditions:
The math behind the simulation is shown below. Also available: source code, documentation and how to customize.
For small oscillations the simple pendulum has linear behavior meaning that its equation of motion can be characterized by a linear equation (no squared terms or sine or cosine terms), but for larger oscillations the it becomes very non-linear with a sine term in the equation of motion.
Try using the graph and changing parameters like mass, length, gravity to answer these questions (leave damping at zero to simplify things):
You'll find the answers below.
The pendulum is modeled as a point mass at the end of a massless rod. We define the following variables:
We will derive the equation of motion for the pendulum using the rotational analog of Newton's second law for motion about a fixed axis, which is τ = I α where
The rotational inertia about the pivot is I = m R^{2} . Torque can be calculated as the vector cross product of the position vector and the force. The magnitude of the torque due to gravity works out to be τ = −R m g sin θ . So we have
−R m g sin θ = m R^{2} α
which simplifies to
θ'' = − ^{g}⁄_{R} sin θ | (1) |
This is the equation of motion for the pendulum.
Most people are less familiar with rotational inertia and torque than with the simple mass and acceleration found in Newton's second law, F = m a . To show that there is nothing new in the rotational version of Newton's second law, we derive the equation of motion here without the rotational dynamics. As you will see, this method involves more algebra.
We'll need the standard unit vectors, i, j . We use bold and overline to indicate a vector.
The kinematics of the pendulum are then as follows
position = R sin θ i − R cos θ j
velocity = R θ' cos θ i + R θ' sin θ j
acceleration = R(θ'' cos θ i − θ' ^{2} sin θ i + θ'' sin θ j + θ' ^{2} cos θ j)
The position is derived by a fairly simple application of trigonometry. The velocity and acceleration are then the first and second derivatives of the position.
Next we draw the free body diagram for the pendulum. The forces on the pendulum are the tension in the rod T and gravity. So we can write the net force as:
F = T cos θ j − T sin θ i − m g j
Using Newton's law F = m a and the pendulum acceleration we found earlier, we have
T cos θ j − T sin θ i − m g j = m R(θ'' cos θ i − θ' ^{2} sin θ i + θ'' sin θ j + θ' ^{2} cos θ j)
Write the vector components of the above equation as separate equations. This gives us two simultaneous equations: the first for the i component and the second for the j component.
−T sin θ = m R(θ'' cos θ − θ' ^{2} sin θ)
T cos θ − m g = m R(θ'' sin θ + θ' ^{2} cos θ)
Now do some algebraic manipulations to eliminate the unknown T . Multiply the first equation by cos θ and the second by sin θ .
−T sin θ cos θ = m R(θ'' cos^{2}θ − θ' ^{2} sin θ cos θ)
T cos θ sin θ − m g sin θ = m R(θ'' sin^{2}θ + θ' ^{2} sin θ cos θ)
Use the first equation to substitute for T cos θ sin θ in the second equation and do a little more algebra to get:
−θ'' cos^{2}θ + θ' ^{2} sin θ cos θ = θ'' sin^{2}θ + θ' ^{2} sin θ cos θ + ^{g}⁄_{R} sin θ
With the trig identity cos^{2}θ + sin^{2}θ = 1 this simplifies to equation (1)
θ'' = − ^{g}⁄_{R} sin θ
There is yet a third way to derive the equations of motion for the pendulum. This is to use the "indirect" energy based method associated with the terms "Lagrangian", "Euler-Lagrange equations", "Hamiltonian", and others. While this method isn't shown here, you can see an example of it on the Pendulum+Cart simulation page.
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. First we define a variable for the angular velocity ω = θ' . Then we can write the second order equation (1) as two first order equations.
θ' = ω
ω' = − ^{g}⁄_{R} sin θ
This is the form needed for using the Runge-Kutta method.
Question: What is the relationship between angular acceleration and angle?
θ'' = − ^{g}⁄_{R} sin θ
Question: How do mass, length, or gravity affect the relationship between angular acceleration and angle?
Question: For small oscillations, how do length or gravity affect the period or frequency of the oscillation?
θ'' = − ^{g}⁄_{R} θ
This is a linear relationship. You can see that the graph of acceleration versus angle is a straight line for small oscillations. This is the same form of equation as for the single spring simulation. The analytic solution is
$$\theta(t) = \theta_0 \cos(\sqrt{g/R} \; t)$$
where θ_{0} is the initial angle and t is time. The period is the time it takes for θ(t) to repeat, so
$$period = \frac{2 \pi}{\sqrt{g/R}}$$
The frequency of oscillation is the inverse of the period:
$$frequency = \frac{1}{2 \pi} \sqrt{g/R}$$
So we predict that
This web page was first published April 2001.