Simple Harmonic Motion (SHM) simulator — with steps and energy

Simulate spring–mass simple harmonic motion with analytic, Euler–Cromer, or RK4 solvers, see a step-by-step “How it's calculated” log next to the results, and export shareable charts, tables, and CSV files.

Ideal for physics and calculus lessons. The tool can derive amplitude and phase from x₀ and v₀, keeps omega and energy summaries visible beside the graphs, and stores your settings in a shareable URL. All calculations run in your browser, and inputs are not sent to the server.

Other languages: ja | en | es | zh-CN
Spring-mass parameters

Keyboard shortcuts: Ctrl+Enter runs the solver, Ctrl+S downloads the CSV.

Result summary

How it's calculated

    FAQ

    Which equations does the SHM simulator use?

    We model a one-dimensional spring–mass system. The tool computes the angular frequency ω = sqrt(k/m) and period T = 2π/ω, then uses x(t) = A cos(ωt + φ), v(t) = −Aω sin(ωt + φ), and a(t) = −ω² x(t). Energy is split into kinetic K = 0.5 m v² and spring potential U = 0.5 k x², and the total E = K + U is logged over time.

    When should I choose Euler-Cromer or RK4?

    Euler–Cromer is simple and keeps energy reasonably bounded even with larger time steps, so it works well for quick classroom demos and explorations. RK4 is a higher-order method that follows the analytic curve to within about 1e-3, making it better for accurate plots, assignments, and checking your own calculations.

    Where are the calculations performed?

    All calculations run in your browser only. The inputs you enter are not sent to the server, so you can safely use classroom examples or assignment data.