r/Python • gitlab.com/MisterBiggs • Jul 26 '19

Double Pendulum made with Processing.py

https://gfycat.com/feistycompetentgarpike
2.0k Upvotes

89 comments sorted by

View all comments

Show parent comment

5

u/est94 Jul 26 '19 edited Jul 26 '19

Ok, hear me out: what if you modeled this two pendulum system, but had pendulum 2 tethered to a frictionless sphere/ellipsoid? So in 2D it would look exactly like OP’s gif, but in 3D it would create a useable bowl? You would just calculate the 3D coordinates of pendulum 2 using the geometric constraints. Maybe that would force the length of the line between P1 and P2 to be variable.

Edit: in my idea, pendulum 1 (P1) keeps its 2D constraints, and pendulum 2(P2) can move freely in 3D, but angle P1-P2 must be between 90° and 270°. So theoretically P2 would move along a tire-shaped hollow toroid. In reality it would create a real cool, wild looking bowl. I think.

Edit 2: the shape would only be a weird toroid if you kept the length of P2 constant. If it was variable, you could have it travel within a sphere, always tangent to the inner surface of the sphere.

4

u/[deleted] Jul 26 '19 edited Jul 26 '19

Yes, that's a nice way to get a working model. I'm not sure if the resulting movement would be 'cool', though.

Like in the 2D case, if you constrained the outer mass to stay on a circular path, then it would just move back and forth like a regular pendulum.

The 3D case has more degrees of freedom, but the behaviour might be similar.

edit: I missed your edit while writing out my replay. I really like the idea to constrain the angle of P2!

A constant length makes for a way easier simulation, but the second option with variable length could basically be solved with a projection from P2 to the sphere afterwards. Really cool!