Stretch spring — 2D hanging spring lab

Switch to 3D
Controls
Live readouts
Numerical checks
What to try
  1. Press "Free vibration": the mass oscillates forever and the energy bars trade kinetic and spring energy while the total stays constant.
  2. Increase damping c: the amplitude shrinks exponentially and the phase portrait spirals inward; at c = 2 sqrt(km) the motion is critically damped.
  3. Set F0 = 4 N and tune W to sqrt(k/m): the amplitude grows until damping balances the drive (resonance).
  4. Quadruple the mass: the period doubles (T = 2 pi sqrt(m/k)).
  5. Drag the weight with the mouse or finger and release.
The science

A mass m hangs from a linear spring (Hooke’s law F = −kx) with viscous damping c and an optional periodic force. Measuring displacement x from the hanging equilibrium absorbs gravity completely, since the static stretch is mg/k.

m ẍ + c ẋ + k x = F0 cos(Ω t) T = 2π √(m/k),   ωd = √(k/m − (c/2m)²),   ζ = c / (2√(km)) Steady amplitude: A = F0 / √((k − mΩ²)² + (cΩ)²) Static stretch: xeq = m g / k,   E = ½ m v² + ½ k x²

The page integrates with fourth-order Runge–Kutta (0.5 ms steps). Five checks compare the integrated undamped period, energy conservation, static stretch from a full-gravity model, damped period and the driven amplitude with the closed forms.

Simplifications: massless, perfectly linear spring (no coil mass, no large-stretch non-linearity), linear damping, one dimension, and the mass moves only vertically.