Runge-Kutta4

Basic implementation 4th order Runge Kutta method for ODE's


Project maintained by JCLArriaga5 Hosted on GitHub Pages — Theme by mattgraham

Runge-Kutta4

License size

Fourth-order Runge Kutta method to solve ordinary differential equations (ODE’s) given the initial conditions of the equation, to obtain the solution. The implementation can resolve first and second order ODEs.

To solve the second order ODE’s can be decomposed into a system of differential equations, as shown below.

Use the repository

Clone repository

$ git clone https://github.com/JCLArriaga5/Runge-Kutta4.git

Enter the path where the repository was cloned and install the dependencies with the following command:

pip install -r requirements.txt

First check if you have tkinter installed, the GUI needs tkinter to run, use the following command to install tkinter:

sudo apt-get install python3-tk

Examples

For examples of how to use the functions see this file, run the test:

:~/Runge-Kutta4$ cd rk4odes/
:~/Runge-Kutta4/rk4odes$ python test.py

You can enter the equation function in two ways:

GUI for first-order ODE’s

Note: GUI needs Python 3 or higher

To run the GUI use the following commands inside the path where the repository was cloned

:~/Runge-Kutta4$ cd rk4odes/GUI/
:~/Runge-Kutta4/rk4odes/GUI$ python GUI.py

The following window will open.

To see the default example, first click on compute. To see the solution graph press on the Graph button, so that it is shown as in the following image.