Simulation

Pendulum Energy Bars

Energy & WorkConservation of energy

A swinging pendulum with KE and PE bars exchanging; total energy stays flat without friction, decays with damping

Objective

Verify that kinetic and potential energy are exact complements in an undamped pendulum — their sum equals E₀ = mgL(1−cosθ₀) at every instant. With damping added, confirm that the total energy envelope decays as E₀·e^(−2γt) where γ = b/(2mL²), while the KE↔PE exchange shape remains unchanged. Key idealizations: point-mass bob, massless rigid rod, no aerodynamic drag beyond the linear damping term.

Setup

  1. Set Initial Angle θ₀ to 30°, Damping b to 0, Bob Mass m to 1.0 kg, and Rod Length L to 1.0 m. Note the initial PE readout — it should read ≈ 1.314 J and KE should read 0.000 J.
  2. Press Start and watch the KE and PE bars oscillate. Observe that the Total E bar stays flat and the Total E readout does not change. Record the Total E value at t = 0, t = 5, and t = 10 seconds.
  3. Press Reset. Set Damping b to 0.5 N·m·s/rad (all other sliders unchanged). Press Start and observe the Total E bar — it should now visibly decrease over time, while KE and PE still mirror each other.
  4. Press Reset. Set Damping b to 2.0, then press Start. Confirm the system loses nearly all energy within about 5 seconds — the bars shrink to near zero.
  5. Press Reset. With b = 0, sweep the Initial Angle slider from 5° to 30° without starting: observe how the PE bar height (= E₀) changes at each angle, and record the predicted PE for θ₀ = 30°.

Analytical Prediction

For θ₀ = 30°, m = 1 kg, L = 1 m, g = 9.81 m/s², the initial total energy is:

E₀=m·g·L·(1 − cosθ₀)
=1 · 9.81 · 1 · (1 − cos 30°)
=9.81 · (1 − 0.7071)
=9.81 · 0.2929
1.314 J

With b = 0, Total E stays at 1.314 J for the entire 30 s run. With b = 0.5, γ = b/(2mL²) = 0.5/(2·1·1) = 0.25 s⁻¹, and at t = 5 s:

E(5)=E₀ · e^(−2γt)
=1.314 · e^(−2 · 0.25 · 5)
=1.314 · e^(−2.5)
1.314 · 0.0821
0.236 J

With b = 2, γ = 1.0 s⁻¹, at t = 5 s: E(5) ≈ 1.314·e^(−10) ≈ 1.3 × 10⁻⁴ J — effectively zero.

Results Analysis

With b = 0, read the Total E readout at t = 0, t = 5, and t = 10 s. All three values should match ≈ 1.314 J (within ±0.03 J, i.e., ±1%). At any moment, verify KE + PE ≈ Total E by mentally adding the keOut and peOut readouts — they should sum to the eOut value. With b = 0.5, read eOut at t = 5 s: expected ≈ 0.236 J. The energy-vs-time trace in the right panel should show a smooth exponential curve from 1.314 J at t = 0 curving down toward zero. With b = 2.0, observe that the bars collapse to near-zero within the first 5 seconds — the eOut readout should read below 0.010 J by t ≈ 3 s. Confirm that at any instant during an undamped run, the KE bar and PE bar heights sum to 1.0 in the normalized chart.

Source of Error

This simulation models the bob as a point mass on a massless rigid rod — a true simple pendulum. The damping term is purely rotational viscous damping (τ_damping = −b·ω), which is a linear model that does not capture aerodynamic drag (quadratic in velocity) or pivot friction. The initial condition assumes the pendulum is released from rest (ω₀ = 0), so all initial energy is potential. The analytical prediction uses the same point-mass and linear-damping assumptions, so these idealizations cancel in the comparison. The residual gap between the predicted 1.314 J and the simulated eOut readout is therefore purely numerical — RK4 integration error over the run, not a physical discrepancy.

Further Exploration