Hint: a big Mass1 and Phi1 makes for a nice wobbly configuration.
Double Pendulum in fewer than 100 lines of JavaScript
11–20 of 55 posts
Re: Double Pendulum in fewer than 100 lines of JavaScript
#12Re: Double Pendulum in fewer than 100 lines of JavaScript
#13Re: Double Pendulum in fewer than 100 lines of JavaScript
#14Re: Double Pendulum in fewer than 100 lines of JavaScript
#15Would be even better, IMO, with a line in the simulation showing the path traced by each pendulum over time, preferably the arcs drawn could phase through different colours (and possibly decay in visibility). Nice work though.
Re: Double Pendulum in fewer than 100 lines of JavaScript
#16I remember when I first learned about the Lagrangian, and my mind was blown that really complicated problems could be wrangled so easily. Thanks for sharing this :)
Me too. Lagrangian mechanics are almost the only thing about my physics undergrad where I still recall thinking "wow this is awesome!"
Re: Double Pendulum in fewer than 100 lines of JavaScript
#17Re: Double Pendulum in fewer than 100 lines of JavaScript
#18Re: Double Pendulum in fewer than 100 lines of JavaScript
#19It barely exceeds 100 lines of js though...
I have a whole bunch of similar physics simulators here: http://www.dllu.net/programming/physics/
Re: Double Pendulum in fewer than 100 lines of JavaScript
#20Ain't that a chaotic system which is not deterministic?
Chaotic systems are deterministic (as shown by a deterministic computer algorithm simulating one). They just aren't predictable except by simulating them (which constrains us by time and accuracy).
Chaotic systems are very sensitive to input conditions, where a tiny change yields a completely different result.
With a non chaotic system a small change in the input yields are small change in the output, so it's possible to calculate approximately and get useful results, not so with Chaotic systems.