← Back to Writing

Double Spring Pendulum

A Lagrangian derivation and numerical experiment for a coupled spring pendulum.

  • physics
  • simulation
  • python
  • lagrangian-mechanics
Ler em português

An edited republication of my original post, published in 2016.

This variation on a double pendulum replaces the rigid rods with springs. Two angles and two changing spring lengths give the system four degrees of freedom.

Diagram of the double spring pendulum

From mechanics to code

I used a Lagrangian formulation: express kinetic energy for both masses, add gravity and spring potential energy, then apply Euler–Lagrange equations to each coordinate. Mathematica helped solve the resulting coupled equations, and I wrote a small Python visualisation to test the model.

Pages from the original derivation

Simulation of the coupled springs

The experiment also made numerical stability visible. The equations alone do not guarantee a stable simulation: a simple time-stepping method can add error and apparent energy. Reducing the time step helped, while a better ODE solver such as Runge–Kutta is the natural next step.

The original post has the full derivation and the historical Python implementation.