Live data from Hacker News

Double Pendulum in fewer than 100 lines of JavaScript

physicsandbox.com

11–20 of 55 posts

Re: Double Pendulum in fewer than 100 lines of JavaScript

#13

You can get a vigorous chaotic motion going with a high top mass, low bottom mass, and high angles.

That was certainly my goal =) 1. Max Mass 1 2. Min Mass 2 3. Max Phi 1 4. Min Phi 2

Just the opposite, and you get a "hinky" kind of motion.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#14
I remember about 3-4 years ago, a couple of programmers talking. One said to the other, "you know, javascript is getting respectable now." I'm blown away by how such a complicated system can be described and implemented in so few lines of code. When I went to school, seriously complicated programs took a lot of time to write and render. The easy way involved Matlab because it had a lot of graphics libraries. It looks like javascript really has turned the corner into becoming a language with serious possibilities.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#15
post #4

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

I thought the same .. though there's no decay but it's nice to see the traced path: http://jsfiddle.net/m5MZe/1/

Re: Double Pendulum in fewer than 100 lines of JavaScript

#16
post #5
post #2

I 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!"

Where can I find a good introduction to Lagrangian mechanics?

Re: Double Pendulum in fewer than 100 lines of JavaScript

#17
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?

College.

Re: Double Pendulum in fewer than 100 lines of JavaScript

#20
post #8
post #7

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

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.

Post reply on HN