Simple harmonic motion position calculator
See the position of an oscillator at one instant: with amplitude 2, angular frequency π/2 and no phase, at time 1 it sits at 0, with a period of 4 and a frequency of 0.25. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Amplitude
- 2
- Angular frequency
- 1.5707963268
- Time
- 1
- Phase
- 0
- Angular frequency
- 1.5707963268
- Argument
- 1.5707963268
- Position
- 0
- Period
- 4
Simple harmonic motion is the backbone of introductory physics and vibration analysis: a mass on a spring, a small-angle pendulum, or any system whose restoring force is linear in displacement oscillates with a cosine (or sine) time law. This simple harmonic motion position calculator evaluates the standard form x(t) equals A times cosine of omega t plus phi, returning the instantaneous displacement together with the phase argument, and—when angular frequency is non-zero—the oscillation period and ordinary frequency. Students checking homework, tutors building demos, and automation scripts that need a deterministic SHM oracle all get the same pure parse result. Amplitude must be non-negative; angular frequency, time, and phase may be any finite numbers within published limits. Failed validation is not billed.
What x(t) = A cos(ωt + φ) means for a simple harmonic oscillator
In one-dimensional simple harmonic motion the displacement from equilibrium is completely fixed once you know four numbers: the amplitude A (the maximum distance from the equilibrium point), the angular frequency ω (how fast the phase advances, in radians per unit time), the evaluation time t, and the phase constant φ that sets where the oscillator sits at t equals zero. The cosine convention used by most textbooks writes the position as x of t equals A times cosine of the quantity omega t plus phi.
At t equals zero the position is A cos(phi); when phi is zero the motion starts at the positive extreme. Angular frequency is related to the ordinary frequency f by omega equals two pi f, and to the period T by T equals two pi over the absolute value of omega. Amplitude is required to be non-negative because A is a magnitude; a negative A would be absorbed into a pi shift of the phase and is rejected to keep the contract unambiguous.
Zero amplitude is allowed and simply returns a constant zero position for every time. Negative or positive omega both produce oscillation; the period uses the absolute value so the reported T is always positive. Phase and time have no sign restriction, so you can model advanced or delayed oscillators and evaluate at past or future instants without reformulating the problem.
What you enter and what you get back
Amplitude must be greater than or equal to zero; angular frequency, time, and phase may be positive, negative, or zero as long as they remain finite and within the absolute magnitude limit of one times ten to the twelfth. On success the body echoes the rounded inputs, reports argument as omega times t plus phi, reports position as A times cosine of that argument, and includes a formula string restating the cosine law plus a short message suitable for UI copy.
When angular frequency is non-zero the response also includes period equals two pi over absolute omega and frequency equals absolute omega over two pi; those two fields are omitted entirely when omega is zero so clients do not invent a cycle for a static offset. Example: amplitude two, angular frequency pi over two, time one, phase zero yields argument pi over two and position zero, the first quarter-period zero-crossing of a cosine that started at plus two. Missing amplitude or a negative amplitude fails validation and is not billed.
Where knowing the position helps
Classrooms and tutoring platforms use a simple harmonic motion position calculator so learners can check x of t for arbitrary amplitude, angular frequency, and phase without calculator mode mistakes on cosine arguments in radians. Exam generators and LMS plugins need a deterministic oracle that returns the same twelve-decimal-rounded position every time and that rejects negative amplitude instead of silently flipping the waveform.
Laboratory notebooks and sensor calibration scripts often know A, omega, and phi from a fit and need a pure function to predict displacement at sample timestamps without pulling a full numerical ODE solver. Keep requests small, pin position and argument in tests, and you get reproducible SHM displacement for homework, grading, and edge workers without standing up symbolic or numerical dynamics infrastructure.
When you later need velocity or acceleration, differentiate the same cosine form analytically or call a sibling kinematics tool; this page answers only the position question x of t from A, omega, t, and phi.
What you can do with it
Homework and lab checks for x(t)
Let students submit amplitude, angular frequency, time, and phase and verify the cosine-form displacement against textbook worked examples.
LMS and exam auto-grading
Mark SHM position items with a deterministic oracle that rejects negative amplitude and never invents period when omega is zero.
Sensor and vibration prediction scripts
Predict oscillator displacement at sample times from fitted A, ω, and φ in edge workers without a full dynamics library.
FAQ
How do I compute simple harmonic motion position x(t)?
Send non-negative amplitude A, angular frequency ω, time t, and optional phase φ (default 0).
What units should I use for ω, t, and φ?
Angular frequency is in radians per unit time and phase is in radians. Time must use the same time unit as ω (seconds with rad/s is the usual physics choice). The tool is unit-agnostic as long as you stay consistent.
Why must amplitude be non-negative?
Amplitude A is a magnitude: the maximum displacement from equilibrium. A negative value is equivalent to shifting phase by π and is rejected so the contract stays unambiguous.
What if angular frequency is zero?
The oscillator is static: position is A·cos(φ) for every t. Period and frequency fields are omitted because there is no cycle when ω = 0.
How do I get the period from the angular frequency?
Divide two pi by the size of the angular frequency. With an angular frequency of π/2 the period is 4, and the ordinary frequency, one over the period, is 0.25.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/trig/simple-harmonic-position \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"amplitude":2,"angular_frequency":1.5707963267948966,"time":1}'const res = await fetch("https://api.kit.forhosting.com/trig/simple-harmonic-position", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"amplitude": 2,
"angular_frequency": 1.5707963267948966,
"time": 1
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/trig/simple-harmonic-position",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"amplitude": 2,
"angular_frequency": 1.5707963267948966,
"time": 1
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/trig/simple-harmonic-position", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"amplitude":2,"angular_frequency":1.5707963267948966,"time":1}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"amplitude":2,"angular_frequency":1.5707963267948966,"time":1}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/trig/simple-harmonic-position", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"amplitude": 2,
"angular_frequency": 1.5707963267948966,
"time": 1
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "trig.simple_harmonic_position",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The free browser path and the paid API path share one module, so classroom answers and production pipelines never disagree on a floating-point cosine evaluation.
What x(t) = A cos(ωt + φ) means for a simple harmonic oscillator
This endpoint computes the cosine evaluation first, then—only when omega is not zero—adds period and frequency as convenience fields so you do not need a second calculator for the cycle time.
Input contract, response fields, and invalid_input behaviour
POST a JSON object with three required finite numbers: amplitude (aliases A or a), angular_frequency (aliases omega, the Greek letter omega, or w), and time (alias t). An optional phase field (aliases phi, the Greek letter phi, or phase_constant) defaults to zero when omitted. Numeric strings are accepted; booleans, empty strings, NaN, and Infinity fail with invalid_input naming the field. Pair the scalar position with your own chart if you need a full time series; this endpoint evaluates one instant per call and does not emit plots or multi-step tables.
Technical questions
What does the simple harmonic motion position calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.