Logan Dihel
Logan Dihel
  • Видео 17
  • Просмотров 106 788

Видео

Simulate 1000 Double Pendulums in Python! (Lagrangian Mechanics)
Просмотров 2,5 тыс.10 месяцев назад
Code (github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Double Pendulum Learn how to model, simulate, and animate 1000 Double Pendulum using Lagrangian Mechanics! Learn to model both the simple and compound double pendulum. [0:00] Intro [0:43] Model Simple Pend [4:30] Model Compound Pend [6:32] Euler-Lagrange Equation [7:48] Solve Euler-Lagrange [12:27] Simulate Simple...
Kapitza Pendulum: Model + Simulate + Animate (Lagrangian Mechanics)
Просмотров 1,1 тыс.11 месяцев назад
Code (github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Kapitza Pendulum Learn how to model, simulate, and animate the Kapitza Pendulum using Lagrangian Mechanics! History of the Kapitza Pendulum: en.wikipedia.org/wiki/Kapitza's_pendulum Real-life Kapitza Pendulum: ruclips.net/video/GgYABmG_bto/видео.html
Model and Simulate Elastic Pendulum in Python (Lagrangian Mechanics)
Просмотров 4,5 тыс.Год назад
Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Elastic Pendulum Learn how to model, simulate, and animate the elastic pendulum in Python. Video Chapters 0:00 - Intro 0:14 - Defining Variables 1:00 - Defining the Lagrangian 3:13 - Equations of motion 5:37 - Simulation 8:04 - Animation 13:37 - What's Next!
MATLAB Live Script Won't Open? Easy 3 Minute Fix!
Просмотров 209Год назад
I use MATLAB live scripts for research all of the time, but every now and then they won't open. Before I discovered this trick, this meant my hard work and effort was wasted, but not anymore! Note that before you edit any file, you should always make a back up of it somewhere on your machine.
Animate Spring Mass with Affine Transformations in Python
Просмотров 6 тыс.Год назад
Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Spring Mass Learn how to animate a spring mass system using affine transformations in Python. Video Chapters 0:00 - Intro 0:17 - Stretching a Spring 1:02 - Linear Transformations 1:19 - Affine Transformations 2:21 - Python Code 2:59 - What's Next!
Model + Simulate Spring Mass in Python
Просмотров 66 тыс.2 года назад
Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Spring Mass Learn how to model and simulate a spring mass system. Create and animate plots of x, x_dot, and create a phase diagram. Video Chapters 0:00 - Intro 0:10 - Model System by Hand 1:16 - Model System w/ Python 2:00 - Simulation 2:44 - Time Domain Plot 3:13 - Phase Diagram 3:44 - Model System with Friction ...
Simulate + Animate Simple Pendulum in Python
Просмотров 13 тыс.2 года назад
Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Simple Pendulum Learn how to simulate and animate a pendulum, and make a variety of different plots: - Theta, Theta dot vs Time - Theta vs Theta dot (Phase Diagram) - Animate a Pendulum - Multiple Animations - Custom matplotlib colors Video Chapters 0:00 - Intro 0:25 - Simulation 2:17 - Time Domain Plot 3:20 - Ani...
Simple Pendulum with Python + Sympy
Просмотров 3,3 тыс.2 года назад
Learn how to solve the equations of motion for a simple pendulum using the sympy library. Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Simple Pendulum Derive the equations of motion by hand: ruclips.net/video/0PUrSlr6XCk/видео.html. Sympy Library Download: docs.sympy.org/latest/install.html#installation. Video Chapters 0:00 - Intro 0:10 - Finding the Lagrang...
Simple Pendulum without Forces? Lagrangian Mechanics 101
Просмотров 3,1 тыс.2 года назад
Learn how to derive the equations of motion for a simple pendulum using Lagrangian Mechanics by hand. Code (Github): github.com/logdog/RUclips/tree/main/Lagrangian Mechanics in Python/Simple Pendulum Derive the equations of motion in Python: ruclips.net/video/ZCzIoaGls4g/видео.html Simulate and Animate the Pendulum: ruclips.net/video/WNJJuSWfuTY/видео.html Video Chapters 0:00 - Intro 0:10 - Fin...
Lagrangian Mechanics 101 with Python: An Overview
Просмотров 4,2 тыс.2 года назад
An overview of Lagrangian Mechanics, including a brief example of a simple pendulum with massless rod.
Inverted Pendulum P Controller Test 2 - October 11, 2022
Просмотров 2892 года назад
Implemented microstepping to create a smoother action and reduce jerkiness at low speed. This alone increased the run time of the pendulum, however we still see that over time the cart speeds up and eventually either cannot move fast enough or far enough to stabilize the pendulum. Next steps: - increase encoder resolution from 1200 PPR to 2400 PPR - adding position estimation and angular veloci...
Linear Systems: Gramian Matrix and W test
Просмотров 1,2 тыс.2 года назад
A proof of why the W-test works for testing the controllability of a linear time-varying system. Based upon the notes in Wilson J. Rugh's LINEAR SYSTEM THEORY second edition.
Project 1 Walkthrough using Simulation
Просмотров 1393 года назад
Project 1 Walkthrough using Simulation
Testing the ALU on SAP-1
Просмотров 1406 лет назад
Testing the ALU on SAP-1

Комментарии

  • @edgarromeroherrera2886
    @edgarromeroherrera2886 2 месяца назад

    Pretty nice

  • @ryumitsurugi2088
    @ryumitsurugi2088 3 месяца назад

    This step by step tutorial is super helpful. Thank you, Logan!

  • @timreed9722
    @timreed9722 4 месяца назад

    Awesome video! How are you outputting the latex?

    • @logandihel
      @logandihel 4 месяца назад

      To view to the latex in the Jupyter notebook you need to run the command init_vprinting Which I did in my import statements at the top of the program.

    • @timreed9722
      @timreed9722 4 месяца назад

      @@logandihel Yeah, I did that. I'm not sure what actual function you're using. I have another route that is working for me now, but it's a bit messy and requires a bit of setup. Your method seems cleaner and simpler unless you've abstracted way much of the details.

    • @logandihel
      @logandihel 4 месяца назад

      I'd recommend copying the code directly from my github page (link in description), and if that doesn't work you can submit an issue on my RUclips GitHub repository. It's also possible you're missing a required package, or the packages have changed versions since I posted the video

  • @nguyenxuanthanh6988
    @nguyenxuanthanh6988 4 месяца назад

    Cool video.

  • @romanrolla8134
    @romanrolla8134 5 месяцев назад

    Ey! I have a question, It’s the energy of the system constant? I mean, silly question, but when I plot E = T + V, it’s not constant...

    • @logandihel
      @logandihel 5 месяцев назад

      The energy of the system is constant only if friction is ignored. Set b to zero and you should see the energy is constant, perhaps with small changes due to numerical integration errors

    • @romanrolla8134
      @romanrolla8134 5 месяцев назад

      @@logandihel Ahh it oscilates... Thanks anyway! I was searching a bit and I think it’s common in the way it solves the ODE right? I was doing the kepler problem potencial to see orbits and again the energy driftt. I guess now i’m reading a book about numerical method for python... I thought this day will never come!

  • @IntisharIftiHashem
    @IntisharIftiHashem 5 месяцев назад

    One more question pls. How does python know if you are doing differentiation or partial differentiation because even when you are coding for partial differentiation you still write diff()

    • @logandihel
      @logandihel 5 месяцев назад

      Great question! I don't think that it really matters in Python whether you are doing a full derivative or a partial derivative because they both use diff(). I just make sure to explicitly declare that my derivatives are with respect to time

    • @IntisharIftiHashem
      @IntisharIftiHashem 5 месяцев назад

      @@logandihel Thanks bro

  • @IntisharIftiHashem
    @IntisharIftiHashem 5 месяцев назад

    Really nice video. Thank you. In the first line you wrote "from sympy import *". What is *?

    • @logandihel
      @logandihel 5 месяцев назад

      * simply means to import everything (functions, classes, variables) from the sympy library into the current namespace. This way you don't need to use the module name (sympy) as a prefix: symbols() instead of sympy.symbols()

  • @IntisharIftiHashem
    @IntisharIftiHashem 6 месяцев назад

    Really good video. I was confused on the ODE stuff and why you used matrix notation and where the theta dot came from at then end in the matrix

    • @logandihel
      @logandihel 6 месяцев назад

      I used the matrix notation (state space model) because that is the gold standard in nonlinear system theory, and ode solvers in python/matlab expect that format

    • @IntisharIftiHashem
      @IntisharIftiHashem 6 месяцев назад

      @@logandihel Thanks man

  • @yanco6
    @yanco6 6 месяцев назад

    you do not need to copy from the symbolic to numeric there is a function call "smp.lambdify()" that you can transfer from symbolic to numeric

  • @olsea1229
    @olsea1229 7 месяцев назад

    Another question is why on the diagram of speed versus time the speed does not tend to zero, it remains somewhere around 0.5?

    • @logandihel
      @logandihel 5 месяцев назад

      The velocity tends to zero when friction is added. Otherwise, no energy is lost and the velocity is sinusoidal

  • @olsea1229
    @olsea1229 8 месяцев назад

    How to increase the oscillation time so that the pendulum swings to a complete stop?

    • @logandihel
      @logandihel 8 месяцев назад

      The solve_ivp() function allows you to input the simulation time (mine is set [0,10] meaning from 0 to 10 seconds) and also the evaluation time (mine is set from 0 to 10 seconds, evaluated 30 times per second). You can increase the 10s to a larger value like 25. You could also change the value of "b" (damping coefficient) to perhaps 5 to make the system lose energy faster

    • @olsea1229
      @olsea1229 8 месяцев назад

      @@logandihel I changed the value but the duration of the GIF image remained the same. What can be done?

    • @logandihel
      @logandihel 8 месяцев назад

      @olsea1229 which file are you editing? Is it SpringMass/animate.py ? If so, only lines 25 and 26 should need editing to change the .gif file time duration

    • @olsea1229
      @olsea1229 8 месяцев назад

      @@logandihel I changed it like this: sol = solve_ivp(spring_mass_ODE, [0, 30], (x0, x_dot0), t_eval=np.linspace(0,10,10*30)) but the time of the gif animation has not changed

    • @logandihel
      @logandihel 8 месяцев назад

      @@olsea1229 change t_eval to np.linspace(0,30,30*30)

  • @nothingnothing2144
    @nothingnothing2144 9 месяцев назад

    ❤❤✔✔

  • @godussopgod8685
    @godussopgod8685 10 месяцев назад

    Real Hero. Thanks

  • @hamzamohamed7935
    @hamzamohamed7935 10 месяцев назад

    This is art....THANK YOU from sudan,africa

  • @kedvesendre-zsolt7842
    @kedvesendre-zsolt7842 10 месяцев назад

    Thanks for the great work!

  • @theskydreamer2003
    @theskydreamer2003 10 месяцев назад

    on phase diagram i've got a deprecation warning: MatplotlibDeprecationWarning: Setting data with a non sequence type is deprecated since 3.7 and will be remove two minor releases later phase_dot.set_data(theta_deg[i], theta_dot_deg[i]) <==solved by putting some brackets[ ] : phase_dot.set_data([theta_deg[i]], [theta_dot_deg[i]]), on both lines.

  • @theskydreamer2003
    @theskydreamer2003 10 месяцев назад

    i've got an small issue with the snippet: animate theta, theta_dot vs time where the animation would render(.mp4) but the graph in the browser(notebook, colab) would be empty, solved by putting plt.show() after anim.save(...) line

    • @logandihel
      @logandihel 10 месяцев назад

      Good catch! I haven't tried running in notebook collab before - I just use vscode with Jupter extension. Thanks for sharing

  • @ktuluflux
    @ktuluflux 10 месяцев назад

    Incredible!

  • @Daniboy370
    @Daniboy370 10 месяцев назад

    Your videos are stunning

  • @Daniboy370
    @Daniboy370 10 месяцев назад

    Beautiful example 🤙🏻

  • @fudgenuggets405
    @fudgenuggets405 10 месяцев назад

    You need a better microphone.

  • @ramos_4892
    @ramos_4892 10 месяцев назад

    As someone looking into studying Computational Science and Engineering, this is some incredible stuff, thank you

  • @Nexus-zc3cb
    @Nexus-zc3cb 10 месяцев назад

    Wish I had find this channel sooner.

  • @christiangodin5147
    @christiangodin5147 10 месяцев назад

    Good day. Your "simple" pendulum is in fact a "double" pendulum. Thank you.

    • @logandihel
      @logandihel 10 месяцев назад

      "Simple" in the sense that the pendulums are point masses and not rigid bodies with rotational inertia

    • @christiangodin5147
      @christiangodin5147 10 месяцев назад

      Sorry, that is not the usual definition ​of a simple pendulum.

    • @logandihel
      @logandihel 10 месяцев назад

      You're correct. A simple pendulum usually refers to a linear model of a single point mass pendulum. I just wanted to differentiate between point masses versus rigid bodies, and the phrase "point-mass double pendulum" was too long to fit on the screen!

    • @christiangodin5147
      @christiangodin5147 10 месяцев назад

      @@logandihel Ok, no problem, thank you for your videos.

  • @giacomobracci1047
    @giacomobracci1047 10 месяцев назад

    You cannot call this a simulation, this is only a visual representation of the solution of a problem analitically solved...

    • @projekcja
      @projekcja 10 месяцев назад

      Not true, when he called scipy.integreate.solve_ivp() it numerically solves the "initial value problem" by running a time-step by time-step simulation. It does not use the analytical solution of the ODE. The description of the function says "This function numerically integrates a system of ordinary differential equations given an initial value". There is nothing more fitting of the name simulation than that.

  • @juancarlossanchezveana1812
    @juancarlossanchezveana1812 10 месяцев назад

    Amazing

  • @GiuvenxD
    @GiuvenxD 10 месяцев назад

    spectacular video

  • @surajpowar4915
    @surajpowar4915 10 месяцев назад

    Hello Logan, extremely informative video mate. Could you please also make a tutorial om how to do mathematical modeling using Python. RUclips just doesn’t have a brief tutorials for mathematical modeling and we would appreciate if there is one for some of us learners.

    • @logandihel
      @logandihel 10 месяцев назад

      Could you give an example of what sort of mathematical models you are looking for? Most of the content I've made so far is for modeling nonlinear dynamical systems.

    • @surajpowar4915
      @surajpowar4915 10 месяцев назад

      @@logandihel Thank you so much for your kind reply. The modelling like SIER, Logistics growth, behaviour of functions with respect to different parameters, etc would be nice to know. If it is out of scope for your channel, I totally understand.

    • @logandihel
      @logandihel 10 месяцев назад

      I think the topic of bifurcations with respect to varying parameters for 2-dimensional nonlinear systems would be a good fit for this channel. Thanks for the ideas!

  • @draupathumesh4142
    @draupathumesh4142 10 месяцев назад

    Hi logan...pls tell how did you made that motion picture of oscillating spring mass system

    • @logandihel
      @logandihel 10 месяцев назад

      Code for the animations are available on my github page, which is linked in the description. The motion picture was done using the manim library, which I may put out a video later.

  • @ishaankumar4587
    @ishaankumar4587 10 месяцев назад

    Is this what we study physics for

  • @mohamedeljahmi2454
    @mohamedeljahmi2454 10 месяцев назад

    Why is positive x towards the ground and negative x towards the ceiling?

    • @logandihel
      @logandihel 10 месяцев назад

      Great question! It doesn't really matter how we define x, as long as we are consistent. If you want, simply replace x with (-y) in each equation, so that y positive is up. Fun fact: In aerospace literature, it is actually more common to define z to be down. This is just a convention

    • @mohamedeljahmi2454
      @mohamedeljahmi2454 10 месяцев назад

      In the foundation of robotics course, the z-axis was always the axis of motion. Thanks for your video. I have been studying lagrangian for the past week and the available videos are long and complex. Although yours is short, it contains a lot of information and I keep watching so I enhance my understanding and then move into complex topics.

    • @logandihel
      @logandihel 10 месяцев назад

      @mohamedeljahmi2454 good luck! I have some other videos for deriving equations of motion for the pendulum using Lagrangian mechanics, which is a great example of a nonlinear system

  • @tr0nb0y
    @tr0nb0y 10 месяцев назад

    I have no idea why the youtube algorithm recommended me this vid. While I enjoyed calculus and differential equations to a certain degree, I got off the math wagon at matrices and I abhor any form of coding with a passion. While thostensibly

    • @logandihel
      @logandihel 10 месяцев назад

      Well, I hope you like the animations at the end!

  • @DanielJVickers
    @DanielJVickers 10 месяцев назад

    Gotta say this video was an absolute blast to watch. I am someone who works with this kind of tooling all the time, but the plots and the code were both so clean. I can't wait to see more from you.

  • @monsieuralexandergulbu3678
    @monsieuralexandergulbu3678 10 месяцев назад

    It would be nicer to explain what are the difference between the two types before explaining the mats for them.

  • @logandihel
    @logandihel 10 месяцев назад

    Hi guys! I noticed one small error in my derivation 😬The last term in the kinetic energy at [6:55] should be "1/2 * I_2 * (theta_1_dot + theta_2_dot)^2". The angular velocity (theta_1_dot + theta_2_dot) represents the total rotational velocity of the second pendulum relative to the {s} frame. We always need to express our energy in terms of the {s} frame for the Euler-Lagrange equation to work. I will go ahead an update all of the code on my GitHub so your simulations are correct :) Also, I provided the full (correct) derivations of the mathematics on my GitHub, so be sure to check it out!

  •  10 месяцев назад

    Well done. Pretty and interesting simulation. Thanks!

  • @gaz_3827
    @gaz_3827 10 месяцев назад

    I was wondering if you can change the setup to a horizontal one therefore getting rid of potentiel energy Vm and only leaving the elastic potentiel energy of the spring and starting the simulation after an initial displacement of the mass m

    • @logandihel
      @logandihel 10 месяцев назад

      Yes, that would totally work! That would be a great exercise for you. In fact, you could generalized the spring mass system to oscillate back and forth about any angle!

    • @gaz_3827
      @gaz_3827 10 месяцев назад

      @@logandihel Thanks for responding, I'll surely try it

  • @Arthur-e8x4n
    @Arthur-e8x4n 10 месяцев назад

    Thank you for all your videos. I appreciate a lot. could you do the spring-mass model for running ? It's a bit similar to this but i cannot really animate it

    • @logandihel
      @logandihel 10 месяцев назад

      Spring mass system for running? I'm not familiar with this system. Could you share a link?

    • @Arthur-e8x4n
      @Arthur-e8x4n 10 месяцев назад

      @@logandihel Of course ! Here is the link : www.cs.cmu.edu/~hgeyer/Teaching/R16-899B/Papers/Blickhan89JBiom.pdf (thanks a lot, from France !)

    • @pepito_5815
      @pepito_5815 3 месяца назад

      ​@@Arthur-e8x4n Same here bruh 👍 🇨🇵 (ça bosse le tipe)

    • @logandihel
      @logandihel 3 месяца назад

      Just saw this notification today! School is busy right now, but ill see what I can do

  • @Arthur-e8x4n
    @Arthur-e8x4n 10 месяцев назад

    I would like to thank you for all your videos. Could you make the spring-mass model for running ? It's a bit similar to this but i can' really simulate it

  • @hahacoca8445
    @hahacoca8445 11 месяцев назад

    dayum

  • @Rapha_Carpio
    @Rapha_Carpio 11 месяцев назад

    Is this like math or something i dont understand

    • @logandihel
      @logandihel 11 месяцев назад

      Yes, there's some math involved, but you can understand it! Check out the other videos in this playlist to learn where these equations come from 💪

    • @Rapha_Carpio
      @Rapha_Carpio 11 месяцев назад

      my real question is... is this data science? data analytics? whats the main field for the videos --- im making animations with python and matplotlib animations but they are only random numbers using np.linspace... etc nothing more... thats why im asking brother. @@logandihel

  • @riccvven2078
    @riccvven2078 11 месяцев назад

    LOGAN IS ALIVE!!!!!!!!!!!!!!!!! I guess the goat sacrifive worked, thks BAal

  • @AJ-et3vf
    @AJ-et3vf Год назад

    Very low volume

  • @hariharanramamurthy9946
    @hariharanramamurthy9946 Год назад

    Hi, can you use statespace method next time , for any other system, I could see you use diff equation, which I could follow up easily, but for controls part, I am dealing with state space matrices, thanks for the content , very intuitive

    • @logandihel
      @logandihel Год назад

      You can convert any ordinary differential equation into a state space model. You just need to choose your state variables as theta, theta_dot, ell, and ell_dot

    • @hariharanramamurthy9946
      @hariharanramamurthy9946 Год назад

      @@logandihel yeah doing that now, thanks for the info

    • @hariharanramamurthy9946
      @hariharanramamurthy9946 Год назад

      hi logan, I have a doubt ,I am trying to solve a nonlinear differential equation, I am looking for closed solution as a function of time , I couldn't solve with dsolve in sympy, raising error->" cannot be solved by the factorable group method " using scipy integrate gives me the array of t and q(differential parameter) values, I want to simulate the model for t-> tends to infinity, how can I do that?

    • @logandihel
      @logandihel Год назад

      You can very rarely solve a nonlinear system. Most of the time it is actually impossible (like for the pendulum). You need to simulate starting with some initial conditions

  • @AllRounder-vc1yl
    @AllRounder-vc1yl Год назад

    Great 👍 video , make video like this

  • @riccvven2078
    @riccvven2078 Год назад

    brilliant; too bad channel seems bad, hope you'll make more

  • @riccvven2078
    @riccvven2078 Год назад

    awesome i was using matlab but this is useful too

  • @makdavian3567
    @makdavian3567 Год назад

    Assuming total length to be L, is the Lcos theta pointing down and Lsin theta pointing towards right? So y is negatiive and x is positive?

    • @logandihel
      @logandihel Год назад

      Yes, but only because we defined the origin to be at the pivot, with the x axis to the right and the y axis vertical, and theta being counterclockwise from the downward position. So at resting position, x is zero and y is negative. At 0 < theta < pi/2, x >0 and y<0

  • @shezeeblanka1611
    @shezeeblanka1611 Год назад

    Funny ending.