This repository contains a collection of numerical methods for solving ordinary differential equations (ODEs). The methods are implemented in C, and the results can be visualized using a Python script.
The following numerical methods are implemented:
- Explicit Euler
- Implicit Euler
- Implicit Midpoint
- Implicit Trapezoidal
- Runge-Kutta 2
- Adams-Bashforth 2
- Adams-Moulton 2
- BDF2 (Backward Differentiation Formula 2)
The project uses a Makefile to compile and run the C code.
gcccompilermakepython3matplotlib
To compile the source code, run the following command:
makeThis will create an executable file named edos in the bin directory.
To run the simulation, use the following command:
make runThis will execute the edos program, which will generate an output.txt file containing the results of the ODE solvers.
The plot.py script can be used to visualize the results from the output.txt file.
To generate plots of the results, run the following command:
./plot.py output.txtThis will create a plots directory and save the generated graphs in PNG format.
.
├── include/ # Header files for the C source code
├── src/ # C source code for the numerical methods
├── Makefile # Makefile for building and running the project
├── methods.py # Python script for running the methods (if any)
├── plot.py # Python script for plotting the results
└── README.md # This file
To remove the compiled files, the output.txt file, and the plots directory, run:
make clean