Enter parameters and press Play.
Simulation summary:
The swing of a small weight suspended from a string has fascinated scientists for centuries. Galileo reportedly timed a chandelier's swings with his pulse, noticing the period stayed constant despite the amplitude shrinking. This observation foreshadowed the development of precise pendulum clocks that regulated timekeeping for hundreds of years. A simple pendulum consists of a point mass attached to a massless rod or string of length , free to swing under gravity. In practice the bob has finite size and the string adds mass, but the idealized model captures the essential physics when the amplitude is modest. The motion arises from the interplay between gravitational torque seeking to restore the bob to vertical and inertial effects that carry it through the equilibrium point. As the bob rises, gravitational potential energy increases while kinetic energy dwindles, only to reverse as it descends. The oscillation continues until friction or air resistance dissipates energy. Pendula appear in metronomes, seismometers, playground swings, and even in the Foucault experiment that demonstrates Earth's rotation. Understanding their dynamics illustrates broader principles of harmonic motion, energy conservation, and damping.
The simulator treats the pendulum as a rigid rod of length with a point mass at its end, oscillating in a vertical plane under uniform gravitational field . The angular displacement from vertical is (positive clockwise). We allow an initial angle and angular velocity zero. Linear viscous damping proportional to angular velocity is included with coefficient (units ). Air drag and pivot friction are often approximately proportional to speed for small velocities, justifying this term. The string is assumed massless and inextensible; motions remain planar; is constant. Energies derive from potential and kinetic . All quantities use SI units: meters, kilograms, seconds, and radians internally (degrees accepted for input).
Applying torque balance about the pivot yields where the moment of inertia for a point mass is . Dividing by gives the familiar nonlinear equation . For small angles where , the solution reduces to simple harmonic motion with period . However, when the amplitude exceeds about 15°, the linear approximation fails and the true period lengthens. Damping introduces exponential decay of amplitude, transforming pure sinusoidal motion into spiraling trajectories in phase space.
To display realistic motion for any amplitude and damping, the simulator integrates the full nonlinear equation using a fourth‑order Runge–Kutta (RK4) scheme. Define the state vector , where . The derivatives are and . Given time step , the RK4 update computes intermediate slopes through and advances both and . RK4 offers excellent accuracy for smooth systems and preserves energy better than explicit Euler. Nevertheless, a finite step introduces numerical drift, especially for very small damping. The interface clamps between and s. Smaller values increase computational load but maintain fidelity; larger values may overshoot, causing energy to grow or decay artificially. The animation's frame loop accumulates simulated time separately from wall clock time, ensuring consistent physics even if the browser stutters. Energy at each step derives from the formulas above, permitting an overlay of kinetic and potential partitions.
Consider a 1 m pendulum with a 1 kg bob released from 20° in Earth's gravity without damping. The analytic small‑angle period would be s. Running the simulator with and s shows a full period of about 2.07 s, slightly longer because 20° is beyond the small‑angle regime. The energy bars swap as the bob moves: at the lowest point potential energy nearly vanishes while kinetic energy peaks at 0.38 J; at the extremes kinetic energy vanishes and potential reaches the same maximum, confirming energy conservation. Introducing damping causes the amplitude to decay; after 20 s the bob barely moves. Exporting the CSV yields columns of time, angle, angular velocity, and energies. Plotting the energy sum reveals a tiny drift under 0.1% over 100 s, validating the numerical scheme.
The table compares the baseline example with two variations. Each row lists the period measured from simulation and the total mechanical energy at the start.
L (m) | θ₀ (deg) | γ (1/s) | Simulated Period (s) | Initial Energy (J) |
---|---|---|---|---|
1.0 | 20 | 0 | 2.07 | 0.38 |
1.0 | 45 | 0 | 2.34 | 0.96 |
0.5 | 20 | 0.05 | 1.44 | 0.19 |
Increasing the amplitude to 45° lengthens the period by over 10%, while halving the length and adding slight damping shortens the period dramatically and reduces stored energy. These comparisons highlight how length and amplitude shape pendulum behavior beyond textbook approximations.
The canvas depicts the pivot at the top center with a thin rod and orange bob. As time advances, the bob swings according to the integrated angle. The bar chart beneath uses blue stripes for kinetic energy and orange stripes for potential energy, relying on patterns rather than color alone. The summary below the bars states the current time, angle, and energies, and the hidden text summary mirrors these numbers for screen readers. Keyboard users can focus the canvas and press the space bar to toggle play and pause. Tooltips on each input display units to reinforce dimensional consistency. The CSV button downloads time‑stamped samples, enabling external plotting or error analysis.
The model assumes a point mass and ignores string mass, air drag proportional to higher powers of velocity, and pivot friction that may be non‑linear. Large amplitudes approaching 180° would require careful treatment of the string going slack, an effect excluded here. Numerical integration, while robust, introduces small energy errors that grow over long simulations, especially with coarse time steps or zero damping. The energy bars consider only translational motion; rotational kinetic energy of extended bobs would slightly modify formulas. Additionally, the damping term assumes velocity-proportional drag, whereas turbulent air resistance scales with velocity squared.
Future refinements could include a driving torque to explore resonance and chaos, a phase‑space plot overlay showing versus , and unit toggles for inches or degrees Fahrenheit for outreach to broader audiences. Coupling two pendula via a spring would demonstrate mode splitting. Incorporating a constraint for a moving pivot would simulate playground swings being pumped. All these extensions remain compatible with the RK4 framework established here.