Use this calculator to find SHM motion values for a mass-spring system or a small-angle pendulum at any chosen time.
Advanced options
How to use our Simple Harmonic Motion Calculator
- Choose System type: use Mass-spring for a spring and mass, or Small-angle pendulum for a pendulum.
- Choose Motion inputs: either Amplitude and phase or Initial position and velocity.
- Enter Time (s) and Mass (kg). Mass is used for energy in both system modes.
- If you chose spring mode, enter Spring constant (N/m). If you chose pendulum mode, enter Pendulum length (m). In Advanced options, adjust Gravity g (m/s^2) only if your class uses a different value.
- If you chose amplitude-phase mode, enter Amplitude (m) and Phase angle (deg). If you chose initial-condition mode, enter Initial position x0 (m) and Initial velocity v0 (m/s).
- Optional: in Advanced options, pick Phase output unit, Number display, and Significant figures for the way results are shown.
- Click Calculate to see angular frequency, period, frequency, displacement, velocity, acceleration, energy, and the mode note.
- Sanity-check the results: Amplitude should be nonnegative, Total energy should stay constant for ideal SHM, and in spring mode Restoring force at time t should point opposite the sign of Displacement at time t.
Definitions
System type: The physical setup that decides the oscillation speed. Here it is either a mass on a spring or a small-angle pendulum.
Motion inputs: The way you describe the same motion. You can use amplitude plus phase, or use the starting values Initial position x0 (m) and Initial velocity v0 (m/s).
Equilibrium position: The center position where the object would rest if it were not moving. Displacement is measured from this point.
Amplitude: The greatest distance from equilibrium. It is the size of the motion and is always nonnegative.
Phase angle: A starting offset that tells where the motion begins in the cosine pattern. Different phase angles can describe different starting positions and directions.
Angular frequency: How fast the motion cycles through its angle part, measured in radians per second. A larger value means faster oscillation.
Period: The time for one full back-and-forth cycle.
Frequency: The number of cycles each second. It equals 1 divided by period.
Restoring force: The force that pulls or pushes the object back toward equilibrium. In a spring, it points opposite the displacement.
Common mistakes and quick fixes
Mistake: Entering Amplitude (m) as a negative number in amplitude-phase mode.
Fix: Keep Amplitude (m) at 0 or greater. Use Phase angle (deg) to control the starting direction instead.
Mistake: Filling in Spring constant (N/m) while System type is set to pendulum, or filling in Pendulum length (m) while it is set to spring.
Fix: Match the input to System type . Spring mode uses Spring constant (N/m) ; pendulum mode uses Pendulum length (m) .
Mistake: Mixing the two motion styles by entering Amplitude (m) and also expecting Initial position x0 (m) to be used.
Fix: Check Motion inputs first. Use either Amplitude and phase or Initial position and velocity , not both at once.
Mistake: Leaving Time (s) blank or using the wrong time unit.
Fix: Enter a real value in seconds for Time (s) . The outputs Displacement at time t , Velocity at time t , and Acceleration at time t all depend on it.
Mistake: Typing phase in radians into Phase angle (deg) .
Fix: That input is always degrees. If you want radians in the result, change Phase output unit in Advanced options.
Mistake: Thinking a negative Displacement at time t , Velocity at time t , or Restoring force at time t means the answer is wrong.
Fix: Signed outputs are normal in SHM. Negative just means the quantity points in the negative direction based on your sign choice.
Limitations & Key Assumptions / Boundary Conditions
- This calculator models ideal 1D simple harmonic motion only. It does not include damping, friction, air resistance, driving forces, or nonlinear springs.
- In Small-angle pendulum mode, the math uses the small-angle approximation. Results are most reliable when the estimated angular amplitude is small, roughly when amplitude divided by length is below about 0.26 rad, or about 15 degrees [4].
- Pendulum inputs use linear displacement in meters, not angular input. The calculator estimates the angular size from amplitude divided by pendulum length when giving the mode note.
- Mass (kg) is still required in pendulum mode because the energy outputs use mass. The period, frequency, and angular frequency do not depend on mass for the simple pendulum model.
- Restoring force at time t is shown only for spring mode, using Hooke's law. It is not shown for pendulum mode because the exact restoring force is not modeled with the same linear spring form.
- Very tiny negative energy values caused only by rounding are treated as 0 in display, but larger negative values would mean the inputs or calculations are inconsistent.
- The result is only as good as the units you enter. All length inputs are meters, time is seconds, mass is kilograms, and phase input is degrees.
Methodology
Core formulas
The calculator first finds angular frequency from the chosen system, then uses that value in the SHM motion equations.
ω = sqrt(k / m)
Use this for Mass-spring, where Spring constant (N/m) is k and Mass (kg) is m.
ω = sqrt(g / L)
Use this for Small-angle pendulum, where g is Gravity g (m/s^2) and L is Pendulum length (m) [4].
T = 2π / ω
f = ω / (2π)
These give Period and Frequency.
Motion from amplitude and phase
If Motion inputs is amplitude-phase, the calculator converts Phase angle (deg) to radians and uses the cosine form of SHM [1].
x(t) = A cos(ωt + φ)
v(t) = -Aω sin(ωt + φ)
a(t) = -ω^2 x(t)
Here A is amplitude, φ is phase angle, and t is Time (s).
Motion from initial conditions
If Motion inputs is initial conditions, the calculator converts Initial position x0 (m) and Initial velocity v0 (m/s) into the equivalent amplitude and phase. This helps show that both input styles describe the same SHM.
A = sqrt(x0^2 + (v0 / ω)^2)
φ = atan2(-v0 / (Aω), x0 / A)
If both x0 and v0 are 0, then the calculator sets amplitude, phase, displacement, velocity, acceleration, and energies to 0 directly to avoid divide-by-zero issues.
Extra outputs
v_max = Aω
a_max = Aω^2
F = -kx
The restoring force formula is used only in spring mode [2].
K = 0.5mv^2
U = 0.5mω^2x^2
E = 0.5mω^2A^2
These give Kinetic energy at time t, Potential energy at time t, and Total energy. In spring mode, the potential energy formula is equivalent to 0.5kx^2.
Worked mini-example
Suppose System type is spring, Mass (kg) = 1, Spring constant (N/m) = 10, Amplitude (m) = 0.10, Phase angle (deg) = 0, and Time (s) = 0.50.
ω = sqrt(10 / 1) = 3.1623 rad/s
x(0.50) = 0.10 cos(3.1623 x 0.50) = about -0.001043 m
v(0.50) = -0.10 x 3.1623 x sin(3.1623 x 0.50) = about -0.3162 m/s
a(0.50) = -ω^2 x = -(3.1623)^2 x (-0.001043) = about 0.01043 m/s^2
E = 0.5 x 1 x (3.1623)^2 x (0.10)^2 = 0.05 J
Those values match the linked SHM outputs and show that the total energy stays constant in ideal motion.
Computation notes
The calculator reads only the inputs used by the current system mode and motion mode, so hidden fields do not affect results. Phase output can be shown in degrees or radians without changing the actual calculation. Number display settings affect formatting only, not the physics.
Sources
- 15.1 Simple Harmonic Motion - University Physics Volume 1 - Openstax
- 5.5 Simple Harmonic Motion - Physics - Openstax
- 16.6 Uniform Circular Motion and Simple Harmonic Motion - College Physics - Openstax
- 16.4 The Simple Pendulum - College Physics - Openstax
- CODATA Value: standard acceleration of gravity - NIST