I built a physical version of this back when I was teaching HS math and science. I used two bicycle hubs, and attached metal arms to each. I put an LED on the second hub, and the end of the second arm.
For the demonstration, I'd have it under a blanket in the front of the room when students came in. I'd turn the lights out, only turn the outer LED on, and set it in motion. Then I'd cover it up, turn the lights on, and ask students to sketch what they thought was under the blanket. Then I'd turn the lights out again, turn both LEDs on, and set it in motion again.
Most people were able to sketch something pretty close to a double pendulum after that second demonstration. I also set up a camera and did some time lapses, and got pictures that look just like this online demo.
I don't see the difference. The motion in the version you linked is slower but I guess it can be fixed changing g. What are the visible errors in the main post?
EDIT: I just noticed someone found an error and apparently it's fixed now.
The motion is still off, as it was 2 days ago [0] in the previous submission. There's something that just doesn't look right, and some particular setups trigger very unrealistic behaviors.
Not sure if this got a second lease on life from the mods after clearing the old comments and resetting the submission date to today, or how did it make the front page again.
The system is periodical; not counting the absolute angle but the velocities, angular velocities, and the angle at the joint are all periodical functions.
When the angle at the joint is 180° the Energy and Angular momentum determines v_1 and v_2, the velocities of the masses. It is known that Energy and Angular momentum both conserve.
Therefore the system will play out the same after states when the inner joint is 180°, and all the parameters will be periodical between 2 such states.
You can observe this in the demonstration in TFA: set gravity to 0, and observe how the graph rotates, especially the furthest points from the origin (where the angle at the joint is 180°).
edit: there are probably 2 different solutions for when the joint angle is 180°? I've found a graph where one furthest place from the origin is really pointy, and then the other is rather round.
It's way off. My first guess was that there was something wrong with the physics code, but after carefully checking against this[1] derivation of the Hamiltonian it seemed fine, and once I wrapped my head around the JavaScript the RK4 integration[2] checked out as well.
So, what else might be wrong I wondered. Well, it seems to move in the wrong direction... so I checked how the pendulum is displayed. And sure enough, I think there's a sign error:
Note how the upper bob uses ang0 while the lower one has -ang1. Meanwhile the physics derivation assumes both angles are against the vertical, so have same sign.
Changing -ang1 to ang1 does indeed make the pendulum move in a natural way, except now dragging it is flipped. Ie you drag it left and it moves right. Another sign error in setLowerBobPos. Fixing that as well it now works as I'd expect.
When you bring up the lower mass and let it go, it seems to push the upper mass away, which should never happen. This whole site smells off vibe coded jank.
A vibe-coded double pendulum sim should produce a much better result than the physics on this page. Claude Code made this just now off one prompt, the physics are much better: https://keir.is/swinging
For the demonstration, I'd have it under a blanket in the front of the room when students came in. I'd turn the lights out, only turn the outer LED on, and set it in motion. Then I'd cover it up, turn the lights on, and ask students to sketch what they thought was under the blanket. Then I'd turn the lights out again, turn both LEDs on, and set it in motion again.
Most people were able to sketch something pretty close to a double pendulum after that second demonstration. I also set up a camera and did some time lapses, and got pictures that look just like this online demo.
Super fun project, and students loved it! :)