Double pendulum · granite-4.1-8b
Output generated Cost / run $0.0004 Runtime 12.0s
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.
index.html (3037 bytes)Successfully wrote 3037 bytes to index.html
The single‑page web app `index.html` has been created in the current directory (`/tmp/ws`). It includes: - **CSS** inside a `<style>` tag for minimal styling. - **JavaScript** inside a `<script>` tag that: - Implements the correct coupled equations of motion for a chaotic double pendulum. - Uses a small time step (`dt = 0.01`) and forward‑Euler integration. - Draws the two arms on a `<canvas>` and renders a colorful, fading trail of the tip’s path. - Updates continuously with `requestAnimationFrame`. You can open `index.html` in any modern browser to see the chaotic motion. No external resources are required; the entire simulation runs sandboxed.