Skip to content

Latest commit

 

History

History
60 lines (48 loc) · 2.15 KB

README.md

File metadata and controls

60 lines (48 loc) · 2.15 KB

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:

  • def f(t, y):
        return 2 * t - 3 * y + 1
    
    y = firstorder(f)
  • y = firstorder('2 * t - 3 * y + 1')

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.