StatGardenREF. DESK
Calculators/Physics/Simple harmonic motion
Physics

Simple harmonic motion calculator

Position, velocity and energy of a mass-spring oscillator at a given moment.

Published 8 August 2026 · Updated 21 September 2026

What this calculator does

In simple harmonic motion the total energy stays constant while continually trading between two forms. At the extremes of the swing everything is potential energy stored in the spring; passing through the middle it is all kinetic.

The total is set by the amplitude alone, at half the spring constant times amplitude squared. Where that energy sits at any instant depends on where the mass is in its cycle.

The formula

Formulax=A·cos(ωt); v=−Aω·sin(ωt); E = ½kA² = ½mv²+½kx², ω=√(k/m)

Position follows a cosine of angular frequency times time, and velocity its negative sine. Potential energy is half k x squared, kinetic energy is half m v squared, and the two always add to the same total.

TermMeaning
Total mechanical energyHalf the spring constant times the amplitude squared, constant throughout the motion.
EquilibriumThe rest position, where potential energy is zero and speed is greatest.
PhaseHow far through the cycle the oscillation has progressed, set here by the time since passing equilibrium.

The inputs explained

FieldWhat to enter
Mass (kg)The oscillating mass in kilograms.
Spring constant (N/m)The spring constant in newtons per metre.
Amplitude (m)The amplitude in metres, which alone determines the total energy.
Time since passing equilibrium (s)Time in seconds since the mass passed through equilibrium.

When to use it

Tracking the energy exchange

Evaluating at several times through a cycle shows the continuous trade between kinetic and potential energy.

Finding the speed at a given point

Energy conservation gives the speed at any displacement without needing to solve the motion equation.

Checking a physics problem

Most oscillation questions can be answered from energy conservation more quickly than from the equations of motion.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How does energy shift between kinetic and potential through a cycle?

The same oscillation sampled at a range of times after passing equilibrium.

0.5 kg on a 20 N/m spring, 0.05 m amplitude
Time since equilibriumKinetic energyPotential energy
0 s0 J0.025000 J
0.1 s0.008736 J0.016264 J
0.25 s0.024997 J0.00000267 J
0.5 s0.00001070 J0.024989 J
The two always add to the same 0.025 J total, whatever the moment. At 0.1 s the split is 0.008736 J kinetic against the remainder potential, and the balance keeps shifting back and forth as the mass oscillates.

Questions

Where is the mass moving fastest?

At the equilibrium position, where the spring is neither stretched nor compressed. All the energy is kinetic there, so the speed is at its maximum.

Where is the acceleration greatest?

At the extremes of the swing, where displacement and therefore restoring force are largest. That is also where speed is momentarily zero, which is a point people often find counterintuitive.

Does the total energy change over time?

Not in this idealised model. In reality friction and air resistance drain it gradually, which is why a real oscillation decays and eventually stops.

How does amplitude affect the energy?

Energy depends on amplitude squared, so doubling the amplitude quadruples the energy. The period, however, does not change at all, which is the defining feature of simple harmonic motion.

For the period and frequency of the same system, see the mass-spring period calculator. For the spring constant itself, see the spring constant calculator.