Interactive pendulum simulation
Change a pendulum’s length, gravity and damping, then watch its motion and angle trace.
A clear answer. Here’s how.
Numerically integrates θ″=−(g/L)sin(θ)−bθ′ using fourth-order Runge–Kutta with a fixed 1/240 s step, starting at rest. It is an ideal point mass on a massless rigid link, with a supplied linear angular-damping coefficient and no driving force. The displayed small-angle period 2π√(L/g) is an approximation, especially at large amplitudes. Energy is per unit mass, gL(1−cosθ)+½L²θ′². Animation starts only on request, pauses when the tab is hidden and respects reduced-motion preferences; manual steps remain available. The trace shows the latest 20 simulated seconds; CSV retains the latest 10,000 samples at 20 Hz.