Firebrand Press ← Working Knowledge

Working Knowledge · Executable companion

The damped oscillator

Vary the damping and frequency. Compare the numerical trajectory with its closed-form solution.

x″(t) + 2ζω x′(t) + ω²x(t) = 0

Original synthetic model. The equation and its assumptions appear in the printed reader.

Explore the model

Initial state: x(0) = 1, v(0) = 0.
Time step: 0.02. Duration: 20.

Displacement over time. The solid numerical trajectory and dashed analytic trajectory should coincide at this scale.
Model energy: a useful invariant or monotonicity check, not evidence for the model’s physical truth.

Declared assumptions

  • Linear time-invariant oscillator; no external forcing.
  • Natural angular frequency is positive; damping ratio is nonnegative.
  • Default initial displacement is 1 and initial velocity is 0.

What this does not establish

  • No experimental data are reproduced.
  • This implements a synthetic fixture, not a historical paper.
  • Passing numerical tests does not validate the physical assumptions.

Source passages

The following passages come from the versioned notes in the reader.

oscillator-note:model

x″(t) + 2ζω x′(t) + ω² x(t) = 0

Original synthetic fixture, block model

oscillator-note:parameters

Here x is displacement, t is time, ω is the natural angular frequency, and ζ is the damping ratio. The companion assumes ω is positive and ζ is nonnegative. Its default initial conditions are x(0) = 1 and x′(0) = 0. These conventions are part of the model, not settings to hide in implementation code.

Original synthetic fixture, block parameters

oscillator-note:energy

E(t) = ½[x′(t)² + ω²x(t)²]; E′(t) = −2ζωx′(t)²

Original synthetic fixture, block energy

numerics-note:state

x′ = v; v′ = −2ζωv − ω²x

Original synthetic fixture, block state

numerics-note:method

The numerical implementation uses the classical fourth-order Runge–Kutta method with a fixed time step. The analytic implementation uses separate formulas for underdamped, critically damped, and overdamped motion. These two routes share the same declared equation and initial conditions, but not the same stepping algorithm.

Original synthetic fixture, block method