Understanding the simple harmonic motion calculator — concept and principle
This calculator gives the position, velocity and acceleration of a simple harmonic oscillator at any moment, from the amplitude, the period, frequency or mass and spring constant, and the phase. It also shows the angular frequency, maximum speed and acceleration, and how the energy is split. It is used for springs, pendulums and physics homework.
How it is calculated
x(t) = A cos(ωt + φ)
v(t) = −A ω sin(ωt + φ)
a(t) = −A ω² cos(ωt + φ) = −ω² x
ω = 2π ÷ T = 2π f, or ω = √(k ÷ m)
Kinetic share of energy = sin²(ωt + φ)
- Lengths come out in the unit of A; φ in degrees.
The principle
Simple harmonic motion occurs whenever a restoring force is proportional to displacement, as with a spring. That makes the acceleration proportional to −x, and the solution is a sine or cosine wave. The object moves fastest through the centre and stops momentarily at the ends, where its acceleration is largest. The total energy ½kA² is constant and moves back and forth between kinetic and potential forms.
Worked example
Default inputs: A = 0.1 m, period 2 s, φ = 0°, t = 0.3 s.
- ω = 2π ÷ 2 = 3.142 rad/s; T = 2 s.
- Phase = π × 0.3 = 0.9425 rad (54°).
- x = 0.1 cos 54° = 0.05878 m.
- v = −0.1 × 3.142 × sin 54° = −0.2542 m/s; a = −3.142² × 0.05878 = −0.5801 m/s².
- Maximum speed = 0.3142 m/s; maximum acceleration = 0.987 m/s²; kinetic share = sin² 54° = 65.5%.
| Period or frequency | Displacement x(t) |
|---|---|
| 0.5 | -0.0809 |
| 1 | -0.0309 |
| 1.5 | 0.0309 |
| 2 | 0.05878 |
| 2.5 | 0.0729 |
| 3 | 0.0809 |
| 4 | 0.0891 |
How to read the result
At t = 0.3 s the mass is above the centre and moving back towards it, so velocity and acceleration are both negative. The kinetic share shows that about two thirds of the energy is in motion at that moment. The period does not depend on amplitude in ideal SHM.
Common mistakes
- Mixing degrees and radians in the phase.
- Confusing frequency f with angular frequency ω.
- Expecting large-angle pendulums to follow SHM exactly.
Frequently asked questions
Where is the speed greatest?
At the centre, where x = 0.
Where is the acceleration greatest?
At the turning points, where |x| = A.
Does the period depend on amplitude?
Not in ideal simple harmonic motion.
How do I get ω from a spring?
ω = √(k/m).
Sources: OpenStax, University Physics Volume 1 (2016), chapter 15 key equations