oneshotlm
Compare all models on this prompt →

Double pendulum · qwen3.7-plus

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 a double pendulum simulation with:
1. Correct equations of motion (Lagrangian mechanics)
2. Canvas rendering
3. Arms drawn
4. Colorful fading trail of the tip

Let me recall the equations of motion for a double pendulum. The Lagrangian approach gives us:

For a double pendulum with masses m1, m2 and lengths l1, l2:

θ1'' = (−g(2m1+m2)sin(θ1) − m2*g*sin(θ1−2θ2) − 2sin(θ1−θ2)*m2*(θ2'²*l2 + θ1'²*l1*cos(θ1−θ2))) / (l1*(2m1+m2−m2*cos(2θ1−2θ2)))

θ2'' = (2sin(θ1−θ2)*(θ1'²*l1*(m1+m2) + g*(m1+m2)*cos(θ1) + θ2'²*l2*m2*cos(θ1−θ2))) / (l2*(2m1+m2−m2*cos(2θ1−θ2)))

I'll create a single self-contained HTML file with:
- A canvas element
- CSS styling for a dark background
- JavaScript implementing:
  - Runge-Kutta 4th order integration for accuracy
  - Trail with fading colors (using HSL color cycling)
  - Drawing arms and pivot points
  - Smooth animation loop

Let me write this up nicely.
write /workspace/index.html (8559 bytes)
toolResult

Successfully wrote 8559 bytes to /workspace/index.html

assistant
thinking
The file has been written successfully. Let me verify it's there.

Done! The file `index.html` is in the current directory. Here's what it includes: ### Physics - **Correct Lagrangian equations of motion** for a double pendulum with two point masses and rigid massless arms - **4th-order Runge-Kutta integration** with 8 substeps per frame for numerical stability - Adjustable gravity, damping, and trail length via sliders ### Visuals - **Arms** drawn as lines from pivot → mass 1 → mass 2 - **Colorful fading trail** of the second mass tip, cycling through the full HSL hue spectrum with per-segment opacity fade - **Glowing masses** — mass 1 in purple, mass 2 in the current trail color - **Tip glow** radial gradient effect - Dark background with subtle purple box shadow ### Interactivity - **Gravity slider** — change gravitational strength - **Damping slider** — add energy dissipation - **Trail length slider** — control how many trail segments to keep (50–2000) - **Reset button** — randomizes initial angles and clears the trail - Real-time energy and angle readout at the bottom

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.7-plus
vendorQwen
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Double pendulum animates continuously with colorful fading trail; sliders/reset present but pointer/keyboard inputs don't visibly alter physics beyond normal chaotic evolution.

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 motion1.6%
on click1.6%
on drag1.4%
on wheel0.9%
on enter + space0.9%
on arrow keys0.7%
on w/a/s/d1.7%
frame spread9.3 / 255
console errors0
js errors none

METRICS

runtime74.8s
tokens in6.8k
tokens out3.9k
cached0
cost / run$0.0071