More Practice with Lagrangian Mechanics in Python

Поделиться
HTML-код
  • Опубликовано: 5 авг 2024
  • In this video I tackle a unique problem in Lagrangian Mechanics using python. This problem was sent in the discord channel:
    / discord
    My other videos on Lagrangian Mechanics can be found in my physics problem playlist:
    • Physics Problems
    All code for this video found here:
    github.com/lukepolson/youtube...
  • НаукаНаука

Комментарии • 31

  • @karanbhagat9314
    @karanbhagat9314 2 года назад +2

    Really enjoyed coding along with you. Results were amazing. Thanks :)

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

    Fantastic! I just love the combination of physics + numerics + python!

  • @aliexpress.official
    @aliexpress.official 2 года назад +4

    this is beautiful. interesting system as well!

  • @TheWaerx
    @TheWaerx 2 года назад +1

    Dude this was awesome, I love pendulum systems. I comment here so youtube algorithm will suggest this to more ppl

  • @user-ix7jy5bz2z
    @user-ix7jy5bz2z Год назад

    What you did is amazing. Thanks so much!

  • @mberoakoko24
    @mberoakoko24 2 года назад +1

    Subscribed, this is so cool .

  • @mikekertser5384
    @mikekertser5384 2 года назад

    Great video! Thank you!

  • @cana5312
    @cana5312 2 года назад

    This is very amazing to learn as phys major knowing how to implement in the coding

  • @realcirno1750
    @realcirno1750 7 месяцев назад +1

    Bro really linked us up with the sauce oh my days man

  • @hsh7677
    @hsh7677 2 года назад +1

    Amazing 🤩

  • @nahblue
    @nahblue 2 года назад +3

    I haven't seen you use `sympy.init_printing()` in notebooks. It might be useful to show, to teach it to others. It makes a little bit of difference, for example it displays sympy variables and expressions nicely even if you have them in a tuple or list. Try (x, y) before or after initializing printing, for variables x, y.
    Thanks for everything *you* have taught me! :)

  • @RH-ml7bd
    @RH-ml7bd Год назад

    Great video!As a student major in physics, I can always learn from your video. May I ask how did you draw such beautiful diagram?

  • @riteshghimire4005
    @riteshghimire4005 2 года назад

    Awesome 😍😍

  • @A.K04
    @A.K04 Год назад

    Thank you very much thank you thank you thank you

  • @chloebenko-prieur1772
    @chloebenko-prieur1772 2 года назад

    I'm trying to solve a Lagrangian that is also subject to an external field. There is an object moving according to theta(t) = sin(2*pi*t). I defined it in the 3rd block of code (like in your example), instead of just writing theta = theta(t) like for the other variables. I run into issues when I get to the smp.lambdify part due to the sines and cosines present from theta(t) in my sols[ ]. Do you know if there's a way to go around this? Contrarily to g, m, M, l... the values of theta aren't fixed and will change at each time step.

  • @MarekBromberek
    @MarekBromberek 2 года назад

    It has been a long time since I had to deal with those kind of problems. Perhaps it is time to refresh my memory. In the mean time I have the following question. WOuld you be able to find out limits of the parameter space (probably spring constant and or masses) which does not allow for example the mass m2 to not be located at the origin since then there is no room for spring. Or, but that constraint might be already in place because l1 is fixed, is it possible to set the value of k (probably very small) so that the spring m2 will be located a distance greater then 2*L1 from the origin?

  • @antonharyadi1076
    @antonharyadi1076 2 года назад +1

    Love ur channel, can you help me to construct a wannier function from a photonic crystal?

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

    Great content!! Thanks for introducing me to symbolic math in Python. I just finished deriving the Lagrangian for an Inverted Pendulum Cart problem by hand :( It was so tedious and took many hours, paper & pencil to get right.
    I did have a problem running your notebook in Colab online. All cells seem to run but the animation doesn't run. After several seconds it prints out 1 frame, no motion. Any ideas where I might look?

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

      I did find I could add :
      from IPython.display import HTML
      HTML(ani.to_html5_video())
      and it displays a nice mp4 video. The results look great now.

  • @iridium1118
    @iridium1118 2 года назад +1

    Why do you still use odeint? Isn't it being phased out in favor of solve_ivp?

    • @MrPSolver
      @MrPSolver  2 года назад

      Good point here...it was just a random selection really. But ya solve_ivp in general is much nicer.

  • @sergiolucas38
    @sergiolucas38 2 года назад

    Very nice video. A question, do you really need to write smp. All the times?, cause i dont

    • @MrPSolver
      @MrPSolver  2 года назад +1

      It's annoying but when using sympy and numpy at the same time I don't want to confuse the numerical np.cos with the symbolic smp.cos

    • @sergiolucas38
      @sergiolucas38 2 года назад

      @@MrPSolver i see, i thought you didnt know :)

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

    This was interesting. I noticed that you have a bunch of videos with more complicated examples at the end of this video. Is there any chance you could make a more simple example that would explain the basic concepts of a Langrangian and the differential equation connected with it in a more simple way that would be more useful for a beginner?

    • @8adrisg
      @8adrisg Год назад

      There is a video in the channel doing the same practice but with a simple pendulum. It's way more intuitive

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

      @@8adrisg Thank you! Clearly, I should've scrolled down further.

  • @timhutcheson8714
    @timhutcheson8714 2 года назад

    Please do a solution for why my putts lip out. I heard it has to do with the Corolla effect but I don’t drive Toyotas. -- tiger would

  • @user-lc6jq1hi1r
    @user-lc6jq1hi1r 2 года назад

    this is beautiful, but where did the beard go? :(((

    • @user-lc6jq1hi1r
      @user-lc6jq1hi1r 2 года назад

      it looked manly, but I guess no more, fam. good video though. :D

  • @AJ-et3vf
    @AJ-et3vf 10 месяцев назад

    Great video! Thank you!