Spring–mass–damper
Pull the mass down and let go. The spring pulls it back, it overshoots, and the damper takes a little energy out on every swing. With little damping it rings for a long time; at critical damping it comes straight back without overshooting; with more, it creeps back slowly.
The physics
- Equation of motion: m ẍ + c ẋ + k x = 0.
- Natural frequency: ωn = √(k ÷ m), fn = ωn ÷ 2π. A stiffer spring or a lighter mass oscillates faster.
- Damping ratio: ζ = c ÷ (2 √(k m)). Critical damping is c = 2 √(k m), where ζ = 1.
- Underdamped (ζ < 1), released from x₀ at rest: x(t) = x₀ e−ζωnt (cos ωdt + (ζωn ÷ ωd) sin ωdt), with ωd = ωn √(1 − ζ²). The swings shrink inside e−ζωnt, which falls to 2% after ln 50 ÷ (ζ ωn).
- Critical and overdamped (ζ ≥ 1): no swinging; x(t) is a sum of decaying exponentials and never crosses the rest position. Its settling time is found by solving x(t) = 2% of x₀.
A linear spring, a viscous damper (force proportional to speed) and no gravity offset (the rest position already includes the spring's stretch under the weight). Tested: the exact solutions against step-by-step integration (fourth-order Runge–Kutta) with no damping, light damping, critical damping and heavy damping, that the motion only crosses rest when ζ < 1, and that heavy damping returns more slowly than critical (packages/mechanics/test/science.test.ts).
Example
With mass 1 kg, spring stiffness 400 N/m, damping 4 N·s/m, pulled down by 50 mm: natural frequency: 3.18 Hz (20 rad/s); damping ratio ζ: 0.1: underdamped; period of the swings: 316 ms; settles within 2% in: 1.96 s; critical damping: 40 N·s/m. Open this setup, then change one thing at a time.
Related: Pendulum period · Coil spring rate calculator · RC circuit