Simple Harmonic Motion Calculator
Find the position, velocity, acceleration, period and energy of a mass on a spring or any simple harmonic oscillator at any moment.
🔁 What is Simple Harmonic Motion?
Simple harmonic motion (SHM) is the back-and-forth motion of an object whose restoring force is proportional to its displacement from equilibrium and always points back toward it. The classic example is a mass on an ideal spring: pull it to one side and release it, and it oscillates around the rest position in a smooth sine-wave pattern. The position follows x(t) = A cos(omega t + phi), where A is the amplitude (the largest displacement), omega is the angular frequency in radians per second and phi is the phase that sets the starting point of the cycle.
The model shows up in many places. Engineers use it for springs, vehicle suspensions and vibrating machine parts, physicists use it for small swings of a pendulum and for atoms vibrating in a crystal, and musicians rely on it because a plucked string or a tuning fork is close to a harmonic oscillator. Electrical circuits with an inductor and a capacitor obey the same equation, which is why one set of formulas covers so many systems. Students meet it first with a block on a spring because every quantity can be measured and checked against the formulas.
A few ideas are easy to mix up. The period T = 2 pi sqrt(m/k) of a mass on a spring does not depend on the amplitude, so a large oscillation and a small one take the same time per cycle. The velocity is largest at the centre and zero at the ends, while the acceleration is the reverse, largest at the ends and zero at the centre. The total energy ½kA² stays constant but changes form twice per cycle. Real systems also lose energy, and then the motion decays, which is the subject of the damping ratio calculator. Frequency forms are explained on the frequency calculator and angular frequency calculator pages, and the spring itself is covered by the Hooke's law calculator.
This calculator has three modes. Mass on spring works from m, k and A. Amplitude and frequency handles any oscillator when you know f instead of the spring constant, and treats mass as optional. Position gives the speed, acceleration and energy split at a chosen x. The first two modes plot two periods of motion with a marker at your chosen time, and the Position mode plots the energy exchange across the whole range from -A to +A. The model is the ideal, undamped, small-amplitude case.
📐 Formula
📖 How to Use This Calculator
Steps
💡 Example Calculations
Example 1 — Block on a Spring Released from Rest
m = 0.5 kg, k = 200 N/m, A = 0.05 m, φ = 0°, t = 0.05 s
Example 2 — Slower Spring, Larger Amplitude
m = 2 kg, k = 50 N/m, A = 0.1 m, φ = 0°, t = 0.3 s
Example 3 — Oscillator Known by Frequency and Phase
f = 2 Hz, A = 0.02 m, φ = 90°, t = 0.1 s, mass 0.5 kg (all assumed values)
Example 4 — Speed at a Given Position
f = 1 Hz, A = 0.1 m, x = 0.06 m, mass 0.2 kg (assumed)
Example 5 — Starting at the Centre
m = 1 kg, k = 100 N/m, A = 0.2 m, φ = −90°, t = 0.1 s
❓ Frequently Asked Questions
🔗 Related Calculators
What is the formula for simple harmonic motion?
The displacement is x(t) = A cos(omega t + phi), where A is the amplitude, omega the angular frequency and phi the phase. The velocity is v = -A omega sin(omega t + phi) and the acceleration is a = -omega squared times x.
What is the period of a mass on a spring?
T = 2 pi sqrt(m / k). A 0.5 kg mass on a 200 N/m spring has omega = sqrt(200 / 0.5) = 20 rad/s and a period of 0.3142 s. The period does not depend on the amplitude.
What is the maximum velocity in simple harmonic motion?
The maximum speed is v max = A omega, reached as the object passes through the equilibrium position. For an amplitude of 0.05 m and omega of 20 rad/s it is 1.0 m/s.
What is the maximum acceleration in simple harmonic motion?
The maximum acceleration is a max = A omega squared, reached at the two ends of the motion where the restoring force is greatest. For A = 0.05 m and omega = 20 rad/s it is 20 m/s squared.
How much energy does a simple harmonic oscillator have?
The total mechanical energy is E = ½ k A squared = ½ m omega squared A squared. It stays constant while moving between kinetic and potential forms. At the ends all of it is potential, at the centre all of it is kinetic.
What does the phase angle mean?
Phase phi sets where in the cycle the motion starts at t = 0. Phi of 0 starts at maximum positive displacement at rest. Phi of -90 degrees starts at the centre moving in the positive direction. Phi of 180 degrees starts at the negative end.
How do I find the speed at a given position?
Use v = omega sqrt(A squared - x squared). At x = 0.06 m with A = 0.1 m and f = 1 Hz, the speed is 6.2832 times 0.08 = 0.5027 m/s. The Position mode does this directly.
Why is the acceleration always opposite to the displacement?
In simple harmonic motion the restoring force is proportional to displacement and points back toward equilibrium, so a = -omega squared x. A positive x gives a negative acceleration, which keeps pulling the object back.
Is a pendulum simple harmonic motion?
Only approximately, for small angles. A simple pendulum has a restoring torque proportional to sin of the angle, which is close to the angle itself when the swing is small. A mass on a spring is exact for an ideal spring.
How is frequency related to angular frequency here?
Angular frequency omega equals 2 pi f, and for a spring omega is sqrt(k / m). The calculator shows omega, f and T together. For more conversions see the angular frequency and frequency calculators.