The brief
Write a single-file HTML/Canvas simulation of a pendulum wave: pendulums with slightly different lengths that produce visual beats. Expose sliders for and gravity.
The beat pattern arises because pendulums with carefully chosen lengths cycle in and out of phase. A strong model will derive the correct relationship between length and period rather than guessing.
What a strong output looks like
- Period used to update each pendulum independently.
- Lengths chosen so that the ensemble completes a full beat cycle in a pleasing time, often 30–60 seconds.
- Smooth integration using and .
- Sliders that update and without crashing the animation.
- Optional small-angle toggle to show the difference between and .
Scoring notes
- 40% physical accuracy: periods match the simple-pendulum formula and the beat pattern is observable.
- 30% stable integration: energy does not drift visibly over a one-minute run.
- 20% visual clarity — bobs, strings, and trails make the beat pattern easy to read.
- 10% controls — sliders are responsive and the animation stays stable while they move.