This repository contains computational simulations of several dynamical systems modelled by ordinary differential equations (ODEs).
All simulations were implemented in Python using the scientific library SciPy and numerically solved with the scipy.integrate.solve_ivp function (RK45 Runge–Kutta method).
Each simulation includes:
- The mathematical model and ODE formulation;
- Python implementation;
- Visual results and physical discussion.
For further details read the full report (Portuguese only).
The cooling of a body in a constant ambient temperature follows:
This model estimates the cooling constant k and predicts the time when the indoor temperature reaches a target value.
A projectile is launched under gravity and aerodynamic drag proportional to velocity:
The simulation integrates position and velocity simultaneously, displaying time evolution of velocity magnitude, height, and the projectile’s trajectory.
The RLC circuit satisfies Kirchhoff’s Voltage Law:
The code computes current and charge over time for both constant and sinusoidal voltage inputs, revealing transient and steady-state regimes.
A lightweight ball thrown vertically, subject to gravity and air resistance, obeys:
The simulation compares cases with and without drag, showing the emergence of terminal velocity when resistance is considered.
The population dynamics of two interacting species (prey and predator) are modeled as:
The simulation explores oscillatory behavior and equilibrium under varying contact coefficients and initial populations.
The SIR model (Susceptible–Infected–Recovered), introduced in 1927 [Kermack and McKendrick, 1927], is one of the most classical ways to represent the evolution of an epidemic. It assumes that individuals can belong to three compartments:
- Susceptible: Individuals who have not yet been infected by the disease but can still become infected;
- Infected: Individuals currently infected by the disease;
- Recovered: Individuals who no longer have the disease.
The mathematical representation of this model is given by the following system of differential equations:
Each equation describes the evolution of one compartment based on the parameters β and γ, which represent the transition rates between compartments.
- Python 3.x
- NumPy
- SciPy (
solve_ivp— RK45 integrator) - Matplotlib
-
Clone the repository
git clone https://github.com/fpelogia/dynamical-systems-modelling.git cd dynamical-systems-modelling -
Create virtual environment and install requirements
python -m venv venv source venv/bin/activate pip install -r requirements -
Run any simulation
python newton_cooling.py python projectile-motion.py python rlc_circuit.py python plastic_ball.py python plastic_ball_2o.py python predator-prey.py ...
- J.R. Dormand & P.J. Prince (1980) — A family of embedded Runge–Kutta formulae, Journal of Computational and Applied Mathematics, 6(1), 19–26.
- R. Herman (2017) — Solving Differential Equations Using Simulink, link.
- SciPy Library — https://www.scipy.org
Frederico José Ribeiro Pelogia
Department of Science and Technology, Federal University of SĂŁo Paulo (UNIFESP)
Most simulations were originally developed during the Dynamic Systems Control course (2020).





