Implementing The Runge-Kutta 4th Order Integrator Using Python

Sdílet
Vložit
  • čas přidán 12. 09. 2024
  • This video show how to easily implement the the Runge-Kutta 4th order 4 stage integrator using Python and the numpy library.
    The code that was used as the starting point for this video was produced in a previous video which can be viewed here. From there, you can download the code that is the starting point for this video.
    • Numerical Solution to ...
    A copy of the final code form this video can be downloaded from:
    github.com/apf...
    The equations implemented in this code were derived in a previous video which you can view here: • A Better Integrator? T...

Komentáře • 22

  • @MrBipulpandey
    @MrBipulpandey Před 3 lety +1

    I have worked through 5 videos of yours in the last two days. I vaguely remember learning about RK-4 theory many years ago as a second year undergrad but I never used it and completely forgot about how powerful it was for numerical solutions. I was having issues with convergence with Forward Euler in a problem that I am solving now. Hopefully, implementing this will help me solve my problem in a rigorous yet computationally cheap fashion.
    Thank you very much for the lucid explanations and simple yet effective implementation.

  • @GoobNoob
    @GoobNoob Před rokem +1

    I liked your explanations throughout the video explaining the problems you were dealing with

  • @ticTHEhero
    @ticTHEhero Před 6 lety +2

    Hello again, sir) I'm very happy that the new problem that i'm interested in brought me to your channel. Last time i dwelled here for quite a significant period of time when seeking for solutions to my chosen bachelor thesis ( in my country we have to defend the thesis in front of a bench after finals in order to graduate), and You knightly agreed to make a video on dealing with both translation and rotation oscillations and therefore you really really helped me. I was young and not interested much in study cause my last university did not offer much sophisticated knowledge in math/physics questions, but then i found great people such as You and took another breath of hunger in engineering. Since that time for over a year i experience a genuine amusement of solving engineering problems, and now I entered for masters prep in top 10 engineering university in the country where i'm being tought to design and optimize spacecrafts trajectories. That being said, I really want to thank you that you paid attention to my humble preson those days.

    • @Freeball99
      @Freeball99  Před 6 lety +2

      Thank you some much for your wonderful comments. It is certainly very rewarding for me to hear about the impact that my videos have had on you. This is exactly the reason that I make these videos! I very much appreciate this feedback.
      BTW - where do you live?

    • @ticTHEhero
      @ticTHEhero Před 6 lety +2

      @@Freeball99 Moscow, Russia

  • @saurabhsaini1249
    @saurabhsaini1249 Před 4 měsíci

    this is the really really cool video start follow you I am waiting for your new videos

  • @ProQuigley
    @ProQuigley Před 3 lety

    this is great; half commenting for the YT algorithim also half commenting because you've inspired me to do some instructive content myself. Algorithim Boost as a sign of respect for cutting into your market lol

  • @Dr.Mohammed.Hammad
    @Dr.Mohammed.Hammad Před rokem

    You are just a GREAT teacher!

  • @woiterKA7
    @woiterKA7 Před 6 lety +2

    Thanks for showing this. I programmed it in Java and it works fine as well. Is the method you are showing an implicit or an explicit method? Thanks.

    • @Freeball99
      @Freeball99  Před 6 lety +4

      Method is EXPLICIT because the state at the next time-step (t+1) depends only on the state at the current time-step.

  • @legendary_egg
    @legendary_egg Před 2 lety

    Fantastic!

  • @shivamgakkhar9537
    @shivamgakkhar9537 Před 4 lety

    hi sir i need help....... if we are getting results in two columns then how can we plot them in matplotlb..............

    • @Freeball99
      @Freeball99  Před 4 lety +1

      Convert each column into a separate list. Then matplotlib can plot it.

  • @DavidPerez-qm3bg
    @DavidPerez-qm3bg Před 4 lety

    Hello, I am interested in your code, but I am questioning where did the first 3 lines come from as when I try to use it/run it in my 3.8 python, it does not recognize the front at all

    • @Freeball99
      @Freeball99  Před 4 lety +2

      These lines require a couple of packages/libraries to be installed first - both of them are pretty standard amongst the scientific community and are often bundled with scientific installations of Python. The first is "numpy" which is a numerical package and allows one to easily work with matrices. The second package is "matplotlib" and is used to plot graphs.
      Use Google to find installation instructions for each for your particular operating system. On my Mac, I would go to a terminal prompt and install both packages at once, by typing something like:
      pip3 install numpy matplotlib
      For more advanced topics on package management, you can Google how to create virtual environments using tools like Venv and Pipenv.

    • @DavidPerez-qm3bg
      @DavidPerez-qm3bg Před 4 lety

      @@Freeball99 Thank you very much, I appreciate your help!

    • @navsquid32
      @navsquid32 Před 4 lety

      If you've upgraded to Python 3.8, it's possible that you don't have these packages installed. You have two options: The first is to use pip to install them. The second, and better, option is to use a virtual environment like conda and install them in your virtual environment.

    • @V_rocketry
      @V_rocketry Před 4 lety

      I got some problems in 3.8, so I downgraded to version 3.7 and works fine!

  • @mossammadu.c.sultana8548

    Thanks for the video! I need the code for the RK4 in terms of TD WF. could you help me to solve my problem, please. I am an exam on 08.07.20 but still lots of questions, nobody to answer directly. Thank you very much again.

    • @Freeball99
      @Freeball99  Před 4 lety

      I'm not sure I understand your question. Send me an email at: apf999@gmail.com

  • @ahmedsharafaldeen4224

    hi sir thanks for this nice leacture , can i get this python code plaese

    • @Freeball99
      @Freeball99  Před rokem

      The link is in the video description.