Damped Pendulum Simulator
Visualize nonlinear pendulum dynamics — phase portraits, time series, and the transition between underdamped, critically damped, and overdamped regimes.
The damped simple pendulum is governed by the nonlinear second-order ODE
where \(L\) is the rod length, \(m\) the bob mass, \(b\) the damping coefficient, and \(g=9.81\,\text{m/s}^2\).
Lagrangian Formulation
The undamped pendulum has kinetic and potential energies \(T = \tfrac{1}{2}mL^2\dot\theta^2\) and \(V = -mgL\cos\theta\), giving the Lagrangian
Damping is a non-conservative force and enters via the Rayleigh dissipation function \(\mathcal{F} = \tfrac{1}{2}b(L\dot\theta)^2 = \tfrac{1}{2}bL^2\dot\theta^2\). The generalised Euler–Lagrange equation including dissipation is
Substituting:
Damping Regimes (linearised, \(\sin\theta\approx\theta\))
Let \(\gamma = b/(mL)\) and \(\omega_n = \sqrt{g/L}\). The characteristic equation \(\lambda^2+\gamma\lambda+\omega_n^2=0\) has discriminant \(\Delta = \gamma^2 - 4\omega_n^2\):
- Underdamped \((\Delta < 0,\;\zeta<1)\): \(\theta(t)=e^{-\gamma t/2}(A\cos\omega_d t+B\sin\omega_d t)\), \(\omega_d=\sqrt{\omega_n^2-(\gamma/2)^2}\) — decaying oscillations, spiral in phase space.
- Critically damped \((\Delta = 0,\;\zeta=1)\): \(\theta(t)=(A+Bt)e^{-\gamma t/2}\) — fastest return without oscillation.
- Overdamped \((\Delta > 0,\;\zeta>1)\): two distinct negative real roots, slow monotone return.
The damping ratio is \(\zeta = \gamma/(2\omega_n) = b/(2mL\sqrt{g/L})\).
Phase Space
The phase portrait plots \(\omega = \dot{\theta}\) vs \(\theta\) (wrapped to \((-\pi,\pi]\)). Fixed points: stable centers/spirals at \(\theta = 0\) and unstable saddles at \(\theta = \pm\pi\).
Numerical Method
RK4 (step \(\Delta t = 0.025\,\text{s}\), 4 steps/frame) by default. Switches to backward Euler when \(\Delta = \gamma^2 - 4\omega_n^2 > 0\) (overdamped / stiff). Inputs accept expressions such as pi/4, 2*pi, sqrt(2).
Inputs accept expressions: pi/4, 2*pi, sqrt(3)…