SIR Model Numerical Solution using RK4
Method
This document demonstrates the use of the classical 4th-order Runge-Kutta (RK4) method
to solve the SIR model numerically. The SIR model is defined by the following set of
ordinary differential equations (ODEs):
dS/dt = -βSI
dI/dt = βSI - γI
dR/dt = γI
Where S(t) is the susceptible population, I(t) is the infected population, and R(t) is the
recovered population. The parameters β and γ represent the infection and recovery rates
respectively.
Parameters and Initial Conditions
β (infection rate): 0.3
γ (recovery rate): 0.1
Total population (N): 1000
Initial susceptible (S0): 990
Initial infected (I0): 10
Initial recovered (R0): 0
Time interval: 0 to 50 days with step size h = 1
RK4 Step-by-Step Calculations (First 5 Steps)
t S I R k1 k1 k1 k2 k2 k2 k3 k3 k3 k4 k4 k4 S_ I_ R_
_S _I _R _S _I _R _S _I _R _S _I _R ne ne ne
xt xt xt
0. 9 1 0. - 1. 1. - 2. 1. - 2. 1. - 2. 1. 9 1 1.
0 9 0. 0 2. 9 0 3. 1 0 3. 1 1 3. 3 2 8 2. 1
0 0. 0 0 9 7 0 2 5 9 2 7 0 6 8 1 6. 1 0
0 0 0 0 7 0 0 5 9 8 8 7 8 0 6 7 7 7 5
0 0 0 0 0 0 0 7 2 5 5 3 0 4 9 7 2 1 1
0 0 0 7 2 6 3 6
0 3
1. 9 1 1. - 2. 1. - 2. 1. - 2. 1. - 2. 1. 9 1 2.
0 8 2. 1 3. 3 2 3. 6 3 3. 6 3 4. 8 4 8 4. 4
0 6. 1 0 6 8 1 9 1 3 9 3 4 3 8 8 2. 7 4
0 7 7 5 0 5 7 4 2 6 8 3 7 6 4 0 7 9 9
0 2 1 1 3 8 2 8 5 5 1 9 8 5 4 6 5 8 5
3 6 0 9 7 0 1 8
3 7
2. 9 1 2. - 2. 1. - 3. 1. - 3. 1. - 3. 1. 9 1 4.
0 8 4. 4 4. 8 4 4. 1 6 4. 1 6 5. 4 7 7 7. 0
0 2. 7 4 3 8 7 7 5 2 8 7 3 2 7 9 7. 9 8
0 7 9 9 6 3 9 7 3 4 1 8 7 7 6 7 9 6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