Computational example Julia

Damped Harmonic Motion

From sustained oscillation to a slow return to equilibrium.

m x″ + c x′ + k x = 0

m = 1 kg   ·   k = 4 N/m   ·   x(0) = 1 m   ·   v(0) = 0 m/s

Three reference presets
Damping regime
Underdamped: displacement and mechanical energy versus time; The mass crosses equilibrium repeatedly as its oscillation decays.
Critically damped: displacement and mechanical energy versus time; For this release from rest, critical damping returns toward equilibrium without overshoot, faster than the overdamped case.
Overdamped: displacement and mechanical energy versus time; Stronger damping suppresses oscillation but gives a slower return toward equilibrium.

The Three Regimes Together

Damping removes mechanical energy. More damping does not always mean a faster return: the overdamped mass takes longer to approach equilibrium than the critically damped mass for this release from rest.

Comparison of displacement over 12 seconds: underdamped motion oscillates, critical damping approaches zero without crossing it, and overdamped motion returns more slowly.

Reproduce the Result

The Julia project contains the calculation, preset inputs, tests, environment manifest, and CSV results.

Project README ZIP

Published results · Julia 1.10.12 · 601 samples per preset

Method and Assumptions

The state is evaluated as exp(tA)u(0) with Julia's standard-library matrix exponential. The model assumes a linear spring and viscous damping, with no driving force.

Independent analytic solutions check all three regimes. Mechanical energy, E = (m v² + k x²)/2, must decrease or remain constant.

These are saved calculations. Selecting a preset does not run code on the server.

Calculation provenance