Simple Harmonic Motion Calculator: Period, Frequency, Position and Energy of a Spring
By FindMySum · Last reviewed
A mass on a spring is the classic oscillator. Pull it aside and let go, and it swings back and forth through its rest position in a smooth, repeating rhythm. This simple harmonic motion calculator gives the period, frequency and angular frequency of that rhythm, then tracks the mass at any moment: where it is, how fast it is moving, how hard it is accelerating, and how its energy is split between motion and the stretched spring. It works with one spring or two springs combined in series or in parallel, in metric or imperial units.
The physics in one line
An ideal spring pulls back with a force proportional to how far it is stretched or compressed, F = −kx (Hooke's law). Newton's second law then gives ma = −kx, or a = −(k/m)x: the acceleration is always proportional to the displacement and points the other way. The only functions whose second derivative is a negative multiple of themselves are sines and cosines, so the position follows
- x(t) = A cos(ωt + φ), with ω = √(k/m)
Here A is the amplitude (the largest displacement), ω the angular frequency in radians per second and φ the phase angle, which sets where in the cycle the motion starts. Differentiate once for the velocity, v(t) = −Aω sin(ωt + φ), and again for the acceleration, a(t) = −ω²x(t).
From ω come the two numbers most people want: the period T = 2π/ω = 2π√(m/k), the time for one full cycle, and the frequency f = 1/T in hertz.
Worked example
The calculator opens with a 0.5 kg mass on a spring with k = 20 N/m, pulled 10 cm from its rest position and released (φ = 0):
- ω = √(20 ÷ 0.5) = √40 = 6.325 rad/s
- T = 2π ÷ 6.325 = 0.993 s, so f = 1.007 Hz, almost exactly one swing per second
- maximum speed Aω = 0.10 × 6.325 = 0.632 m/s, as the mass passes the rest position
- maximum acceleration Aω² = 0.10 × 40 = 4.0 m/s², at the turning points
- total energy ½kA² = ½ × 20 × 0.10² = 0.10 J
At t = 0.5 s, half a period has nearly passed, so the mass is close to the far turning point: x = 10 cos(6.325 × 0.5) = −9.998 cm, moving at only 1.3 cm/s. Almost all of the 0.10 J is stored in the spring at that moment.
What the period depends on, and what it does not
The period depends only on the mass and the spring constant. It does not depend on the amplitude: pull the mass twice as far and it travels twice the distance at twice the speed, finishing the cycle in exactly the same time. This is what makes springs and other harmonic oscillators good timekeepers.
- More mass, slower: T grows with √m. Four times the mass doubles the period.
- Stiffer spring, faster: T shrinks with 1/√k. Four times the stiffness halves the period.
- Gravity does not matter for a spring. Hanging it vertically only moves the rest position down by mg/k; the oscillation about that point has the same period.
Energy
The total mechanical energy stays at E = ½kA² throughout the motion. At the turning points the mass is momentarily at rest and all the energy is elastic potential energy, ½kx². At the rest position the spring is relaxed and all the energy is kinetic, ½mv². Everywhere in between the two shares add up to the same total, which the calculator shows at your chosen time. Doubling the amplitude quadruples the energy.
Setting the two forms equal gives a handy result: the speed at any position is v = ω√(A² − x²). It is greatest at x = 0 and zero at x = ±A.
Starting conditions and the phase angle
You can describe the start of the motion in two ways. The first is an amplitude and phase angle: φ = 0 starts the mass at +A, φ = 180° at −A, and φ = −90° at the rest position moving in the positive direction. The second is the position and velocity at t = 0, which is often what an experiment gives you. The calculator converts them with
- A = √(x₀² + (v₀/ω)²) and φ = atan2(−v₀/ω, x₀)
For example, starting 5 cm out and moving outward at 50 cm/s with the default spring gives A = 9.35 cm and φ = −57.7°: the mass keeps going out to 9.35 cm before turning back.
Springs in series and in parallel
Two springs can share a load in two ways. Hooked end to end (in series), each carries the full force and their stretches add, so 1/k = 1/k₁ + 1/k₂. The combination is softer than either spring: 20 N/m and 30 N/m make 12 N/m. Side by side (in parallel), they stretch by the same amount and their forces add, so k = k₁ + k₂ = 50 N/m, stiffer than either. With the 0.5 kg mass, the series pair oscillates with a period of 1.28 s and the parallel pair with 0.63 s.
Reading the chart and table
The chart plots the position over two full periods, with a marker at the time you entered, so you can see where in the cycle the mass is. The table lists position, velocity and acceleration every twelfth of a period. Notice that the velocity is a quarter-cycle ahead of the position, and the acceleration is always opposite to the position, just as a = −ω²x says.
Limits of the model
The calculator treats the spring as ideal. A real spring has mass, and roughly a third of it moves with the load, which lengthens the period slightly; you can approximate this by adding a third of the spring's mass to m. Real systems also lose energy to friction and air resistance, so the amplitude slowly dies away; the damping ratio calculator covers that. Springs stretched past their elastic limit no longer obey Hooke's law. A pendulum is only approximately simple harmonic, for small swings, and has its own calculator.
More questions
Why is it called 'simple' harmonic motion?
Because the restoring force is exactly proportional to the displacement, which gives a single pure sine or cosine wave with one frequency. 'Harmonic' refers to that sinusoidal shape, the same one as a pure musical tone. Motions with several frequencies mixed together, or with forces that are not proportional to displacement, are still oscillations but not simple harmonic ones.
What is the difference between frequency and angular frequency?
Frequency f counts full cycles per second, in hertz. Angular frequency ω measures how fast the phase angle advances, in radians per second. One cycle is 2π radians, so ω = 2πf. The formulas for a spring come out most neatly in ω, which is why the calculator shows both.
Why does a heavier mass oscillate more slowly?
The same spring force has to accelerate more inertia. Since a = −(k/m)x, a larger m means a smaller acceleration at every displacement, so each cycle takes longer. The period grows with the square root of the mass: four times the mass, twice the period.
How do I measure a spring constant at home?
Hang the spring, note where its end sits, then hang a known mass and measure how far it stretches. k = mg ÷ stretch. A 200 g mass that stretches a spring by 10 cm gives k = 0.2 × 9.81 ÷ 0.10 ≈ 19.6 N/m. You can check it by timing ten oscillations and comparing the period with 2π√(m/k).
Does gravity change the period of a hanging spring?
No. Gravity only moves the rest position down by mg/k. The mass then oscillates about that new rest position with the same period it would have on a horizontal frictionless table. Measure the amplitude from the hanging rest position, not from the unstretched length.
Where does simple harmonic motion show up in real life?
Car suspensions, the quartz crystal in a watch, a guitar string's vibration, a building swaying in wind, the atoms in a solid and the current in an LC circuit all behave approximately like simple harmonic oscillators for small motions. The same equations, with different symbols, describe each of them.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.