Spring-Mass System
A mass on a spring demonstrating Hooke's law and undamped simple harmonic motion — adjust spring constant, mass, initial velocity, and amplitude to explore conservation of energy.
Objective
Confirm that an undamped mass-on-a-spring obeys simple harmonic motion driven by Hooke's law F = −k·x, and verify the closed-form period T = 2π√(m/k). Measure the displacement and velocity readouts against the predicted sinusoid x(t) = A·cos(ωt) with ω = √(k/m), and check that total mechanical energy ½k·x² + ½m·v² remains constant throughout the swing. The spring is treated as massless, perfectly Hookean, and free of damping or friction.
Setup
- Press Reset to return the mass to its starting displacement and zero out the Time readout. The Displacement and Velocity readouts repopulate from the current slider values, and the Period T readout shows the predicted T for the chosen k and m.
- Set the Spring Constant slider to 10 N/m. This is a moderate stiffness that produces a clearly visible swing without slamming the mass against the canvas edges at the chosen amplitude.
- Set the Mass slider to 1.0 kg. With k = 10 N/m, this gives a clean angular frequency ω = √(10/1) ≈ 3.162 rad/s and a period close to 2 s, easy to time by eye against the readouts.
- Set the Initial Velocity slider to 0.00 m/s. Releasing the mass from rest at peak displacement makes the predicted motion a pure cosine, so the analysis section can compare against x(t) = A·cos(ωt) directly.
- Set the Amplitude slider to 2.0 m. The mass starts 2 m below equilibrium (positive displacement is downward) and the dashed equilibrium line marks x = 0 on the canvas.
- Press Start. The mass oscillates vertically along the centerline; the Time, Displacement, and Velocity readouts update live, and a fading amber trail traces recent positions for visual comparison.
Analytical Prediction
For an undamped spring-mass system, Newton's second law combined with Hooke's law F = −k·x gives m·ẍ = −k·x, whose solution is x(t) = A·cos(ωt + φ) with angular frequency ω = √(k/m) and period T = 2π√(m/k). Released from rest at x = A, the phase φ = 0, so x(t) = A·cos(ωt) and v(t) = −A·ω·sin(ωt). With k = 10 N/m, m = 1.0 kg, A = 2.0 m, v₀ = 0:
Energy oscillates between purely elastic (PE = 20 J at x = ±A, KE = 0) and purely kinetic (KE = 20 J at x = 0, PE = 0). At the first quarter-period, t ≈ 0.497 s, the mass should cross equilibrium with velocity ≈ −6.325 m/s.
Results Analysis
Once the run is underway, sample the readouts at four reference times. Near t = 0.00 s the Displacement reads ≈ 2.000 m and Velocity ≈ 0.000 m/s. Near t ≈ 0.50 s (one quarter period) Displacement should pass through ≈ 0 m and Velocity should peak near −6.325 m/s. Near t ≈ 0.99 s (half period) Displacement reaches ≈ −2.000 m with Velocity ≈ 0. Near t ≈ 1.99 s the mass returns to the starting state, completing one cycle. The Period T readout should already display ≈ 1.99 s, matching the timed return. Confirm energy conservation by computing ½k·x² + ½m·v² at any sampled instant — for x ≈ 1.414 m and v ≈ ±4.472 m/s the sum is 10.0 + 10.0 = 20.0 J, equal to the initial ½k·A². Agreement within roughly 0.5% over several cycles confirms the SHM model.
Source of Error
What this sim does NOT model: the spring's own mass and inertia, gravity (the system is treated as horizontal, so weight does not enter the equation), air drag, internal damping in the spring material, non-Hookean stiffening at large amplitudes, or finite spring travel limits. The mass is a point on an ideal Hookean spring with no dissipation. The closed forms F = −k·x and T = 2π·√(m/k) assume the same idealizations, so they cancel rather than contributing to the residual amplitude or period. The remaining gap between prediction and readouts is therefore purely numerical, not physical.
Further Exploration
- Hold Mass at 1.0 kg and step Spring Constant through 5, 10, 20, 40 N/m, recording the Period T readout for each. Plot T versus √(1/k) on paper — the points should fall on a straight line through the origin with slope 2π·√m, confirming T ∝ 1/√k.
- Hold Spring Constant at 10 N/m and step Mass through 0.5, 1.0, 2.0, 4.0 kg. Predict each period from T = 2π√(m/k) before reading the display, then check that doubling the mass multiplies T by √2 ≈ 1.414, not by 2.
- With k = 10 N/m, m = 1.0 kg, set Amplitude to 1.0 m and Initial Velocity to 0, then to 6.325 m/s. Both releases store the same total energy E = ½k·A² + ½m·v₀² = 5.0 + 20.0 = 25.0 J, predicting an effective amplitude of √(2E/k) ≈ 2.236 m. Confirm by reading peak Displacement.
- Set Amplitude = 2.0 m and Initial Velocity = +6.325 m/s (downward kick at maximum stretch). The motion is no longer a pure cosine — derive the new amplitude and phase from x(t) = A·cos(ωt + φ) and compare the predicted peak displacement against the readout.
- Step Spring Constant from 2 N/m up to 50 N/m at fixed mass. Predict at what k the period drops below 1.0 s, then verify on screen. Why does increasing k shorten T while increasing m lengthens it?