oneshotlm
Compare all models on this prompt →

Double pendulum · grok-4.3

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 · 8 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 task is: "Build a single-page web app and write it ALL into one self-contained file named index.html in the current directory: CSS in a <style> tag, JS in a <script> tag, inline — do not create se...First, I need to recall the correct equations of motion for a double pendulum.

For a double pendulum with masses m1, m2, lengths l1, l2, gravity g.

The angles θ1, θ2 from vertical.

The accelerations:

Let me derive or recall:

a1 = (g*(2 m1 + m2) * sin(θ1) + m2 * g * sin(θ1 - 2*θ2) + 2 * sin(θ1 - θ2) * m2 * (l2 * ω2**2 + l1 * ω1**2 * cos(θ1 - θ 2))) / (l1 * (2*m1 + m2 - m2 * cos(2*(θ1 - θ2))))

No, signs: since θ from vertical, sin terms are negative for torque.
bash {"command":"ls -la /workspace"}
toolResult

total 4 drwxrwxrwx 2 node node 64 Jul 22 17:16 . drwxr-xr-x 1 root root 4096 Jul 22 17:16 ..

assistant
thinking
The directory is empty. I need to create index.html with a self-contained single-page web app simulating a chaotic double pendulum.
First, I need to recall the correct equations for a double pendulum.

The standard equations for a double pendulum with masses m1, m2, lengths l1, l2, angles θ1, θ2 from the downward vertical, gravity g.

The accelerations:

Let’s define:

c1 = cos(θ1)

 c2 = cos(θ1 - θ2)

  s1 = sin(θ1)

  s2 = sin(θ1 - θ2)

  s3 = sin(θ2)

Then, the angular accelerations α1, α2.

A common form is:

denom = l1*l1*(m1+m 2) + l2*l2*m2 + 2*m2*l1*l2*cos(θ1-θ2)

Then:

a1 = [ -g*(2*m1 + m2)*s1 - m2*g*s2*cos(θ1-θ2) - m2*l2*ω2 ²*s2*sin(θ1-θ2) - m1*l1*ω1²*s1 - 2*m2*l1*ω1²*s2*cos(θ1-θ2) ] / denom wait, better to use the standard one I recalled earlier.
write /workspace/index.html (9810 bytes)
toolResult

Successfully wrote 9810 bytes to /workspace/index.html

assistant
thinking
The file has been created successfully. Let me verify it exists and check its size.
bash {"command":"ls -la /workspace/index.html && wc -c /workspace/index.html"}
toolResult

-rw-r--r-- 1 node node 9812 Jul 22 17:18 /workspace/index.html 9812 /workspace/index.html

assistant
thinking
The single file is done and present.

Created `/workspace/index.html` — a fully self-contained single-page chaotic double pendulum simulation with: - Accurate nonlinear equations of motion (semi-implicit Euler integrator) - Real-time colorful fading trail behind the tip - Draggable tip to set initial conditions - Pause/reset + length/gravity controls - Touch + keyboard shortcuts - No external dependencies or network usage

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

modelgrok-4.3
vendorxAI · Grok
harnesspi-agent
generated2026-07-22

EVALUATION

4/5 working

Double pendulum simulates chaotic motion with colorful fading trail; click/drag/space pause work, arrows/wasd have no distinct effect.

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 motion2.4%
on click2.3%
on drag2.1%
on wheel1.6%
on enter + space1.5%
on arrow keys0.5%
on w/a/s/d0.0%
frame spread14.5 / 255
console errors0
js errors none

METRICS

runtime77.7s
tokens in4.9k
tokens out6.5k
cached8.1k
cost / run$0.0239