Search arXivSearch

arXiv · 2603.01916

Performance comparison of Python, MATLAB and R for numerical solutions of SI and SIR epidemiological models

Abstract

Mathematical modeling plays a vital role in epidemiology, offering insights into the spread and control of infectious diseases. The compartmental models developed by Kermack and McKendrick, particularly the SI (Susceptible-Infected) and SIR (Susceptible-Infected-Recovered) models, form the basis of many epidemic studies. While some simple cases permit analytical solutions, most real-world models require numerical methods such as Euler's method, the fourth-order Runge-Kutta (RK4) method, and Predictor-Corrector (P-C) methods. These methods are typically implemented in scientific computing software like Python, MATLAB, and R. However, the computational efficiency and run-time performance of these software tools in solving epidemiological models have not been comprehensively compared in the literature. This study addresses this gap by solving the SI and SIR models using Euler's method, RK4, and P-C methods in Python, MATLAB, and R. Execution times are recorded for each implementation to evaluate computational efficiency. Additionally, for the SI model, where an exact analytical solution exists, R2 values are computed to assess numerical accuracy. For the SIR model, a high-accuracy reference solution is obtained by solving the system using MATLAB's ODE45 solver, and the SIR solutions computed via the RK4 method in MATLAB are compared against this reference. The results provide a comparative perspective on the accuracy and run-time performance across different software and numerical methods, offering practical guidance for researchers and practitioners in selecting suitable tools for epidemic modeling.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Berkay Özışık, Elif Demirci. 2026-03-04. Performance comparison of Python, MATLAB and R for numerical solutions of SI and SIR epidemiological models. https://arxiv.org/abs/2603.01916

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Fully spectral scheme for the linear BGK equation on the whole space

In this article, we design a fully spectral method in both space and velocity for a linear inhomogeneous kinetic equation with mass, momentum and energy conservation. We focus on the linear BGK equation with a confinement potential $Φ$, even if the method could be applied to different collision operators. It is based upon the projection on Hermite polynomials in velocity and orthonormal polynomials with respect to the weight $e^{-$Φ$}$ in space. The potential $Φ$ is assumed to be a polynomial. It is, to the author's knowledge, the first scheme which preserves hypocoercive behavior in addition to the conservation laws. These different properties are illustrated numerically on both quadratic and double well potential.

math.NA

Inverse inequalities for kernel-based approximation on bounded domains and Riemannian manifolds

This paper establishes inverse inequalities for kernel-based approximation spaces defined on bounded Lipschitz domains in $\mathbb{R}^d$ and compact Riemannian manifolds. While inverse inequalities are well-studied for polynomial spaces, their extension to kernel-based trial spaces poses significant challenges. For bounded Lipschitz domains, we extend prior Bernstein inequalities, which only apply to a limited range of Sobolev orders, to the full range of lower and upper orders, and derive Nikolskii inequalities that bound $L_\infty$ norms by $L_2$ norms. For compact Riemannian manifolds, we focus on restricted kernels, which are defined as the restriction of positive definite kernels from the ambient Euclidean space to the manifold, and prove their counterparts.

math.NA

Error Estimates for Hyperbolic Scaling Limits of Linear Kinetic Models on Networks

This paper studies linear discrete kinetic models on networks and their asymptotic behavior in the small Knudsen number limit. For coupling conditions at an n-edge junction under a symmetric formulation, we introduce a change of variables that reformulates the system into n independent initial-boundary value problems. The asymptotic expansions are then constructed and rigorously justified by deriving an error estimate based on the energy method.

math.NA