This repository contains a collection of numerical solvers for ordinary differential equations (ODEs), implemented from scratch for educational and research-oriented purposes.
The goal of this project is to study the connection between mathematical models, numerical time integration methods, and their practical behavior in terms of stability, accuracy, and convergence.
We consider initial value problems (IVPs) of the form
where $ y(t) \in \mathbb{R}^n $.
Implemented in v0.1:
- RK4 (fixed step size)
- Dormand–Prince RK45 (adaptive step size)
- Convergence experiments and basic test suite
Docs:
docs/theory.mddocs/error_analysis.md
uv venv
uv pip install -e ".[dev]"
pytest -q
python experiments/convergence_test.py --method RK4
python experiments/convergence_test.py --method RK45
python experiments/dopri5_fixed_convergence.py --h0 0.4 --kmax 7 --t1 10Plots will be saved to plots/.
-
Explicit Runge–Kutta methods
- Classical RK4 (fixed step size)
- Dormand–Prince RK45 (adaptive step size)
-
Implicit methods
- Implicit Euler method (for stiff problems)
Adaptive step size control is implemented based on embedded error estimation and relative/absolute tolerances.
The following aspects are investigated numerically:
- Convergence order with respect to step size
- Stability behavior for stiff and non-stiff problems
- Comparison between explicit and implicit methods
- Influence of adaptive step size control
Representative test problems include:
- Harmonic oscillator
- Damped oscillator
- Logistic growth equation
For problems with analytical solutions, numerical errors are computed and compared against theoretical convergence rates. For more complex problems, reference solutions with very small step sizes are used.
Detailed discussions can be found in docs/error_analysis.md.
This project was developed to gain a deeper understanding of numerical methods for differential equations beyond black-box library usage. It reflects my interest in Scientific Computing, where mathematical analysis, numerical algorithms, and implementation are tightly connected.
BSD 3-Clause License.
- Hairer, E., Nørsett, S. P., Wanner, G. Solving Ordinary Differential Equations I
- Butcher, J. C. Numerical Methods for Ordinary Differential Equations