If you want to see what a real physically sensible double pendulum sim looks like:
https://www.myphysicslab.com/pendulum/double-pendulum-en.htm...
EDIT: I just noticed someone found an error and apparently it's fixed now.
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! :)
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.
[0] https://news.ycombinator.com/from?site=theabbie.github.io
If not, describe what feels off, as it feels fine to my untrained eyes after the sign fix.
Evidlo•2d ago
navtoj•2d ago
https://github.com/theabbie/DoublePendulum?tab=readme-ov-fil...
WithinReason•2d ago
kookybakker•2d ago
probabletrain•2d ago
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
Evidlo•1d ago
mihau•2d ago
magicalhippo•2d ago
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.
[1]: https://dassencio.org/46
[2]: https://lpsa.swarthmore.edu/NumInt/NumIntFourth.html##sectio...
Evidlo•1d ago
magicalhippo•1d ago
But no, PR was merged in short order. Lesson learned.
cabirum•3h ago
pansa2•1h ago
https://news.ycombinator.com/item?id=26998308