Calculator Inputs
Use the responsive three-column, two-column, and one-column input layout below.
Example Data Table
Use these sample settings to test different types of simple harmonic motion trajectories.
| Case | x₀ | v₀ | xeq | m | k | ω | Time span | Points | Expected pattern |
|---|---|---|---|---|---|---|---|---|---|
| Default study case | 0.08 | 0.35 | 0 | 1.50 | 24 | Auto | 10 | 400 | Balanced oscillation with elliptical phase path |
| Pure displacement start | 0.12 | 0 | 0 | 2.00 | 18 | Auto | 12 | 500 | Begins from extreme position with zero speed |
| Direct frequency control | 0.02 | 0.80 | 0 | 1.00 | 0 | 5.00 | 8 | 300 | Fast rotation around the state-space center |
Formula Used
1) State-space model
Let y = x - xeq. Then the undamped simple harmonic oscillator becomes:
y′ = v
v′ = -ω²y
State matrix: A = [[0, 1], [-ω², 0]]
2) Angular frequency
When mass and spring constant are used:
ω = √(k / m)
If frequency is entered:
ω = 2πf
3) Position and velocity over time
With y₀ = x₀ - xeq:
x(t) = xeq + y₀ cos(ωt) + (v₀ / ω) sin(ωt)
v(t) = -ωy₀ sin(ωt) + v₀ cos(ωt)
4) Derived metrics
Amplitude A = √(y₀² + (v₀ / ω)²)
Period T = 2π / ω
Energy E = ½mv² + ½k(x - xeq)²
Phase ellipse: ((x - xeq)² / A²) + (v² / (Aω)²) = 1
How to Use This Calculator
- Enter the initial displacement, initial velocity, and equilibrium position.
- Choose how to define the oscillation rate: enter ω directly, enter frequency, or enter both mass and spring constant.
- Set the simulation time span and the number of sample points.
- Press Calculate Trajectory to show results above the form.
- Review the summary cards, trajectory table, and Plotly graphs.
- Download the full sampled trajectory as CSV.
- Use the PDF button to save a report containing summary values and graphs.
Frequently Asked Questions
1) What does the state-space trajectory represent?
It shows position on one axis and velocity on the other. Each point describes the oscillator’s state at one moment, so the entire curve reveals how motion evolves through phase space.
2) Why is the phase trajectory an ellipse?
For an ideal undamped oscillator, position and velocity satisfy a constant-energy relation. That relation becomes an ellipse in phase space, centered at the equilibrium point.
3) What happens if I enter both ω and frequency?
The calculator gives priority to direct angular frequency. That keeps the workflow predictable and avoids mixing multiple competing definitions for the same oscillation rate.
4) Why does the energy stay almost constant?
This model assumes no damping and no external forcing. Under those ideal conditions, total mechanical energy remains constant, apart from tiny rounding differences caused by computation.
5) Can I use this for shifted equilibrium motion?
Yes. Enter the equilibrium position x_eq. The trajectory then oscillates around that center, while the relative displacement x - x_eq controls the ellipse and energy terms.
6) How many sample points should I choose?
Use a moderate value like 300 to 600 for smooth graphs. Increase the count for finer detail, but remember that very large samples create heavier tables and exports.
7) Is this calculator suitable for damped oscillators?
No. This page models the ideal undamped simple harmonic oscillator. Damped motion would require an added velocity-dependent term and a different state-space solution.
8) What do the eigenvalues tell me?
The eigenvalues are purely imaginary, ±iω, which identifies a center in phase space. That means the system rotates around equilibrium instead of decaying or diverging.