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.

🔁 Simple Harmonic Motion Calculator
Mass (m)
kg
Spring constant (k)
N/m
Amplitude (A)
m
Phase (φ)
°
Time (t)
s
Frequency (f)
Hz
Amplitude (A)
m
Phase (φ)
°
Time (t)
s
Mass (optional, for energies)
kg
Frequency (f)
Hz
Amplitude (A)
m
Position (x)
m
Mass (optional)
kg
Displacement x(t)
—
Velocity v(t)
—
Acceleration a(t)
—
Phase at t
—
Angular frequency ω
—
Frequency f
—
Period T
—
Peak velocity Aω
—
Peak acceleration Aω²
—
Kinetic energy
—
Potential energy
—
Total energy
—

Speed at x
—
Acceleration at x
—
Potential share
—
Kinetic share
—
Angular frequency ω
—
Peak velocity Aω
—
Total energy
—
Kinetic energy
—
Potential energy
—

🔁 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

x(t)  =  A cos( ωt + φ )
A = amplitude (m), ω = angular frequency (rad/s), φ = phase (entered in degrees)
Velocity: v = −Aω sin( ωt + φ ), peak value Aω
Acceleration: a = −ω² x, peak value Aω²
Spring: ω = √( k / m ), T = 2π √( m / k ), and f = ω / 2π = 1 / T
Energy: KE = ½ m v², PE = ½ k x² = ½ m ω² x², total E = ½ k A²
Speed at position x: |v| = ω √( A² − x² )
Example: m = 0.5 kg, k = 200 N/m gives ω = 20 rad/s, T = 0.3142 s

📖 How to Use This Calculator

Steps

1
Choose a mode. Pick Mass on spring to use a mass and spring constant, Amplitude and frequency for any oscillator, or Position to find the speed and energy split at a given x.
2
Enter the oscillator and the moment. Type the mass and spring constant or the frequency, the amplitude, the phase in degrees and the time. In Position mode type the position x between -A and +A.
3
Read x, v, a and energy. Read the displacement, velocity, acceleration, period and energies at your chosen moment and check the plots over two periods.

💡 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

1
ω = √( 200 / 0.5 ) = 20 rad/s, f = 3.1831 Hz and T = 0.3142 s
2
Phase ωt = 20 × 0.05 = 1 rad (57.30°). x = 0.05 cos(1) = 0.0270 m and v = −0.05 × 20 × sin(1) = −0.8415 m/s
3
a = −20² × 0.0270 = −10.8060 m/s². Energies: KE = ½(0.5)(0.8415)² = 0.1770 J, PE = ½(200)(0.0270)² = 0.0730 J, total = 0.2500 J
x = 0.0270 m, v = −0.8415 m/s, total energy = 0.2500 J
Try this example →

Example 2 — Slower Spring, Larger Amplitude

m = 2 kg, k = 50 N/m, A = 0.1 m, φ = 0°, t = 0.3 s

1
ω = √( 50 / 2 ) = 5 rad/s and T = 2π / 5 = 1.2566 s
2
ωt = 1.5 rad (85.94°), so x = 0.1 cos(1.5) = 0.0071 m, nearly at the centre, and v = −0.1 × 5 × sin(1.5) = −0.4987 m/s
3
Peak velocity = 0.5 m/s, peak acceleration = 2.5 m/s² and total energy ½(50)(0.1)² = 0.2500 J, almost all kinetic (0.2487 J)
x = 0.0071 m, v = −0.4987 m/s
Try this example →

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)

1
ω = 2π × 2 = 12.5664 rad/s and the total phase is 12.5664 × 0.1 rad + 90° = 72° + 90° = 162°
2
x = 0.02 cos(162°) = −0.0190 m and v = −0.02 × 12.5664 × sin(162°) = −0.0777 m/s
3
a = −ω² x = 3.0037 m/s², peak velocity 0.2513 m/s, and total energy ½(0.5)(12.5664)²(0.02)² = 0.0158 J
x = −0.0190 m, a = 3.0037 m/s²
Try this example →

Example 4 — Speed at a Given Position

f = 1 Hz, A = 0.1 m, x = 0.06 m, mass 0.2 kg (assumed)

1
ω = 2π = 6.2832 rad/s and the peak velocity is Aω = 0.6283 m/s
2
|v| = 6.2832 × √( 0.1² − 0.06² ) = 6.2832 × 0.08 = 0.5027 m/s and a = −ω² x = −2.3687 m/s²
3
Potential share = (0.06 / 0.1)² = 36.00 %, so kinetic share = 64.00 %. Total energy = 0.0395 J, split 0.0253 J kinetic and 0.0142 J potential.
Speed = 0.5027 m/s, kinetic share = 64.00 %
Try this example →

Example 5 — Starting at the Centre

m = 1 kg, k = 100 N/m, A = 0.2 m, φ = −90°, t = 0.1 s

1
ω = √( 100 / 1 ) = 10 rad/s. With φ = −90° the motion starts at x = 0 moving in the positive direction.
2
Total phase = 1 rad − 90° = 57.30° − 90°, which is 327.30° on a 0 to 360 scale. x = 0.2 cos(1 − π/2) = 0.1683 m
3
v = −0.2 × 10 × sin(1 − π/2) = 1.0806 m/s and a = −16.8294 m/s². Total energy ½(100)(0.2)² = 2.0000 J, with KE 0.5839 J and PE 1.4161 J.
x = 0.1683 m, v = 1.0806 m/s
Try this example →

❓ Frequently Asked Questions

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 for an ideal spring.
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 and also shows the energy split.
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 the sine of the angle, which is close to the angle itself when the swing is small. A mass on an ideal spring is exact.
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.
What happens when friction is present?+
The amplitude then decays with time and the energy is lost as heat. This calculator models the ideal, undamped case. For decay, damping ratio and logarithmic decrement use the damping ratio calculator.

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.