ForHosting KIT · Engineering & construction

SHM total energy calculator

A 200 N/m spring oscillating with a 0.1 m amplitude holds 1 J of total energy, the same at every instant of the cycle. Enter the spring constant and the amplitude to get that conserved energy in joules, with no mass needed. 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
K
200
Amplitude
0.1
You get
Energy
1 J
Precision
10

This SHM total energy calculator finds the total mechanical energy of an ideal undamped mass-spring simple harmonic oscillator when you know the spring constant and the oscillation amplitude. The closed form is E equals one-half k times A squared, which is the standard introductory result used in mechanics homework, energy conservation problems, and first-order checks on linear oscillators. When the spring constant is given in newtons per metre and the amplitude in metres, the result is reported in joules; any consistent force-per-length and length pair works the same way. In the ideal model this total energy is constant in time: at the extreme positions it is stored entirely as elastic potential energy, and at the equilibrium position it is entirely kinetic. Zero stiffness or zero amplitude is valid and yields zero total energy; a signed amplitude of either sign produces the same energy because of the square; a negative spring constant is rejected because it has no physical meaning for a stable restoring spring in this model. The engine is fully deterministic arithmetic: no network calls, no sampling, and no date-dependent shortcuts.

What total oscillation energy means and what you get

In classical mechanics, an ideal mass on a linear spring that obeys Hooke's law executes simple harmonic motion when displaced from equilibrium and released (or given suitable initial conditions without damping). The total mechanical energy of that undamped oscillator is constant and equals one-half times the spring constant k times the amplitude A squared. Amplitude is the maximum displacement from equilibrium; the spring constant is the stiffness in the linear regime.

Unlike elastic potential energy evaluated at an arbitrary instantaneous stretch x, which is one-half k x squared and varies during the cycle, the total energy uses the amplitude so you get a single conserved scalar for the motion. That scalar equals the elastic PE at maximum stretch and equals the pure kinetic energy at the equilibrium crossing. Zero k or zero amplitude is valid and yields zero energy when the other factor is finite.

Where SHM total energy fits in study, design, and software

Students meet E equals one-half k A squared when a textbook introduces energy in simple harmonic motion, when a conservation problem asks how much kinetic energy appears at equilibrium after a known amplitude, or when a contest problem gives k and A and asks for total mechanical energy without calculus. Teachers can pre-generate answer keys for modest stiffness and amplitude values without trusting opaque calculator apps that silently switch units or confuse instantaneous PE with total energy.

Developers call the same contract from scripts to seed deterministic test vectors for game physics demos of oscillators, to normalize user-entered spring parameters before an energy diagram, or to satisfy programming-challenge statements that demand joules rather than a hand-waved sketch. Product and first-order mechanical checks use E equals one-half k A squared when only linear stiffness and a design stroke (as amplitude) are known before nonlinear springs or multi-axis dynamics are modeled.

Homework and lab checks

Compute E = ½kA² from spring constant and amplitude before grading SHM worksheets or comparing energy balances.

Tutoring and teaching software

Normalize user-entered spring constant and amplitude into total mechanical energy for interactive SHM lessons.

What does the SHM total energy calculator cost?

It is free in your browser on this page.

What formula is used for SHM total energy?

Total mechanical energy of an ideal undamped mass-spring oscillator is E = ½ · k · A², where k is the spring constant and A is the amplitude. With SI inputs (N/m and m) the unit is joules (J).

What happens if the spring constant is negative?

A negative spring constant is not accepted because E = ½kA² has no standard meaning for a negative k in this calculator.

Do I need the mass m to compute total energy?

No. For ideal mass-spring SHM the total energy depends only on k and A. Mass affects the period and the split between kinetic and potential energy over time, but not the conserved total E = ½kA².

How is this different from spring potential energy PE = ½kx²?

Spring PE uses the instantaneous displacement x and varies during the cycle. SHM total energy uses the amplitude A and is constant for ideal undamped motion. At maximum stretch, x equals A and PE equals the total energy.

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/mech/shm-total-energy

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/mech/shm-total-energy \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"k":200,"amplitude":0.1}'
{
  "k": 200,
  "amplitude": 0.1
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "mech.shm_total_energy",
  "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.

What SHM total energy means and what the response contains

This calculator returns the normalized inputs k and amplitude, the computed energy, the precision used, a method tag shm_total_energy, a short formula reminder, and a unit hint J for SI inputs. There is no numerical time integration, no damping term, no driven-oscillator power balance, and no Monte Carlo sampling: the engine either evaluates one-half k A squared inside the supported numeric range or rejects the input with invalid_input. Rejected cases include a missing k or amplitude, non-finite values, magnitudes above the documented ceilings, and any spring constant that is negative, because a negative k is not accepted in this calculator.

How spring constant and amplitude are read and how energy stays reproducible

Zero stiffness is allowed and returns zero energy. Amplitude may be positive, zero, or negative; negative values are treated as signed extremes of the same magnitude and produce the same total energy because of the square, which is intentional for bidirectional displacement conventions. Optional leading plus signs and scientific notation on numeric strings are allowed when they parse as finite decimals; embedded spaces and non-numeric tokens are rejected. The preferred field for the spring constant is k, but aliases spring_constant, stiffness, and K are accepted so spreadsheets, query strings, and typed forms can reuse the same contract. The spring constant must be finite and non-negative: a negative value fails with invalid_input and a message that names the field and explains that SHM total energy E equals one-half k A squared is undefined for a negative spring constant in this calculator, so a bad cell does not become a silent nonsense result. The preferred field for amplitude is amplitude, with aliases A, amp, and max_displacement. An optional precision field, with aliases decimals and dp, chooses how many decimal places to expose for the numeric outputs, defaulting to ten and capped at fifteen so JSON goldens stay stable. Pair the free browser run on this page with the priced API when you need the identical mathematical result inside an automated pipeline without re-implementing the mass-spring energy formula yourself.

Where SHM total energy fits in study, design, and software

Education tools use the endpoint when a learner types spring constant and amplitude and the UI must show conserved total energy. On this page the work runs entirely in your browser; through the API each successful lookup costs $0.002, failed validation is not charged, and nothing is stored after the response returns. That split — free interactive exploration and a priced, identical API — matches the rest of the KIT tier-A catalog and lets you move from a classroom demo to an automated pipeline without changing the mathematical result. Pair it with spring potential energy or Hooke's-law helpers when you need related mechanics, and with other math endpoints when you are building a small lab of free, deterministic physics calculators.

Deterministic test fixtures

Generate reproducible total-energy values for unit tests, oscillator demos, and CI assertions on E = ½kA².

Read the full KIT documentation →