Double pendulum · ling-2.6-1t
Output generated Cost / run $0.0040 Runtime 40.5s
Prompt for this run
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.
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
METRICS
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 create a single-page web app that simulates a chaotic double pendulum with proper equations of motion, drawing the arms and a colorful fading trail of the tip.
/tmp/ws/index.html (16069 bytes)Successfully wrote 16069 bytes to /tmp/ws/index.html
I've created a self-contained HTML file that simulates a chaotic double pendulum with: **Physics:** - Correct equations of motion derived from Lagrangian mechanics - RK4 (Runge-Kutta 4th order) integration for numerical stability - Conservation of energy monitoring - Two equal-mass bobs with equal-length arms under gravity **Visual Features:** - Smooth gradient background with subtle grid - Colorful fading trail behind the tip that follows a hue gradient over time - Glowing bobs with radial gradients - the tip has a pulsing outer glow - Gradient-colored pendulum arms - Small phase-space indicator in the corner - Real-time energy and angle display **Interactions:** - **Click** anywhere on the canvas to reset with random initial conditions - **New Random** button to randomize initial angles/velocities - **Toggle Trail** to show/hide the fading trail - **Pause** button to freeze the simulation The simulation demonstrates chaotic behavior - tiny changes in initial conditions lead to dramatically different trajectories over time, which is the hallmark of deterministic chaos in double pendulum systems.