ForHosting KIT · Science

Simple harmonic motion calculator

With an amplitude of 4, an angular frequency of 2 rad/s and zero phase, the oscillator sits at +4 at time zero, at rest, with an acceleration of −16. Enter A, ω, φ and t to get displacement, velocity and acceleration at that instant. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Amplitude
4
Angular frequency
2
Phase
0
Time
0
You get
Argument
0
Displacement
4
Velocity
0
Acceleration
-16

Simple harmonic motion is the undamped oscillation produced when a restoring force is linear in the displacement from equilibrium: a mass on a spring, a small-angle pendulum, a torsion oscillator, or the Cartesian projection of uniform circular motion. The position at time t is the closed-form sinusoid x(t) equals A times cosine of omega t plus phi, where A is the amplitude, omega is the angular frequency in radians per second, and phi is the phase constant in radians. This calculator evaluates that displacement for any finite amplitude, angular frequency, phase, and time, and also returns velocity and acceleration from the same argument.

What x(t) = A cos(ωt + φ) means

Simple harmonic motion is the unique undamped oscillation whose restoring force is strictly linear in the signed displacement from a single equilibrium. Under that Hooke-type law the Newtonian equation m times x double-dot plus k times x equals zero has the closed-form family x of t equals A cosine of omega t plus phi, with omega equal to the square root of k over m for a mass-spring pair.

The same sinusoid is the x-projection of a point that travels at constant speed around a circle of radius A, which is why textbooks introduce SHM through circular motion even when the laboratory system is a spring, a pendulum, or a torsion wire. Amplitude A is the maximum excursion from equilibrium and carries the length unit of the answer: metres in SI, or whatever consistent length unit you already used for A.

Angular frequency omega, in radians per second, is how fast the argument of the cosine advances; it is two pi times the ordinary frequency in hertz, and the period is two pi over the absolute value of omega when omega is not zero. Phase phi, in radians, sets the position at time zero: phi of zero starts at plus A, phi of pi starts at minus A, and phi of pi over two starts at zero heading negative.

Time t is the instant of evaluation in seconds; negative times are mathematically valid and simply run the oscillator backward. Damping, driving forces, and nonlinear springs are out of scope: they replace the single cosine with decaying envelopes, particular integrals, or numerical trajectories that belong on other landings.

Input contract, units, and error behaviour

Amplitude is the field the specification calls out: if amplitude is not a finite number the task fails and is not billed, rather than returning a hollow NaN displacement that a buggy client might treat as success. Infinity, NaN, and non-numeric strings are all rejected the same way. Negative amplitude is allowed because it is equivalent to adding pi to the phase; zero amplitude yields a rest displacement of zero at every time.

Zero angular frequency is also allowed and yields the constant displacement A cosine of phi, which is the static limit of an oscillator that is not oscillating. On success the body echoes the four cleaned inputs, the phase argument omega t plus phi, displacement x, velocity minus A omega sine of the argument, acceleration minus A omega squared cosine of the argument, and a formula string restating x of t equals A cosine of omega t plus phi.

Classic checks include A equals four, omega equals two, phi equals zero, t equals zero giving displacement four, and A equals two, omega equals one, phi equals pi, t equals zero giving displacement minus two.

Where an SHM displacement calculator earns its keep

Classrooms and tutoring platforms use a simple harmonic motion calculator so learners can check x of t for arbitrary A, omega, phi, and t without mixing sine and cosine conventions or forgetting that phase is in radians. Laboratory notebooks recording mass-spring traces often know amplitude from a ruler, period from a stopwatch (hence omega equals two pi over T), and a phase from the starting position; evaluating displacement at a chosen time is the first step before overlaying a theoretical curve on a photogate file.

Game and animation rigs that fake a bobbing buoy, a swaying sign, or a breathing HUD use the same cosine, and they need a pure function that never depends on wall-clock Date so a replay file stays bit-stable. Failed validation does not consume balance. Keep requests small, pin the rounded displacement in tests, and you get reproducible positions for homework, LMS plugins, and edge workers without standing up a numerical ODE solver of your own.

Classroom and homework checks

Let students submit A, ω, φ, and t for x(t)=A cos(ωt+φ) and verify displacement (plus velocity and acceleration) against the textbook cosine convention.

Lab traces and photogate overlays

Evaluate the theoretical SHM position at chosen times from a measured amplitude, period-derived ω, and starting phase, then overlay it on a recorded trace.

What is the simple harmonic motion displacement formula?

x(t) = A · cos(ωt + φ), where A is amplitude, ω is angular frequency in rad/s, φ is the phase constant in radians, and t is time in seconds.

What happens if amplitude is not a finite number?

Amplitude must be a finite number; NaN, Infinity, empty strings, and missing values are rejected and are not billed.

Is the phase in degrees or radians?

Radians. Convert degrees first by multiplying by π/180.

Which units should I use for amplitude and time?

Any consistent length unit for amplitude (metres in SI); displacement is returned in that same unit. Time is in seconds and angular frequency in radians per second. Zero ω is allowed and yields the constant A·cos(φ).

How do I get the angular frequency from a frequency in hertz?

Multiply the frequency by 2π to get radians per second. Going the other way, the period of one full oscillation is 2π divided by the size of the angular frequency.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/phys/simple-harmonic-motion

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/phys/simple-harmonic-motion \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amplitude":4,"angular_frequency":2,"phase":0,"time":0}'
{
  "amplitude": 4,
  "angular_frequency": 2,
  "phase": 0,
  "time": 0
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "phys.simple_harmonic_motion",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Amplitude must be a finite number; Infinity, NaN, and missing values fail with invalid_input and are not billed.

What x(t) = A cos(ωt + φ) means

This capability evaluates that cosine at the four numbers you send and does not integrate a differential equation, so identical inputs always produce identical JSON.

Input contract, units, and error behaviour

POST a JSON body with four required finite numbers: amplitude A, angular_frequency omega in radians per second, phase phi in radians, and time t in seconds. Each field may arrive as a JSON number or as a numeric string; aliases A and amp, omega w and angular_freq, phi phase_constant and phase_rad, and t are accepted and mapped onto the canonical names so a form and a script can share one contract. Non-finite values, missing fields, and empty strings fail with invalid_input naming the field. Phase must be sent in radians, not degrees: convert degrees by multiplying by pi over one hundred eighty before the call, because a silent degree-to-radian guess would make goldens and classroom keys disagree. Pair the response with your own plot if you need a time series; this endpoint evaluates one instant per request.

Where an SHM displacement calculator earns its keep

Exam-prep generators need a deterministic oracle that marks a non-finite amplitude as invalid_input instead of silently returning NaN that a buggy grader might treat as a numeric zero.

Animation, games, and unit tests

Drive a bobbing or swaying motion with a deterministic cosine that never depends on Date, so replays and integrator fixtures stay bit-stable.

What does the simple harmonic motion calculator cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →