Live data from Hacker News

Double Pendulum in fewer than 100 lines of JavaScript

physicsandbox.com

21–30 of 55 posts

Re: Double Pendulum in fewer than 100 lines of JavaScript

#21
post #5

Earlier quoted context omitted.

Me too. Lagrangian mechanics are almost the only thing about my physics undergrad where I still recall thinking "wow this is awesome!"

Where can I find a good introduction to Lagrangian mechanics?

Any undergraduate classical mechanics text book such as this one should cover it: http://www.amazon.com/Classical-Dynamics-Particles-Systems-T...

Re: Double Pendulum in fewer than 100 lines of JavaScript

#22
post #5

Earlier quoted context omitted.

Me too. Lagrangian mechanics are almost the only thing about my physics undergrad where I still recall thinking "wow this is awesome!"

Where can I find a good introduction to Lagrangian mechanics?

I highly recommend Classical Mechanics by Goldstein et al.

http://www.abebooks.com/9780201657029/Classical-Mechanics-Go...

Re: Double Pendulum in fewer than 100 lines of JavaScript

#23
post #20
post #8

Earlier quoted context omitted.

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).

No, that's not it. 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.

I don't think that conflicts with what I said?

Re: Double Pendulum in fewer than 100 lines of JavaScript

#25
post #23
post #20

Earlier quoted context omitted.

No, that's not it. 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.

I don't think that conflicts with what I said?

I don't think it conflicts with it, but I believe the correct explanation has to do more with tiny changes producing big ramifications than with being deterministic or not.

That's why the "butterfly effect" is used as an explanation of chaotic systems (albeit in my opinion a not a very good one).

Edit: changed contradict to conflict

Re: Double Pendulum in fewer than 100 lines of JavaScript

#26
post #25
post #23

Earlier quoted context omitted.

I don't think that conflicts with what I said?

I don't think it conflicts with it, but I believe the correct explanation has to do more with tiny changes producing big ramifications than with being deterministic or not. That's why the "butterfly effect" is used as an explanation of chaotic systems (albeit in my opinion a not a very good one). Edit: changed contradict to conflict

For me, the most interesting part of Chaos is that it is deterministic.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#27
I was playing with the gauges in the simulator, and noticed certain values will create a system where it's possible for the lower pendulum to flip full-circle around the upper. Other parameters will create a system where that is clearly impossible. But there are some where it seems like it might be just barely possible for the lower to complete the loop.

I assume you can plot the y-axis position of the pendulums over time easily enough, and detect cross-overs... How would you discover the set of inputs where cross-overs will happen, but most infrequently?

Re: Double Pendulum in fewer than 100 lines of JavaScript

#28
post #19

I did this about a year ago: http://www.dllu.net/dp/ It barely exceeds 100 lines of js though... I have a whole bunch of similar physics simulators here: http://www.dllu.net/programming/physics/

Well, your code does not seem to work like the real world. I maxed the first scrollbar, and it does not look good.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#29
Very nice simulation you've got there! I also did a triple pendulum in JS a while ago. Quite a lot more than 100 lines of code, though. The equations of motion alone take up lots and again lots of space. (Imagine typing them in! I don't even dare to think about adding a fourth degree of freedom) http://users.jyu.fi/~samakapa/triplependulum/

My dynamics course teacher actually showed that the double pendulum can be linearized by some approximations (throwing out some negligible terms, small angle approximations etc.), and that way two modes of oscillation could be found: antisymmetric and symmetric oscillation. Just try with small initial angles with OP's script and you'll see.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#30
post #5

Earlier quoted context omitted.

Me too. Lagrangian mechanics are almost the only thing about my physics undergrad where I still recall thinking "wow this is awesome!"

Where can I find a good introduction to Lagrangian mechanics?

Landau and Lifshitz's Classical Mechanics - dense, high level, the classic text.
Post reply on HN