The physics
A block of mass m slides on a frictionless surface. A linear spring of stiffness k pulls it back towards equilibrium, and a viscous damper resists its motion with a force proportional to velocity. Newton's second law gives the equation of motion:
| Symbol | Meaning | SI unit |
|---|---|---|
| x | Displacement from equilibrium | m |
| x dot, x double dot | Velocity and acceleration | m/s, m/s² |
| m | Mass | kg |
| k | Spring stiffness | N/m |
| c | Viscous damping coefficient | N·s/m |
| ζ | Damping ratio | — |
Natural frequency and damping ratio
Two derived quantities describe the behaviour completely:
The natural frequency ωn is how fast the system would oscillate without damping. A stiffer spring or a lighter mass oscillates faster. The damping ratio ζ compares the actual damping with the critical value cc = 2√(km).
Damping regimes
- Undamped (ζ = 0): energy is conserved and the block oscillates forever with period T = 2π / ωn.
- Underdamped (0 < ζ < 1): the block oscillates at the damped frequency ωd = ωn√(1 − ζ²) inside an exponentially shrinking envelope e−ζωₙt.
- Critically damped (ζ = 1): the fastest return to equilibrium without overshooting. This is the target for many door closers and measuring instruments.
- Overdamped (ζ > 1): the block creeps back without oscillating. Increasing damping further makes the return slower, not faster.
Try the presets above: set the same initial displacement and compare how quickly each regime settles.
Numerical method and validation
The simulation integrates equation (1) with the classical fourth-order Runge–Kutta method (RK4). The time step is 1% of the system's fastest time scale and never larger than 1 ms. Because this equation also has an exact closed-form solution, the simulation evaluates both. The dashed curve on the displacement graph is the exact solution, and the numerical error readout shows the difference between the two. With damping, the difference stays below a nanometre. Without damping, a tiny phase error slowly builds up. Even at the stiffest setting, it stays below one millionth of the amplitude after two minutes of simulated time. The automated tests check these bounds.
When you change m, k, or ζ during a run, the motion continues from its current position and velocity under the new parameters. The exact solution restarts from that state too.
Assumptions and limitations
- One degree of freedom: the block moves only along a straight line.
- Linear spring (Hooke's law) with no preload, yielding, or coil contact.
- Purely viscous damping. Dry (Coulomb) friction is not modelled.
- Rigid block and massless spring and damper.
- Free vibration only. Forced vibration and resonance are planned as a separate tool.