Simple Harmonic Motion Calculator – Period, Kinematics and Energy
Simple harmonic motion is what happens whenever a system is pushed away from equilibrium and the force pushing it back is proportional to how far it has moved. Write that restoring force as F = −kx, feed it into Newton's second law, and you get mẍ = −kx — a differential equation whose solution is a pure sinusoid, x(t) = A·cos(ωt + φ). This calculator takes a description of the oscillator and returns the whole picture: its period, frequency and angular frequency, its displacement, velocity and acceleration at any instant, and how the total energy is split between kinetic and potential at any point in the swing.
The three timing numbers
For a mass on a spring the angular frequency is ω = √(k/m), the period is T = 2π√(m/k), and the frequency is f = 1/T = ω/2π. A 200 N/m spring carrying 0.5 kg gives ω = 20 rad/s exactly, a period of 0.31416 s, and a frequency of 3.1831 Hz. Notice what is missing from all three expressions: the amplitude. Pull the mass twice as far and it feels twice the restoring force, so it accelerates twice as hard over twice the distance and arrives back in exactly the same time. That property is called isochronism, and it is the reason pendulum clocks could keep time long before electronics existed.
Displacement, velocity and acceleration
Differentiating the solution twice gives v = −Aω·sin(ωt + φ) and a = −Aω²·cos(ωt + φ). The second of those collapses to a = −ω²x, which is the defining signature of SHM — the acceleration is always proportional to the displacement and always pointing the other way. The three curves are each a quarter-cycle apart: velocity peaks at v_max = Aω when the mass sweeps through equilibrium, and acceleration peaks at a_max = Aω² at the turning points, where the mass is momentarily stationary. They are never both at maximum together.
Where the energy goes
The total mechanical energy of an ideal oscillator is constant at E = ½kA², which is also ½m·v_max² — two independent routes to the same number. At any position the potential energy is ½kx² and the kinetic energy is the remainder. The squaring is what surprises people.
x = A/2 the potential energy is ½k(A/2)² = ¼ × ½kA² — a quarter of the total, not a half. Three quarters remains kinetic, so the mass is still travelling at about 87 % of its top speed when it is halfway out.Because both energies depend on squared quantities, each one rises and falls twice per cycle — at double the frequency of the displacement itself — while their sum traces a perfectly flat line. Watch the energy chart and the constant total is the clearest visual proof of conservation you will find.
Recovering amplitude and phase from a measurement
Real experiments rarely start neatly at a turning point. Given a starting displacement x₀ and a signed starting velocity v₀, the motion is fixed by A = √(x₀² + (v₀/ω)²) and φ = atan2(−v₀/ω, x₀). Using atan2 rather than a plain arctangent matters: it puts the phase in the correct quadrant and copes with x₀ = 0 without a special case. A mass released at 6 cm while moving at −1.6 m/s in a 20 rad/s system turns out to have a 10 cm amplitude and a phase of 0.9273 rad, or 53.13°.
Pendulums and the price of the small-angle approximation
A simple pendulum becomes SHM only once you replace sin θ with θ, giving ω = √(g/L) and T = 2π√(L/g). The mass of the bob cancels out entirely, which is why a heavy pendulum and a light one of the same length keep the same time. The approximation is not free, though: the first-order correction is T ≈ T₀(1 + θ₀²/16), so a 5° swing runs about 0.048 % slow and a 10° swing about 0.19 %. Because the error grows as θ₀², it climbs fast, and this calculator reports it live rather than hiding it.
Adding damping
Add a drag term and the amplitude decays inside an exponential envelope: x(t) = A₀·e^(−γt)·cos(ω_d t + φ) with γ = b/2m. The damped angular frequency ω_d = √(ω₀² − γ²) is always slightly lower than the undamped value. The damping ratio ζ = γ/ω₀ classifies the behaviour: below 1 the system rings, at exactly 1 it is critically damped and returns to rest in the shortest time without overshoot, and above 1 it creeps back. The quality factor Q = ω₀/2γ measures how long the ringing lasts, and because energy goes as amplitude squared, it decays at twice the amplitude rate: E(t) = E₀·e^(−2γt).
Between them these relations describe an enormous range of physical systems — car suspensions tuned to about 1 Hz, tuning forks at 440 Hz, seconds pendulums in clock cases, and atoms vibrating on their lattice bonds at terahertz rates. The arithmetic is identical in every case; only the numbers change.