OneSimulation docs Website Free books Plans on Gumroad

Docs › Examples › Downloadable notebooks › A damped spring–mass oscillator

Systems and dynamics · 0D

A damped spring–mass oscillator

The classic linear oscillator m·ü + c·u̇ + k·u = 0, checked against its analytic solution and energy balance.

ODETime integrationEnergy balance

Run locally with OneSimulation. The example downloads are free. Running them requires an activated runtime. OneSimulation 1.0 · CPython 3.13 on macOS (Apple Silicon), Ubuntu 22.04 (x86-64), and Windows x64. Installation and activation · View pilot plans. Scope of the reference checks.

A damped oscillator computed with OneSimulation.
A damped oscillator computed with OneSimulation. Run the notebook to produce its own figures.

What it computes

An under-damped linear oscillator is integrated in time and compared with the closed-form displacement u(t) = e^(−αt)(A cos ωt + B sin ωt). Displacement, velocity and the decay of the mechanical energy E = ½mv² + ½ku² are verified for the supplied parameters. Halving the step separates the time-integration error from the physical model.

What it checks

Closed-form under-damped solution and energy decay.