Harmonic Oscillator Laboratory
Interactive numerical integration
Overview
Investigate the behavior of a classical harmonic oscillator by modifying its physical parameters and numerical integration method.
The governing equation is
\[ m\frac{d^2x}{dt^2}+kx=0. \]
For a detailed derivation and numerical verification, see the accompanying scientific investigation.
Interactive laboratory
Displacement
Phase space
Mechanical energy
Suggested experiments
Numerical stability
Select explicit Euler and increase the timestep. Observe the growth in oscillation amplitude and mechanical energy.
Energy conservation
Compare Euler-Cromer and velocity Verlet under identical physical conditions.
Numerical accuracy
Reduce the timestep and compare the RMS displacement errors for each method.
Material and physical parameters
Increase the spring stiffness while holding the mass constant. Observe how the natural frequency and oscillation period change.
Implementation
All calculations are performed locally in the reader’s browser using JavaScript.
No simulation parameters or results are transmitted to a computational server.
The numerical methods correspond to those examined in the accompanying Python-based investigation. The browser implementation is separate from the Python implementation.