oneshotlm
Compare all models on this prompt →

Double pendulum · qwen3.5-397b-a17b

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.

⛨ sandboxed Open in new tab ↗
transcript · 4 messages
user

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.

assistant
thinking
The user wants me to create a single-page web app that simulates a double pendulum with:
1. Correct equations of motion (Lagrangian mechanics)
2. Canvas rendering
3. Arms drawn
4. Colorful fading trail of the tip

I need to implement the physics equations for a double pendulum. The equations of motion can be derived from the Lagrangian. Let me create a self-contained HTML file with all the CSS and JavaScript inline.

The double pendulum equations are quite complex. I'll use the standard form derived from the Lagrangian mechanics:

For a double pendulum with:
- m1, m2: masses
- l1, l2: lengths
- θ1, θ2: angles from vertical
- g: gravity

The angular accelerations are:

θ1'' = [ -g(2m1+m2)sin(θ1) - m2g sin(θ1-2θ2) - 2sin(θ1-θ2)m2(θ2'²l2 + θ1'²l1cos(θ1-θ2)) ] / [ l1(2m1+m2-m2cos(2θ1-2θ2)) ]

θ2'' = [ 2sin(θ1-θ2)(θ1'²l1(m1+m2) + g(m1+m2)cos(θ1) + θ2'²l2m2cos(θ1-θ2)) ] / [ l2(2m1+m2-m2cos(2θ1-2θ2)) ]

I'll implement this with Runge-Kutta integration for accuracy, draw the pendulum arms, and create a colorful fading trail.
write /tmp/ws/index.html (9599 bytes)
toolResult

Successfully wrote 9599 bytes to /tmp/ws/index.html

assistant
thinking
I've created a complete single-page web app that simulates a chaotic double pendulum. The file includes:

1. **Correct equations of motion**: Using Lagrangian mechanics to derive the angular accelerations for both pendulum arms
2. **RK4 integration**: Runge-Kutta 4th order numerical integration for accurate physics simulation
3. **Canvas rendering**: Drawing the pendulum arms, joints, and origin point
4. **Colorful fading trail**: The tip leaves a rainbow-colored trail that fades and cycles through hues
5. **Interactive controls**: Reset, Randomize, and Toggle Trail buttons
6. **All inline**: CSS in `<style>` tag, JS in `<script>` tag, no external resources

The simulation demonstrates the famous chaotic behavior of the double pendulum - tiny changes in initial conditions lead to dramatically different trajectories.

Created `index.html` with a complete double pendulum simulation featuring: - **Accurate physics**: Lagrangian equations of motion with RK4 numerical integration - **Visual elements**: Two arms with colored joints, origin pivot point - **Colorful fading trail**: Rainbow gradient trail that follows the tip position - **Interactive controls**: Reset, Randomize, and Toggle Trail buttons - **Self-contained**: All CSS and JavaScript inline, no external dependencies Open the file in a browser to see the chaotic motion - the system is highly sensitive to initial conditions, demonstrating classic chaos theory behavior.

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

modelqwen3.5-397b-a17b
vendorQwen
harnesspi-agent
generated2026-08-01

EVALUATION

4/5 working

Double pendulum simulates smoothly with colorful fading tip trail; simple UI, buttons present but no clear pointer/keyboard interaction difference.

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.

idle motion0.6%
on click1.3%
on drag1.6%
on wheel1.7%
on enter + space1.4%
on arrow keys1.5%
on w/a/s/d1.5%
frame spread16.1 / 255
console errors0
js errors none

METRICS

runtime48.3s
tokens in6.5k
tokens out3.5k
cached0
cost / run$0.0108