Double pendulum · hy3
Simulate a chaotic double pendulum on a canvas using the correct equations of motion, drawing the arms and a colorful fading trail of the tip.
transcript · 4 messages
Simulate a chaotic double pendulum on a canvas using the correct equations of motion, drawing the arms and a colorful fading trail of the tip.
I'll build a chaotic double pendulum simulation with physics-based equations of motion, colorful visualization, and a fading trail. Let me create this as a self-contained HTML file.
/workspace/index.html (10989 bytes)Successfully wrote 10989 bytes to /workspace/index.html
The chaotic double pendulum simulation is ready at `/workspace/index.html`. Here's what it includes: **Physics (correct equations of motion):** - Full Lagrangian-derived ODEs for a double pendulum with distinct masses and lengths - 4th-order Runge-Kutta (RK4) integration for numerical stability - 4 sub-steps per frame to keep the simulation from exploding **Visualization:** - Two rods with gradient-shaded bobs (grey/white for bob 1, orange for bob 2) - **Colorful fading trail** of the tip — colors shift from deep pink → orange → cyan along the trail, with alpha and linewidth ramping up for the newest points - Motion blur effect via semi-transparent background clears (`rgba(10,10,10,0.15)`) - An energy bar at the bottom to visualize conservation (kinetic + potential) **Interactivity:** - **Restart** — randomizes the tiny initial perturbation (the source of chaos) - **Pause/Play** - **Clear Trail** - **Speed slider** (0.2x–3x) - **Gravity slider** (1–20) Open `index.html` in any browser to watch the chaos unfold.
TAKE IT TO CODE
A single self-contained HTML file — copy it and open in any browser, or reuse the prompt with your own pi-agent run.
RUN
EVALUATION
Double pendulum animates chaotically with colorful fading trail; keyboard/mouse inputs don't visibly alter physics but simulation runs smoothly.
Vision grade · anthropic/claude-sonnet-5
MEASUREMENTS
Raw readings from the capture, not a verdict — the grade above is the only judgement. Percentages are how much of the screen changed; the measure under-reports sparse motion on a dark background.