Sample project writeup — replace with a real one. Its physics + cs tags land it between chalkboard and terminal: dark, with dust and a faint grid.
Given two points, what curve gets a frictionless bead from the top one to the bottom one fastest under gravity? Not the straight line — Bernoulli's 1696 challenge, and the answer that launched the calculus of variations: the cycloid, the path traced by a point on a rolling wheel's rim.
This project is a small browser simulator that races beads down a straight line, a circular arc, a user-drawn curve, and the cycloid, side by side. Watching the cycloid bead dive steeply to build speed early — and still arrive first despite the longer path — does more for intuition than the derivation ever did for me.
The one equation that matters
Energy conservation fixes the speed at any depth: . So the total time along a curve is the functional
and minimizing it with the Euler–Lagrange machinery (the integrand has no explicit , so the Beltrami identity applies) gives — the differential equation of a cycloid of rolling radius .
Simulation notes
The integrator is a plain RK4 on arc length, not a physics engine — each curve is arc-length parameterized, and the bead's state is with from the local slope. Two details bit me:
- The cycloid through two arbitrary points requires solving a transcendental equation for the rolling radius; Newton's method on converges in a handful of iterations from a decent bracket.
- The straight-line bead must not win at shallow angles due to integration error — a good end-to-end test is checking the analytic straight-line time against the simulated one.