The smoothest motion in physics — this spring and pendulum simulator is the regular-motion counterpart to our chaotic double pendulum. Release a mass on a spring or a simple pendulum and watch it draw its own sine wave in real time, trading kinetic and potential energy back and forth. Turn on the ideal-sine overlay to see exactly where a wide-swinging pendulum stops being "simple." It all runs on your device.
You are in the Physics lab.
What the moving mass, the sine trace and the two energy bars are telling you.
The top panel is the oscillator itself — a mass on a spring, or a pendulum bob if you switch systems. Drag it out to set the amplitude and let go. As it swings, the lower panel scrolls a live displacement-versus-time graph: the height of the trace is how far the mass sits from equilibrium at that instant, and for a proportional restoring force it draws a clean sine wave. The blue dot at the right edge is the present moment.
The two vertical bars track how energy sloshes between forms while the total stays fixed. The KE bar is kinetic energy — tallest as the mass races through equilibrium — and the PE bar is potential energy, tallest at the turning points where the mass pauses. Watch one bar empty as the other fills; the readouts below print the same two numbers in joules, alongside the amplitude.
The dashed line is the ideal sine the formula predicts, and the readout shows the measured period beside the ideal T. For a mass on a spring they agree at any amplitude. Switch to the pendulum and push it to a wide angle: because the restoring force follows sin θ rather than θ, the real swing lags the dashed ideal and the measured period grows past 2π√(L/g) — the moment "simple" harmonic motion stops being simple.
A restoring force pulling toward equilibrium, integrated step by step, drawing a sine wave as it goes.
Displace the mass and something pulls it back toward equilibrium. For a spring that force is −k·x, exactly proportional to the displacement; for a pendulum it is −(g/L)·sin θ. Because the pull grows with distance, the mass overshoots equilibrium, is pulled back again, and oscillates forever in the absence of friction.
The simulator advances the state with fourth-order Runge–Kutta at a small fixed time step. As it runs, the bottom panel plots displacement against time — and for a proportional restoring force that plot is a pure sinusoid, x(t) = A·cos(ωt), with angular frequency ω = √(k/m) for the spring or √(g/L) for the pendulum.
The dashed line is the ideal sine the formula predicts. For the spring the real motion sits exactly on it. For the pendulum it matches at small angles, but as the swing widens sin θ falls below θ, the restoring force weakens, and the real curve visibly lags the ideal — the small-angle approximation breaking down before your eyes.
Teaching or blogging about physics? You can embed this on your own site free — one line of code, no sign-up.
A ready-to-assign lab using the simulation above. Free to use — nothing to install or sign up for, and no student data leaves the browser.
Record period versus mass and spring constant, and note where kinetic and potential energy peak.
Simple harmonic motion arises from a restoring force proportional to displacement (F = -kx). The period T = 2π√(m/k) grows with mass and shrinks with stiffness, and energy shifts continually between kinetic (at center) and potential (at the extremes).
Educators: link or embed this simulation freely in your LMS or course guide.
Put the Simple Harmonic Motion on your own page — free, no sign-up, no watermark. It runs entirely in your visitors' browsers. Copy the snippet and paste it into your page's HTML.