Back to Physics calculators

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

Simulate spring-mass simple harmonic motion with analytic, Euler-Cromer, or RK4 solvers. Follow each step in How it's calculated and export charts, tables, and CSV files.

Built for physics and calculus lessons. Derive amplitude and phase from x₀ and v₀, keep omega and energy summaries visible, and share the same setup by URL. Calculations stay in your browser.

Other languages 日本語 | English | 简体中文 | 繁體中文 | 繁體中文(香港) | Español | Español (México) | Português (Brasil) | Português (Portugal) | Bahasa Indonesia | Tiếng Việt | 한국어 | Français | Deutsch | Italiano | Русский | हिन्दी | العربية | বাংলা | اردو | Türkçe | ไทย | Polski | Filipino | Bahasa Melayu | فارسی | Nederlands | Українська | עברית | Čeština
Spring-mass parameters

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

Result summary

Default spring-mass sample: m = 1.0 kg, k = 4.0 N/m, A = 0.1 m.

Angular frequency ω = 2.00 rad/s, period T = 3.14 s, frequency f = 0.318 Hz.

How it's calculated

  1. Use ω = sqrt(k / m) with k = 4.0 N/m and m = 1.0 kg.
  2. Convert angular frequency to period with T = 2π / ω.
  3. Evaluate displacement and energy from the selected method when JavaScript runs.

FAQ

Which equations does the SHM simulator use?

We model a one-dimensional spring-mass system. The tool computes ω = sqrt(k/m) and T = 2π/ω, then evaluates x(t), v(t), and a(t) from the SHM equations. It also logs kinetic, potential, and total energy over time.

When should I choose Euler-Cromer or RK4?

Euler-Cromer is simple and keeps energy reasonably bounded, even with larger time steps. It works well for quick classroom demos. RK4 is higher-order and usually tracks the analytic curve within about 1e-3, so it suits accurate plots and assignment checks.

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.

What should I enter first for a spring-mass example?

Use mass, spring constant, amplitude, and phase first. For the default sample, m = 1.0 kg and k = 4.0 N/m give ω = 2.00 rad/s, so you can check the period before changing the solver method.

How precise are the SHM results?

The analytic method uses the closed-form SHM equations. Euler-Cromer and RK4 depend on the time step, so reduce dt when you need the numeric curve to match the analytic baseline more closely.

How to use Simple Harmonic Motion Calculator effectively

What this page is for

Use this page to connect period, frequency, angular frequency, amplitude, mass, and spring constant for ideal simple harmonic motion. Start with the known physical quantities and the model type.

Input checks

Keep SI units consistent unless the page explicitly converts them. Mass-spring and pendulum assumptions are different, so do not transfer values between models without checking formulas.

Workflow

A useful sequence is to compute the base period or frequency, then vary one physical parameter to see whether the motion changes as expected.

Common mistakes

Do not treat this as a damping or driven-oscillation model. Friction, large angles, and external forcing require a different setup.

How to read the result

Read the direction of change as a model check: increasing spring stiffness should shorten the period, while increasing mass should lengthen it in the mass-spring case.