A damped pendulum, sketched and integrated from one English sentence. You asked Claude. Glyph drew it. The pendulum that gave humanity its first timekeeping accurate enough to navigate by — and that has powered grandfather clocks ever since.
"Draw me Christiaan Huygens' pendulum clock. Use the Glyph viz grammar with a 2D trajectory ODE:dθ/dt = ω,dω/dt = −(g/L)·θ − γ·ω, with light damping γ = 0.02 to represent a high-quality mainspring. Integrate over 60 seconds, plot angle vs time. Pencil-sketch style. Beautiful enough for a child to count the swings; deep enough that a horologist recognizes the gentle exponential decay envelope."
— what to say to your AI agent. Claude writes the Glyph spec; the compiler integrates the ODE with RK4 and emits the angle-over-time curve.
A pendulum is one of nature's simplest oscillators — two terms in an ODE, no exotic physics. Add a tiny damping term and you've got Huygens' clock; add a periodic kick at the right phase (an escapement) and the pendulum runs forever.
The restoring torque is proportional to the displacement angle. For small angles it's linear; the period 2π·√(L/g) depends only on the rod length L and gravity g — not the bob's mass, not the amplitude.
Air drag, pivot friction, escapement coupling. All combined into a single damping coefficient γ. A good clock keeps γ small — Huygens' first design lost less than a second per day, an order of magnitude better than the verge-and-foliot clocks before it.
The mainspring's energy reaches the pendulum through the escapement, which releases a small kick at each extreme. Net energy stays constant; the pendulum keeps a perfect rhythm; the gears advance a precise step each swing.
Claude writes the JSON; Glyph integrates the 2D ODE with 4th-order Runge-Kutta over 1200 samples. Same spec → byte-identical SVG, every platform, every run.
// pendulum-clock.json — damped harmonic oscillator { "version": "glyph/0.1", "title": "Pendulum clock (Huygens 1656)", "data": { "trajectory": { "shape": "trajectory", // dθ/dt = ω (angular velocity) "dxdt": "y", // dω/dt = −(g/L)·θ − γ·ω // with g/L = 1, γ = 0.02 "dydt": "-x - 0.02*y", "initial": { "x": 0.6, "y": 0 }, "time": { "min": 0, "max": 60, "samples": 1200 } } }, "layers": [{ "mark": "line", "encoding": { "x": { "field": "t" }, "y": { "field": "x" } } }] }
14 full swings over 60 seconds, with amplitude shrinking from 0.6 rad to ~0.45 rad — exactly the trajectory the ODE predicts. Try γ = 0 (perfect lossless pendulum), γ = 0.1 (audibly winding down), or γ = 0.5 (overdamped, no oscillation). View on GitHub.
Byte-stable across Ubuntu / macOS / Windows × Node 20 / 22. The exponential decay envelope is in the data — no separate "fit" curve drawn; the ODE produces it for free.
Damped harmonic motion shows up everywhere — bridges, atoms, springs. Name your system and Claude can pick the ODE.
"Plot the same damped pendulum in phase space instead of time. x-axis = θ, y-axis = ω. The trajectory should spiral into the origin."
"Show me a Tacoma Narrows bridge oscillation — a forced damped harmonic oscillator with a periodic wind force. Find the resonance frequency where the amplitude grows unbounded."
"Plot a Morse potential — the energy curve of a diatomic molecule like H₂. Show how a vibrating molecule is just a damped harmonic oscillator near the equilibrium bond length."
"Draw a plucked guitar string. Damped harmonic motion at the fundamental frequency, plus the first three overtones at integer ratios. Show the composite waveform."