Interactive Double Pendulum Playground
theabbie.github.io
Interactive Double Pendulum Playground
1–10 of 26 posts
Re: Interactive Double Pendulum Playground
#2Re: Interactive Double Pendulum Playground
#3Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
https://github.com/theabbie/DoublePendulum?tab=readme-ov-fil...
Re: Interactive Double Pendulum Playground
#4Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
Re: Interactive Double Pendulum Playground
#5Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
Yes I think the physics is wrong
Re: Interactive Double Pendulum Playground
#6Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
Re: Interactive Double Pendulum Playground
#7If you want to see what a real physically sensible double pendulum sim looks like:
https://www.myphysicslab.com/pendulum/double-pendulum-en.htm...
Re: Interactive Double Pendulum Playground
#8Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
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:
getUpperBob() {
const { x0, y0, ang0, l0 } = this;
const { x, y } = this.calculateBobPosition(x0, y0, ang0, l0);
return { x, y };
}
getLowerBob() {
const upperBobPos = this.getUpperBob();
const { ang1, l1 } = this;
const { x, y } = this.calculateBobPosition(
upperBobPos.x,
upperBobPos.y,
-ang1,
l1
);
return { x, y };
}
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.
[2]: https://lpsa.swarthmore.edu/NumInt/NumIntFourth.html##sectio...
Re: Interactive Double Pendulum Playground
#9Earlier quoted context omitted.
Yes I think the physics is wrong
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
Re: Interactive Double Pendulum Playground
#10Anyone else feel like the pendulum motion seems off? Maybe the default mass settings are weird, but the movement just does not look physical to me.
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…