The simple pendulum

We will now solve the problem of the simple pendulum confined to a plane. In this case we have a mass m attached to a massless rod of fixed length L which has its other end fixed to a point. We recall that the Hamiltonian of the system is given by the following expression:

H=p22mL2LmgcosqH = \frac{p^2}{2mL^2}-Lmg\cos q

where q represents the angle that the rod forms with the vertical, p the angular momentum of the mass about the fixed point of the rod and g is the acceleration due to gravity. The corresponding equations of motion are the following:

q˙=pmL2,  p˙=Lmgsinq\dot{q} = \frac{p}{mL^2},~~ \dot{p} = -Lmg\sin q

For our example, we are going to use the following set of parameters and initial conditions:

L = 1.0  # Length of the pendulum arm (meters)
g = 9.81 # Gravitational acceleration (m/s^2)
m = 1.0  # Mass (kg)

Initial_angle = 3.0    # In radians
Initial_momentum = 0.0 # Angular momentum
Nt = 401               # Number of time steps
dt = 0.025             # Time resolution

With these conditions, we are setting the pendulum near the point of unstable equilibrium (180º) with no initial velocity. After evolving the system using the equations of motions and the Runge-Kutta method, we can make the animation from below. We can see that the system follows a periodic orbit in the phase space. This orbit circles around the point of equilibrium.

Feel free to try other initial contitions and see the result.

Last updated