Interesting Examples of Computational Physics
  • Welcome to the blog of Computational Physics at the IFM!
  • Dynamical Systems
    • The simple pendulum
    • The spherical pendulum
  • The wave equation
    • The simple discretization
    • Boundary conditions
    • Interfaces between mediums
    • Knots on ropes
    • 2D wave equation
  • Time dependent Schrödinger equation
    • The Crank-Nicolson method
    • Free wave packet
    • Quantum Tunneling
    • Harmonic Oscillator
    • Forced Harmonic Oscillator
    • 2D Harmonic Oscillator
    • Wave-particle duality
Powered by GitBook
On this page
  1. Dynamical Systems

The simple pendulum

PreviousDynamical SystemsNextThe spherical pendulum

Last updated 1 year ago

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=p22mL2−Lmgcos⁡qH = \frac{p^2}{2mL^2}-Lmg\cos qH=2mL2p2​−Lmgcosq

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˙=−Lmgsin⁡q\dot{q} = \frac{p}{mL^2},~~ \dot{p} = -Lmg\sin q q˙​=mL2p​,  p˙​=−Lmgsinq

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.

On the left, evolution of the pendulum in physical space (speed of the film not to scale). On the right, evolution of the pendulum in the phase space.