hello. When I tried running the 'sols' part of the code, when you solve the systems of Lagrage's equations. My jupyter lab can't seem to be able to finish loading that code. I don't know why that is. Could someone please help? Everything else was fine.
I am having the same problem. I'm on a 2019 Intel i9 MacBook Pro running Python 3.10. When I run the posted copy of vid32.ipynb, it gets "stuck" on the sols computation. It's been running over 9.5 hours and the Python process is consuming one of the CPUs (staying ~100% consistently). vpython is v7.6.3 and sympy is v1.9. This is the third attempt to run it. I terminated the last one after 9.5 hours, but then decided to give it another try. There are no errors in the Jupyter log so far. If this fails to complete, I'll try breaking up the sols into four different solution invocations. Anybody else having this problem? Any thoughts, Mr. P?
@@MrPSolver Correct. I cut off the last long run at 39+ hours. Now I'm experimenting with partial solutions. [LE1, LE2], [LE1, LE3], [LE2, LE4] all solve in a short amount of time. I'm now trying [LE1, LE2, LE4]. It's been keeping one CPU ~100% for over 11 minutes without yielding a solution set.
@@MrPSolver The laptop has 32GB of RAM. The Python Kernel computing the solution set is reported as having 827.1MB of private memory. Kind of unrelated, but is doub_pen_3d.png posted somewhere? It's referenced by the second cell in the notebook.
Very nice & tidy presentation. If you want to extend it, consider checking "the imperfection of reality"; in other words, how a realisation of an idea deviates from its true meaning. In your pendulum case, there are two key equations sets: the symbolic one (idea) and the numerical representation (reality). Consider checking how the reality outcome changes depending on the precision and time step parameters of the numerical equation solver. You might find how 'realities' (simulated pendulum movements) diverge from each other by even the slightest inaccuracies of 'ideas' implementations (symbolic pendulum equations).
Thank you for these awesome videos, they have really helped me when I was dealing with robotics theory. I'd love to see similar video that deals with an inverted double pendulum or applied forces on a double pendulum.
Dude I swear... I took 5 years off between my junior and senior year to work abroad so grad school wasn't as appealing when I graduated at almost 28 but now that I work as a software engineer I feel like I'm catching up on the stuff I missed out on with these videos.
This does not work well because of the choice of coordinates. You create a singularity at the poles (what is phi if the pendulum heads straight down?) The problem occurs for both the single spherical pendulum and double spherical pendulum. If you examine the energy of the system, you should notice dramatic change if either pendulum approaches either pole - even if you use adaptive high order RK-methods.
Investigatig why this instruction specific to this solution, --> sols = sp.solve([LE1, LE2, LE3, LE4], (the1_dd, the2_dd, phi1_dd, phi2_dd), simplify=False, rational=False) as supposed to The Double_Springed Pendulum, appears to take forever: Pay attention! --> sols_1 = sp.solve([LE3, LE4], [the1_dd, the2_dd], simplify=False, rational=False) We get --> dict_keys([Derivative(\theta_1(t), (t, 2)), Derivative(\theta_2(t), (t, 2))]) Next --> sols_2 = sp.solve([LE1, LE2], [phi1_dd, phi2_dd], simplify=False, rational=False) We get --> dict_keys([Derivative(\phi_1(t), (t, 2)), Derivative(\phi_2(t), (t, 2))]) as expected. By comparison: --> sols_1 = sp.solve([LE1, LE2], [the1_dd, the2_dd], simplify=False, rational=False) This goes nowhere. Consequently: --> sols = sp.solve([LE1, LE2, LE3, LE4], (phi1_dd, phi2_dd, the1_dd, the2_dd), simplify=False, rational=False) This can not work on the basis of prior discovery. 😮💨 Is this magic, or is it the greatest heap of nonsense ever? 😖
odeint is deprecated as mentioned in the documentation. solve_ivp is recommended and offers multiple solvers and more control. I've been working on a too big project for me to visualize different initial parameters of a "simple" 2D double pendulum.
I managed to create a function for the shadow size-adjusting, here's the code: def shadow(r, i, z1, z2): return r + 1/3 * np.abs(r - z1[i]/np.min(z1)), r + 1/3 * np.abs(r - z2[i]/np.min(z2)) And in the animation while loop: shadow = shadow(insert_sphere_radius_here, i, z1, z2) s1.radius, s2.radius = shadow Where z1 and z2 are the z-position arrays for the pendula.
Hello sorry. I was wondering why should one use Python when, I have heard at least, that Matlab is much faster than python in its computational abilities. Sorry about my ignorance. I am only a high school student. Also, could you please create a tutorial for this library as well? Thank you.
just because something else is better doesn't mean everyone should use it, I could tell u eating worms is the healthiest thing in the world, but is it fun? no, Matlab has a lotta math and is fast too but python is a general purpose language, u can setup a backend server and host this simulation on a website in minutes, u can turn it into a game, u can compile it into an app, u can do anything with this
there's two main points for why you might use python over matlab, which @Mohamed already touched on, but both hinge on the fact that python is a general purpose language. 1.) If you write it in python, you can easily push it onto e.g. a webserver, into a game, desktop app or whatever and deploy it as an actual application, whereas matlab is just useful in a _lab_ context. 2.) Many people already know python and are very familiar with optimiizing python code. For them, it's much faster to learn just a single new library, rather than a total different language. I also would call to your attention the fantastic libraries numpy, pandas and scipy, which are incredibly fast, by allowing you to do calculations in C and even using processes like SIMD if you optimize for it, reducing any computational deficit vs other languages to a minimum for these time-consuming calculations.
@@mohamedaminebenbouali2941 Sorry, yes. What you have mentioned are thinks that are for general usage e.g. creating websites but I am talking about in Physics. What is it about python that can't be done in Matlab, or re-phrased, what can python do better than Matlab so that I should prefer it over Matlab? Thank you.
I would like to add to what @Mohamed Amine Benbouali and @Julian S. have said -- While you are in school, Matlab is very easy to get. I admit it is powerful and easy to learn. But after you leave school, Matlab is quite expensive. The Matlab community is mostly inside academics. Python, along with a very large number of modules, are free. For example, look into "Anaconda." Python is only a little harder to learn than Matlab. When you "publish" (for example, github) your Python code, people all over the world, inside and outside academics, will immediately be able to use your code. In this way, you will join a much larger community, be able to "meet" people, maybe some who can give you ideas about how to add to your project.
Hi @Mr.P Solver! Many thanks for the great video and skript. Are you aware of any experiments to transfer theory into practice for the 3D version? Or existing/ available simulations in CAD software? Many thanks!
congrats for the video, the post processing was amazing. Do you know how to add a fixed coordinate system (with labels) to the animation in order to visualize the pendulum movement more easiliy?
Another SymPy odety: LE1 = sp.diff(L, the1) - sp.diff(sp.diff(L, the1_d), t).simplify() This instruction seems too difficult for SymPy. Although it will produce a result eventually, the solver in it's function, was shown to walk off into oblivion. However, LE1 = sp.diff(L, the1) - sp.diff(sp.diff(L, the1_d), t) LE1.simplify() when broken up into two separate jobs, it was found to work fine, and the result allowed the solver to return the correct solution swiftly.
Good Day to you sir.... Very Interactive lessons indeed. I am very much getting benefitted from these. A request sir, Can you make videos on Discrete Element Simulation of rigid granular medium via Python coding ?