Simple Harmonic Motion Calculator
Period and frequency for a spring or a pendulum, Hooke's law, and where an oscillator is at any moment, all in one simple harmonic motion calculator. The numbers are substituted into each formula, and the pendulum's small-angle error is measured rather than ignored.
Period T
- Period T T = 2π√(m/k) = 2π × √(1 kg / 100 N/m) = 0.6283 s. Mass over stiffness: a heavier mass is slower, a stiffer spring is faster.
- 0.6283 s
- Frequency f f = 1 / T: 1.592 full oscillations per second, 95.49 per minute.
- 1.592 Hz
- Angular frequency ω ω = √(k/m) = 10 rad/s, which is 2π × f. It is the ω in x = A cos(ωt + φ), and in a = −ω²x.
- 10 rad/s
- Maximum speed v_max = Aω, reached passing through equilibrium. With A = 5 cm (0.05 m).
- 0.5 m/s
- Maximum acceleration a_max = Aω², at the two turning points, where the spring is most stretched or compressed and the speed is momentarily zero.
- 5 m/s²
- Total energy E = ½kA², all elastic at the turning points and all kinetic at equilibrium. It does not depend on the mass.
- 0.125 J
- Stretch if hung vertically mg/k with g = 9.807 m/s². Hanging the spring shifts where equilibrium is, but not the period: gravity only moves the center of the oscillation.
- 9.807 cm (0.09807 m)
| Time | Displacement x | Velocity v | Acceleration a | Kinetic share of energy |
|---|---|---|---|---|
| 0 s | 5 cm | 0 m/s | -5 m/s² | 0% |
| 0.07854 s | 3.536 cm | -0.3536 m/s | -3.536 m/s² | 50% |
| 0.1571 s | 0 cm | -0.5 m/s | 0 m/s² | 100% |
| 0.2356 s | -3.536 cm | -0.3536 m/s | 3.536 m/s² | 50% |
| 0.3142 s | -5 cm | 0 m/s | 5 m/s² | 0% |
| 0.3927 s | -3.536 cm | 0.3536 m/s | 3.536 m/s² | 50% |
| 0.4712 s | 0 cm | 0.5 m/s | 0 m/s² | 100% |
| 0.5498 s | 3.536 cm | 0.3536 m/s | -3.536 m/s² | 50% |
| 0.6283 s | 5 cm | 0 m/s | -5 m/s² | 0% |
- Assumes an ideal spring: massless, obeying Hooke's law over the whole swing, with no friction or air damping. A real spring's own mass slows it; for a uniform spring, add about a third of the spring's mass to m.
- Results are shown to four significant figures. Round to the precision of your least precise measurement.
How the Simple Harmonic Motion Calculator works
x = A cos(ωt + φ). Simple harmonic motion is oscillation in which the acceleration is proportional to the displacement and points back toward equilibrium: a = −ω²x. Every solution of that equation is a cosine wave with amplitude A, angular frequency ω and phase φ, and the period is T = 2π / ω whatever the amplitude.
For a mass on a spring, ω = √(k/m), so the period is T = 2π√(m/k).
Worked example, the one above: a 1 kg mass on a spring with k = 100 N/m. ω = √(100 / 1) = 10 rad/s. The period is T = 2π / 10 = 0.6283 s, and the frequency f = 1 / T = 1.592 Hz. Pulled 5 cm from equilibrium and let go, it reaches a top speed of Aω = 0.05 × 10 = 0.5 m/s as it passes through the middle, and its acceleration peaks at Aω² = 5 m/s² at each end. The energy in the motion is ½kA² = ½ × 100 × 0.05² = 0.125 J.
Why the amplitude does not change the period. Pull the mass twice as far and the spring pulls back twice as hard, so it covers twice the distance at twice the speed in the same time. That independence, called isochronism, is what makes harmonic oscillators good clocks, and it is the defining property: if the restoring force is not proportional to displacement, the period depends on the amplitude.
Hooke's law, F = kx, is the reason a spring is harmonic. The force to stretch a spring is proportional to the stretch, within its elastic limit, with the spring constant k as the constant of proportionality. Measure k by hanging a known weight and measuring the stretch: k = F / x. The energy stored is ½kx².
A pendulum is harmonic only approximately. Its restoring force is mg sin θ, not proportional to θ, but for small angles sin θ ≈ θ and the period is T = 2π√(L/g), independent of the mass. At larger swings the period grows: about 0.2% longer at 10°, 1.7% at 30°, and 18% at 90°. The pendulum mode works this out exactly rather than assuming it away, and the table shows how far the formula drifts.
Energy sloshes between two forms. At the ends of the swing the object is momentarily still and all the energy is potential; through the middle it is all kinetic. The total, ½mω²A², is constant. The cycle table shows the share changing every eighth of a period.
Units. k in newtons per meter, m in kilograms, L in meters, g in meters per second squared: then T is in seconds. ω is in radians per second, and is 2π times f, which is in hertz, cycles per second. Mixing them up (quoting ω as a frequency) is the most common mistake, and costs a factor of 6.28.
What this calculator does not model: friction and air resistance, which make a real oscillator lose amplitude over time (damping); a driving force (resonance); and the mass of the spring itself, which slows it slightly.
Simple Harmonic Motion Calculator FAQ
What is the formula for simple harmonic motion?
x = A cos(ωt + φ), where A is the amplitude, ω the angular frequency and φ the phase. It is the solution of a = −ω²x: acceleration proportional to displacement and directed back toward equilibrium. Velocity is −Aω sin(ωt + φ) and acceleration −ω²x.
How do you find the period of a mass on a spring?
T = 2π√(m/k). A 1 kg mass on a 100 N/m spring has T = 2π√(0.01) = 0.6283 s. The period depends only on the mass and the stiffness, not on how far the mass is pulled.
What is the difference between frequency and angular frequency?
Frequency f is cycles per second, in hertz. Angular frequency ω is radians per second, and ω = 2πf, because one cycle is 2π radians. A spring with ω = 10 rad/s oscillates at f = 1.592 Hz.
Does the amplitude affect the period in simple harmonic motion?
No. In true simple harmonic motion the period is the same at any amplitude. A pendulum only approximates SHM, so its period does grow slowly with the swing: about 0.2% at 10° and 1.7% at 30°.
Where is the speed greatest and where is the acceleration greatest?
Speed is greatest, Aω, passing through equilibrium, where the acceleration is zero. Acceleration is greatest, Aω², at the two ends of the swing, where the object is momentarily at rest.
Pendulums and springs
Sources
- NASA NSSDCA Moon Fact Sheet, bulk parameters table, row "Surface gravity (m/s2)", Moon column (page last updated January 11, 2024) (2026)
- NASA NSSDCA Mars Fact Sheet, bulk parameters table, row "Surface gravity (mean) (m/s2)", Mars column (page last updated May 19, 2025) (2026)