Most active commenters
  • Evidlo(3)
  • magicalhippo(3)

55 points melector | 24 comments | | HN request time: 2.14s | source | bottom
1. Evidlo ◴[] No.45512953[source]
Anyone 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.
replies(5): >>45513075 #>>45513084 #>>45513483 #>>45514149 #>>45538570 #
2. navtoj ◴[] No.45513075[source]
There's a "How To Use?" section on the GitHub repo page.

https://github.com/theabbie/DoublePendulum?tab=readme-ov-fil...

3. WithinReason ◴[] No.45513084[source]
Yes I think the physics is wrong
replies(1): >>45513362 #
4. kookybakker ◴[] No.45513362{3}[source]
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.
replies(2): >>45514251 #>>45518984 #
5. mihau ◴[] No.45513483[source]
Yep, it's just bad. Physics feels totally off.
6. isoprophlex ◴[] No.45513887[source]
This is hilariously bad.

If you want to see what a real physically sensible double pendulum sim looks like:

https://www.myphysicslab.com/pendulum/double-pendulum-en.htm...

replies(1): >>45522823 #
7. magicalhippo ◴[] No.45514149[source]
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:

  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.

[1]: https://dassencio.org/46

[2]: https://lpsa.swarthmore.edu/NumInt/NumIntFourth.html##sectio...

replies(1): >>45518965 #
8. probabletrain ◴[] No.45514251{4}[source]
> 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

9. Evidlo ◴[] No.45518965{3}[source]
Just made a PR
replies(2): >>45524146 #>>45537196 #
10. Evidlo ◴[] No.45518984{4}[source]
I don't think that's fair. Also the project is 4 years old so the timeline doesn't really work out for being vibe-coded.
11. gus_massa ◴[] No.45522823[source]
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.

replies(1): >>45539991 #
12. magicalhippo ◴[] No.45524146{4}[source]
I considered it, but had to go to work and I figured since the last commit was over 4 years ago it might just sit there idly, so I skipped it.

But no, PR was merged in short order. Lesson learned.

13. greenbit ◴[] No.45536844[source]
Could use a way to set some friction
14. cabirum ◴[] No.45537196{4}[source]
Hn shows this story is 3 hours old, yet your GitHub PR was made 2 days ago, linking here?
replies(1): >>45538147 #
15. japhyr ◴[] No.45537341[source]
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.

Super fun project, and students loved it! :)

16. close04 ◴[] No.45537834[source]
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.

[0] https://news.ycombinator.com/from?site=theabbie.github.io

replies(1): >>45538632 #
17. pansa2 ◴[] No.45538147{5}[source]
The story has been reposted to HN via the “second-chance pool”, which resets the dates.

https://news.ycombinator.com/item?id=26998308

18. ◴[] No.45538570[source]
19. magicalhippo ◴[] No.45538632[source]
If you tried it when it was broken, could it be you're running the old version? That is, clear your cache and try again?

If not, describe what feels off, as it feels fine to my untrained eyes after the sign fix.

20. JKCalhoun ◴[] No.45539412[source]
Love to see someone do this for a harmonigraph [1].

[1] https://en.wikipedia.org/wiki/Harmonograph

(I contributed to this Wikipedia article over two decades ago!)

21. ◴[] No.45539991{3}[source]
22. sim04ful ◴[] No.45540009[source]
Could someone explain why turning off gravity makes it path so uniform ?
replies(1): >>45540317 #
23. bheadmaster ◴[] No.45540317[source]
Because of the constant-length rigid connections, they start behaving like celestial objects in perfect orbit.