The Double Pendulum in PYTHON

preview_player
Показать описание
In this video I derive the system of differential equations for the double pendulum using sympy, solve the system of equations numerically using scipy's odeint function, and create an animation of the double pendulum using matplotlib.

Code:

Discord:

Spinning Top:

Double-Springed Pendulum:
Рекомендации по теме
Комментарии
Автор

Mr. P Solver uploaded a new video... This day just becomes better :) Double pendulum - absolute classics! Thanks, man!

blackguardian
Автор

I modified the code to do 8191 differently coloured pendulums. The result is very satisfying. Thank you for introducing me to solving equations on a computer without having to do them on paper first!

ruslanart
Автор

This is exactly what i was looking for. Thank you for the amazing tutorial and explanation!

fateenahmed
Автор

Man you are a blessing. Thank you a million. Can you please just recommend a perfect starting point to learn differential equations for a beginner from 0 to 1, with the same level of depth, clarity and and an ultimate goal to master the all the variety of diff equations to the highest level possible. Thank you kindly again

cambridgebreaths
Автор

You're a very good teacher. Thanks for this.

Would there be any future video on FEM on Python?

adityaariewijaya
Автор

Whoa, wonderful job! I’ve been working on the same problem with Maxima. The process is essencially the same. I’ve been expanding the program to deal with generic number of multiplicity of the pendula. But the burden of symbolic manipulation of differential equations grew above the capacity of my computer when the number of bobs was larger than 4. I think I should try to attack the problem in colab with sympy. Great thanks for sharing!

mingshey
Автор

Hello! Great videos. I really appreciate the help. Perhaps it is worth mentioning that the chaotic behavior of the ODE in the case of the double pendulum will cause numerical error to accumulate exponentially fast in any simulation.

oceansofmath
Автор

This we very well done and explained thank you!

michaelpierce
Автор

I'm trying to replicate, and I've got one little ugly problem: sympy outputs are not wrapped into multiple lines like he has for cell 24, 27, etc. I get one loooong line I have to scroll through. Anyone faced that problem ?

Kakikiwi-eukr
Автор

You are awesome, thank you very much for your work

alekseykozin
Автор

incredible video, i learnt a lot. thank you.

julyatonon
Автор

really good video, thanks a lot. although I must admit I arrived hoping for some insight into the physics.mechanics module of sympy. Are there any reasons you choose to do things this way? I also use sympy like you did in the video, but I'm interested in knowing if there are any advantages on learning the whole sympy.physics.vectors and .mechanics, over just implementing the sympy variables and functions like this

anyway, you just earned a follower, greetings from Argentina!

agustinbrusco
Автор

Awesome video. I'll give this a try to practice.
Maybe the next video is about adding friction in the joints? 🤔

AryVinicius
Автор

I'm coding it as I'm watching. Planning to impress my friends lol

scar
Автор

You might consider making a video that could use a PID to get the pendulum holding upright? Not sure if PID works for that or not

ivolol
Автор

Hello. Sorry about my ignorance. I don't actually know much about programming but I had a question if it is all right with you. Did you solve the Euler Lagrange equations using the Runge Kutta method? If not then is there to just immediately employ the Runge Kutta method to the Lagrange's of motion without deriving them first on python.
Thank you.

babajani
Автор

Awesome! Immediately saw this right now on being uploaded and immediately watched. Once again, very nice and inspiring.

Now next do a spherical double pendulum 😁😁😁 haha jk.

AJ-etvf
Автор

very nice explaination, I tried using the same principle to simulate a double inverted cart pole. After adding and modifiying the equations to include a cart and its movement and the force applied on it, but I faced an error when trying to use odeint the way you explained in the video. any tips?

owisalsabbagh
Автор

Thank you so much for such a nice presentation. It was greatly helpful. Could you also go through plotting time and energy of the system?(E=T+V)

shohrehh
Автор

If your animation isn't working at the end, check the second last line, try changing it to:
ani = matplotlib.animation.FuncAnimation(fig, animate, frames=1000, interval=50)

skillick