This is a school project where I show my abilities in object oriented programming for the TC1030 course.
- Solve ODEs numerically (Euler, RK4 methods)
- Predefined Systems like Lorenz attractor, Sprott attractor and more
- Export trajectories to visualize with Python or on the web
- Clone the repo
git clone https://github.com/Alex-Benitez16/Dynamical-Systems.git
cd Dynamical-Systems- Compile (requires
gcc)
g++ source/*.cpp -Iinclude -std=c++11- Run
./a.out # Or its equivalent on your platformIf you wish to plot the attractor there are two main ways:
- Execute the
plot.pyPython script
python output/plot.pyThis method requires pandas, matplotlib, and numpy
-
Visualize in the web
- Open Plotly Chart.
- Import the csv (found in the
/outputfolder) - Select the
+ Tracebutton - Under type select 3D line
- Select the corresponding rows
The project essentially contains three parts: an ODE (ordinary differential equation), a solver, and an exporter. This are also the three main classes.
-
Solver: The solver contains both the ODE (via aggregation) and the exporter (via composition). It contains the numerical methods to solve the equations and is responsible for making the right calls to the exporter.
-
Exporter: The exporter manages the export operations to the csv, such as creating the file and filling it with the states.
-
ODE: This is an abstract class where all the other systems inherit from. It contains an initial state and a virtual function for the equation, which will be overriden by the derived classes depending on the system.
Note: All the following attractors use the default parameters with rk4 default method.
Equation:
Graph:
Equation:
Graph:
Equation:
Graph:
Equation:
Graph:
Equation:
Graph:
Equation:
Graph:












