## Figures

## Abstract

Compartment models are implemented to understand the dynamic of a system. To analyze the models, a numerical tool is required. This manuscript presents an alternative numerical tool for the SIR and SEIR models. The same idea could be applied to other compartment models. The result starts with transforming the SIR model to an equivalent differential equation. The Dirichlet series satisfying the differential equation leads to an alternative numerical method to obtain the model’s solutions. The derived Dirichlet solution not only matches the numerical solution obtained by the fourth-order Runge-Kutta method (RK-4), but it also carries the long-run behavior of the system. The SIR solutions obtained by the RK-4 method, an approximated analytical solution, and the Dirichlet series approximants are graphically compared. The Dirichlet series approximants order 15 and the RK-4 method are almost perfectly matched with the mean square error less than 2 × 10^{−5}. A specific Dirichlet series is considered in the case of the SEIR model. The process to obtain a numerical solution is done in the similar way. The graphical comparisons of the solutions achieved by the Dirichlet series approximants order 20 and the RK-4 method show that both methods produce almost the same solution. The mean square errors of the Dirichlet series approximants order 20 in this case are less than 1.2 × 10^{−4}.

**Citation: **Prathom K, Jampeepan A (2023) Direct numerical solutions of the SIR and SEIR models via the Dirichlet series approach. PLoS ONE 18(6):
e0287556.
https://doi.org/10.1371/journal.pone.0287556

**Editor: **Renier Mendoza,
University of the Philippines Diliman, PHILIPPINES

**Received: **February 10, 2023; **Accepted: **June 7, 2023; **Published: ** June 30, 2023

**Copyright: ** © 2023 Prathom, Jampeepan. This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

**Data Availability: **All relevant data are within the manuscript and its Supporting information files.

**Funding: **The author(s) received no specific funding for this work.

**Competing interests: ** The authors have declared that no competing interests exist.

## Introduction

The SIR model is a simple system of nonlinear differential equations that has a rich dynamic. This model is an example of compartment models mainly studied in epidemiology [1–3]. The SIR model and its adaptive versions have been used broadly to investigate the dynamic of a considered system. The models are applicable in public health to intervene and control a disease’s transmission [1, 3–12]. Once a compartment model appears, a tool is required to analyze the model. Understanding the flow of the model would lead the researchers to an assumption to control the disease spreading. There are several tools available to handle the compartment models depending on the situation we are dealing with. Some researchers have sometimes used a computer model to assess certain situations [13, 14]. Others have implemented a numerical method to investigate the models. Since computer models can be utilized only in some circumstances, a numerical method would be an alternative tool. Some recent studies of the compartment models have focused on the fractional-order compartment models by considering the models under the fractional-order *α*, where *α* ∈ (0, 1). As *α* approaches 1, the models become the classical compartment models. The fractional-order SIR model has been demonstrated to have biological significance when *α* ≥ 0.8 [15].

The Dirichlet series is one of the interesting well-known series in the branch of complex analysis since it is a convergent series. The general Dirichlet series is in the form
where 0 = λ_{0} < λ_{1} < … and . The started term *a*_{0} is the approached value of the series as *t* goes to infinity. The Dirichlet series solution satisfying some specific differential equations has been studied in [16–18]. Investigating the Dirichlet series satisfying the compartment models would lead us to a new method to obtain the models’ solution which will be mainly discussed in this paper.

This manuscript considers the classical SIR and SEIR models which are equivalent to the fractional-order *α* when *α* approaches one. The existence and uniqueness of the models’ solutions are confirmed by a well-known theorem appearing in many differential equations books. However, their exact non-parametric solutions, or what we can call the closed-form formulas have been unknown. The results in [19] have illustrated the exact analytical solution of the SIR model in the parametric form. Although the parametric analytical solution has been derived, a numerical method is still required to obtain the approximate solutions *S*(*t*), *I*(*t*), *R*(*t*) at any time *t*. A well-known numerical method to obtain an approximate solution of any compartment model is the fourth-order Runge-Kutta method (RK-4) which is an iterative method depending on a given step size and it does not provide the long-run behavior of the solution. An approximate closed-form solution on the other hand may give the long-run behavior with no step size needed. This rises up researchers’ interest to derive an approximate closed-form solution of the SIR and its related models. Some approximate closed-form solutions of the SIR model have been studied in [20–23]. Considering the solution in the form of a power series expression is one simple way to obtain an approximate closed-form solution of a nonlinear system of differential equations. However, the power series solution as a function of time *t* diverges as *t* approaches infinity. The power series solution of the SIR model has been studied by [24]. A multistage technique repeating the same order of power series approximation with updated initial conditions is a method to get a numerical solution of the SIR model [25]. Using power series approximation or repeatedly using a fixed order of power series approximation can not eventually reach the long-run behavior of the system due to the divergence of the power series. A power series approach together with a defined approximant is presented in [20]. Padé approximant are the other two numerical methods that can lead the approximated solution to the long-run behavior [26, 27]. Considering the Dirichlet series solution would be an alternative path to overcome the limitation mentioned above.

## SIR model

In the SIR model, the rates that the proportions of susceptible *S*, infectious *I*, and recovered *R* change over time are described by
(1) (2) (3)
where the initial conditions are assumed to be *S*(0) = *S*_{0} > 0, *I*(0) = *I*_{0} > 0, *R*(0) = 0, and . Another notation used in this model is
Note that the solution functions *S*, *I*, *R* are single variable real-valued functions that . In addition, the total proportion at any time *t* is assumed to satisfy *S*(*t*) + *I*(*t*) + *R*(*t*) = 1.

Eqs (1)-(3) can be combined to be in the form of a Bernoulli differential equation presented in [19, 21]. Solving the Bernoulli differential equation leads to an approximate analytical solution of the model. Here, we present an approach to derive the approximate analytical solution without transforming Eqs (1)-(3) into the Bernoulli differential equation. A result derived from this approach will be used further.

We first rewrite (1) as
(4)
When we substitute this equation in (2), we get
(5)
Differentiating both sides of (4) with respect to *t* and then equating with (5), we have
(6)
The solution of this differential equation can be found by defining the function *ϕ* as
(7)
Note that our approach of defining *ϕ* above is different from the approach presented in [19]. After using the notation of *ϕ* with (6), we have
By solving this first-order differential equation and then using (7), we get
(8)
which is equivalent to
(9)
The exact solution of (9) is called the *analytical solution*. By using power series approximation of ln(*S*/*S*_{0}), we obtain an approximate solution called a *semi-analytical solution*. Since we assumed that *S*_{0} + *I*_{0} = 1 and the term can be approximated by , it follows that (9) becomes
(10)
We note here that the assumption *I*_{0} > 0 implies *S*_{0} < 1. It follows that the terms *βS*_{0} − *γ* and *γ* − *β* cannot be zero at the same time. Now, we consider two cases.

Case 1: *β* = *γ*. Integrating both sides of 10 gives
(11)

Case 2: *β* ≠ *γ* By integrating both sides of 10, we simply get
(12)

Once we obtain the approximate solution *S*(*t*), we can derive the corresponding solutions of *I*(*t*) (using (4) and (8)) and *R*(*t*) = 1 − *S*(*t*) − *I*(*t*) as follows:
(13) (14)
The set of (*S*(*t*), *I*(*t*), *R*(*t*)) for *t* ≥ 0 presented in (12)-(14) is called a semi-analytical solution.

### Dirichlet series solutions of the SIR model

Let *u*(*t*) = ln(*S*(*t*)/*S*_{0}). Then, (8) is equivalent to
(15)
Since this first-order differential equation has no exact non-parametric analytical solution, we consider its Dirichlet series solution. We first set up some notations for ease of computation. Considering 0 = λ_{0} < λ_{1} < … and , let
(16)
and let
(17)
Then (15) is equivalent to *F*(*u*, *u*′) = 0. By Taylor series expansion we have,
(18)
where
(19)
The following result provides properties of the Dirichlet series solution of (15) which is equivalent to (18).

**Theorem 1** *Let*
, 0 = λ_{0} < λ_{1} < …, *be a Dirichlet series satisfying* (15). *Then*,

- 1 −
*S*_{∞}+ (*γ*/*β*)ln(*S*_{∞}/*S*_{0}) = 0, - λ
_{1}=*γ*−*βS*_{∞}, *a*_{0}= ln(*S*_{∞}/*S*_{0})*and*,- for
*n*≥ 2 if then λ_{n}=*nλ*_{1}and .

**Proof.** It is obvious that *a*_{0} = ln(*S*_{∞}/*S*_{0}) and . Consider (18) with *n* = 1, we see that is a constant and the first term of *A*_{1} is non-constant, . This implies that and . The former is equivalent to
(20)
Consider (18) with *n* = 2, observe that the first term (least exponent) of *A*_{2} is since *a*_{2} ≠ 0 and λ_{1} < λ_{2}. That means that this term would be canceled by a term in . Note that the exponents of the terms in are linear combination of λ_{1}. This implies that λ_{2} = *nλ*_{1} for some integer *n* ≥ 2. Since has the term , it follows that λ_{2} = 2λ_{1} and then the sum of coefficients of the terms and must be zero, i.e., . Now consider (18) with a fixed *n* > 2 and assume that λ_{k} = *k*λ_{1} for 1 ≤ *k* ≤ *n* − 1. The first term of *A*_{n} is since *a*_{n} ≠ 0 and λ_{1} < λ_{n}. This means that the exponent −λ_{n}*t* must appear in . Note that
(21)
Since the exponent −λ_{n}*t* must be equal to −*j*λ_{1}*t* for some *j* ≥ *n*, it implies that the term with the exponent −λ_{n}*t* can be extracted from the term , see (21). By the series expansion, the term can be written as
which contains the term of exponent *nλ*_{1} in the form
Hence, λ_{n} = *nλ*_{1} and also . We have done the proof.

Note that Eqs (13), (14) and (20) imply that
This means that the solution set of the SIR model,
approaches (*S*_{∞}, 0, 1 − *S*_{∞}). Consider a Dirichlet series approximant which is an approximate form of the solution *u*(*t*), say
for some . By the previous theorem, to obtain *a*_{n} we need to get *l*_{n} which depends on *a*_{1}, …, *a*_{n−1} and . It implies that *l*_{i} for each *i* = 3, …, *N* may not be unique and the values of *a*_{1}, …, *a*_{n} can be non-unique complex numbers. This provides many approximate forms of the complex Dirichlet series *u*(*t*) which are not applicable to computer programming. We need the series *u*(*t*) to be a series of real coefficients. The results in Theorem 1 induce us to consider a specific Dirichlet series solution whose exponents satisfy λ_{n} = *nλ*_{1} for . The next results are more applicable for achieving the real Dirichlet series *u*(*t*).

**Lemma 2** *If*
*and*
, *then the* *n*^{th} *derivative of* *f* *with respect to* *t at t* = 0 *satisfies*
where for *k* ≥ 1, *c*_{0} = 1 and .

The proof simply follows from the general Leibniz rule and the mathematical induction.

**Theorem 3** *Let*
, 0 = λ_{0} < λ_{1} < …, *be a Dirichlet series satisfying* (15). *Let* *for* *n* ≥ 0. *Then*,
*for* *n* = 2, …, *where* for *k* ≥ 1 *and* *c*_{0} = 1.

**Proof.** By the result in Theorem 1, we have *b*_{0} = −*a*_{0}. By plugging the Dirichlet series *u*(*t*) into (15), we get
(22) Eq (22) at *t* = 0 implies that *b*_{1} = *βI*_{0}. By taking the (*n* − 1)^{th} derivative both sides of (22) with respect to *t* and then plugging *t* = 0 together with the result of Lemma 2, we obtain that
This implies the result of this theorem.

### Dirichlet series approximants of the basic SIR model

Followed by Theorem 1, it is intuitive to consider the case of λ_{i} = *i*λ_{1}. This implies by setting in Theorem 3 that
which can be written in the matrix form as follows:
where *a*_{0} = ln(*S*_{∞}/*S*_{0}), *S*_{∞} can be derived by (20), and *b*_{1}, *b*_{2}, … can be obtained by the result of Theorem 3.

Now consider an approximate form of the Dirichlet series satisfying (15). Then by the previous results, we get
and *a*_{1}, …, *a*_{N} can be achieved by solving
(23)
The existence of the solution *a*_{1}, *a*_{2}, …, *a*_{N} is due to the existence of the inverse of the Vandermonde matrix [28]. Note here that this matrix equation is solvable when *N*, *a*_{0}, λ_{1}, *b*_{1}, …, *b*_{N} are known. After *u*_{N}(*t*) is obtained by solving the matrix equation above, an approximation of the solution *S*(*t*), say *S*_{N}(*t*), is derived by
(24)
The other approximations of the solutions *I*(*t*) and *R*(*t*), say *I*_{N}(*t*) and *R*_{N}(*t*) respectively, are as follows:
(25) (26)
It is implied by Theorem 3 that *c*_{k} can be written in terms of *b*_{1}, …, *b*_{k}. The process to get *c*_{k} presented in Theorem 3 is so applicable that any mathematical programming can perform the task. The terms *b*_{k} can be derived after the terms *c*_{0}, …, *c*_{k−2} were known.

### Numerical simulations for the SIR model

In this subsection, we present an algorithm to obtain the Dirichlet series approximants *S*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*). According to the previous results, the process of achieving the approximant of the SIR model is as follows:

Step 1: Setting *c*_{0} = 1, then *c*_{k}, , can be written in terms of *b*_{1}, *b*_{2}, …, *b*_{k} by using .

Step 2: Solving 1 − *S*_{∞} + (*γ*/*β*)ln(*S*_{∞}/*S*_{0}) = 0 for *S*_{∞}, setting *a*_{0} = ln(*S*_{∞}/*S*_{0}), λ_{1} = *r* − *βS*_{∞} and *b*_{0} = −*a*_{0}.

Step 3: Setting *b*_{1} = *βI*_{0}, then *b*_{k} can be written in terms of *b*_{1}, …, *b*_{k−1} by using Steps 1 and . This step gives the values of *b*_{1}, *b*_{2}, …, *b*_{N}.

Step 4: Solving the matrix Eq (23) for *a*_{1}, *a*_{2}, …, *a*_{N}. In this step we get .

Step 5: Plotting *S*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*) by using Eqs (24–26)

We first show manually how to get some *c*_{n} by performing Step 1
and then we manually derive *b*_{n} by implementing Step 3 and the result in Step 1

Fig 1 shows the comparison of the SIR solutions obtained by RK-4 method, Dirichlet series approximants (*S*_{6}(*t*), *S*_{10}(*t*), *S*_{15}(*t*)), and the semi-analytical solution. Even though the graph of the semi-analytical solution using (12) is close to the numerical solution at the beginning time interval, it has no biological meaning after 21 days passed. The infectious proportion is negative and the recovered fraction is higher than 1 when 21 days have passed, see Fig 1. The approximants *S*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*) are close to the numerical solution on the beginning and ending time intervals. As shown in Fig 1, the better approximation comes with the larger *N*. Figs 1 and 2 also illustrate that a small positive integer *N* is enough to achieve a suitable numerical approximation of the SIR solution.

Under the assumed parameters that *β* = 0.5, *γ* = 0.2 and the initial conditions *S*_{0} = 0.99, *I*_{0} = 0.01, *R*_{0} = 0, the three figures show the graphs of the proportions of susceptible, infectious, and recovered cases. The figures show the comparison of the approximate solution obtained by the numerical method (RK-4), the Dirichlet series approximants *S*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*), for *N* = 6, 10, 15, and the approximate analytical using (12).

Under the assumed parameters related to the COVID-19 situation [2] *β* = 0.35, *γ* = 0.14, and the initial conditions *S*_{0} = 0.99, *I*_{0} = 0.01, *R*_{0} = 0, the figure compares the graphs of the SIR model solutions obtained by the numerical method (RK-4) in the solid lines and the Dirichlet series approximants *S*_{15}(*t*), *I*_{15}(*t*), *R*_{15}(*t*) in the dashed lines.

Here we show *u*_{15}(*t*) corresponding to the given parameters and initial conditions in Fig 2.

By using this real Dirichlet series *u*_{15}(*t*) with (24)-(26), we get the approximated solution of the SIR model. The results above also give the long-run behavior of the considered SIR model in Fig 2 as follows:
As seen in Figs 1 and 2, the approximations *S*_{15}(*t*), *I*_{15}(*t*), *R*_{15}(*t*) are perfectly matched to the numerical solution obtained by the RK-4 method.

We note here that the approximate closed-form derived by our method presents an approximate long-run behavior of the system while the iterative RK-4 method and the exact parametric solution in [19] do not present it.

### Error comparison of the SIR model

Since the exact values of the solutions *S*(*t*), *I*(*t*), and *R*(*t*) at any time *t* are unknown because the model has no closed-form solution, we illustrate the error of our method comparing with the RK-4 method. Fig 3 shows the errors of *S*_{15}(*t*), *I*_{15}(*t*), *R*_{15}(*t*) compared with the RK-4 method. The graphs illustrate the gaps between the solutions from the RK-4 method and our method; i.e., the graphs show the differences *S*_{15}(*t*) − *S*(*t*), *I*_{15}(*t*) − *I*(*t*), and *R*_{15}(*t*) − *R*(*t*) at any time *t*. The mean squared errors of *S*_{15}, *I*_{15}(*t*), *R*_{15}(*t*) compared with the numerical solutions *S*(*t*), *I*(*t*), *R*(*t*) are 5.88606 × 10^{−6}, 5.81967 × 10^{−6} and 0.0000187405, respectively.

## A special Dirichlet series solutions of the SEIR model

In this section, we consider another compartment model consisting of the susceptible population *S*, the exposed population *E*, the infectious population *I*, and the recovered population *R* called the SEIR model whose system of differential equations is as follows:
(27) (28) (29) (30)
where the initial conditions are assumed to be *S*(0) = *S*_{0} > 0, *E*(0) = *E*_{0} > 0, *I*(0) = *I*_{0} > 0, *R*(0) = 0, and . Additionally, the total proportion at any time *t* is assumed to satisfy *S*(*t*) + *E*(*t*) + *I*(*t*) + *R*(*t*) = 1.

Let us say that we want an approximated solution *R*(*t*) of this model to be a specific Dirichlet series in the form:
(31)
By plugging (31) in (30) and (29), it is easy to see that the solutions *I*(*t*) and *E*(*t*) can be written in a similar Dirichlet form of *R*(*t*) and the constant terms of the Dirichlet expansion of *I*(*t*) and *E*(*t*) are zero. This implies that
We also simply obtain
(32)
By substituting (30) in (27), we get
Solving this separable differential equation leads to
(33)
By (32) and (33), we have
(34) Eq (31) with *t* = 0 implies that
Plugging (31) in (30) and setting *t* = 0 lead to
Now setting *D*_{n} ≔ *γ*(*σE*^{(n)}(0) − *γI*^{(n)}(0)), where *E*^{(n)}(0) and *I*^{(n)}(0) are the n^{th} derivative of *E*(*t*) and *I*(*t*) at *t* = 0, respectively, for . Taking the first derivative of (30) with respect to *t* and then plugging *t* = 0 lead us to
If we keep taking derivatives till the n^{th} derivative of *R*(*t*) with respect to *t* and plugging *t* = 0, we should get
An approximated solution *R*(*t*) could be considered in the form
where *h*_{0} is obtained by (34) and other *h*_{i} are achieved by solving the matrix equation:
(35)
Note that *D*_{n} can be recursively solved by
(36) (37) (38) (39) (40)
Eqs (35)-(40) give us an approximated solution *R*_{N}(*t*, λ_{1}). After the solution
is derived, other solutions can be achieved as follows:
(41) (42) (43)
The approximated solution (*S*_{N}(*t*), *E*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*)) of the SEIR is obtained by choosing a value of λ_{1}.

### Numerical simulations for the SEIR model

In this subsection, we present a method to achieve an approximated solution of the SEIR model by using the results of the previous subsection. Given the system of differential Eqs (27)-(30) with known parameters *β*, *σ*, *γ* and initial conditions *S*_{0}, *E*_{0}, *I*_{0}, *R*_{0}, the process to derive the approximated solution is the following:

Step 1: Derive *D*_{n} by using (36)-(40).

Step 2: Solving Eq (34) for *h*_{0},

Step 3: Solving the matrix Eq (35) for *h*_{1}, *h*_{2}, …, *h*_{N}. In this step we get .

Step 4: Fixed λ_{1} and Plotting *S*_{N}(*t*), *E*_{N}(*t*), *I*_{N}(*t*) and *R*_{N}(*t*) by using Eqs (41–43).

Note that each *D*_{n} is the function of know parameters *β*, *σ*, *γ*, *S*_{0}, *E*_{0}, *I*_{0}. Here are some examples of *D*_{n} expressions:

To illustrate the results generated by this process, we consider the SEIR model (27)-(30) with the initial conditions *S*_{0} = 0.98, *E*_{0} = 0.01, *I*_{0} = 0.01, and *R*_{0} = 0 under the assumed parameters obtained by [29], *β* = 0.75 per day, *σ* = 1/3 per day, *γ* = 1/8 per day. The comparisons are demonstrated by Figs 4 and 5. Note that in those figures, the value of λ_{1} is chosen to be 0.1. In Fig 4, the graphs of the Dirichlet series approximants *S*_{N}(*t*), *E*_{N}(*t*), *I*_{N}(*t*), and *R*_{N}(*t*) for *N* = 4, 12, 20 created by our algorithm are compared with the solution from the RK-4 method. As we can see in the figure, the Dirichlet series approximants get closer to the numerical solution obtained by the RK-4 method when *N* gets larger. Fig 5 is shown to conclude that the Dirichlet series approximants order 20, *S*_{20}(*t*), *E*_{20}(*t*), *I*_{20}(*t*) and *R*_{20}(*t*) are almost perfectly match the numerical method RK-4. The solution *R*_{20}(*t*) obtained by the algorithm is as follows:

This real Dirichlet series solution *R*_{20}(*t*) leads to other solutions *I*_{20}, *E*_{20}, and *S*_{20} by using (41)-(43). Note that for each *N* the solution *R*_{N}(*t*) gives the long-run behavior *R*_{∞}. In the considered situation, we have *R*_{∞} = 0.997535 which is obtained by solving Eq (34). We also can note here that the constant 0.997535 is the constant term of *R*_{N}(*t*) for any integer *N*. It can be concluded that under the given initial conditions and parameters in this subsection, the long-run behavior of the SEIR solution is

### Error comparison of the SEIR model

The accuracy of our method can be observed by investigating the mean square error. Fig 6 shows the errors of *S*_{20}(*t*), *E*_{20}(*t*), *I*_{20}(*t*), *R*_{20}(*t*) compared with the numerical solution obtained by the RK-4 method. The figure shows the graphs of the differences *S*_{15}(*t*) − *S*(*t*), *E*_{15}(*t*) − *E*(*t*), *I*_{15}(*t*) − *I*(*t*), and *R*_{15}(*t*) − *R*(*t*) at any time *t*. The mean square errors of *S*_{20}(*t*), *E*_{20}(*t*), *I*_{20}(*t*), *R*_{20}(*t*) compared with the numerical solutions *S*(*t*), *E*(*t*), *I*(*t*), *R*(*t*) are 0.000111401, 0.0000150904, 0.0000287791 and 0.0000675307, respectively.

## Conclusions

The presented method needs no step-size interpolation and also shows the long-run behavior of the approximate solutions; however, the exact parametric solution (SIR case) and the solution from the RK-4 method (both SIR and SEIR cases) cannot give the long-run behavior of the system since their processes need step-size interpolation. The exact parametric analytical solution (SIR case) presented in [19] does not give the closed-form solution as a function of time and it still needs a numerical method to get the SIR solution at any time *t*. The approximate closed-form Dirichlet series solution can be an alternative direct method to get the approximate solution of the SIR and SEIR models.

The theoretical results in this paper provide a numerical algorithm in order to obtain a numerical solution of the SIR and SEIR models. The derived Dirichlet series approximants obviously preserve the positive property of the SIR and SEIR solutions. The comparisons of the solution graphs shown in Figs 1, 2, 4, and 5 assure that the presented method in this manuscript can be used as an alternative method. The SIR solution in the Dirichlet series form obviously gives the long-run behavior (*S*_{∞}, 0, 1 − *S*_{∞}) which depends on the given initial conditions and the model’s parameters. As a consequence of the approach to the SIR model, a similar process is used with the SEIR model. The assumed characteristic of the solution *R*(*t*) as a real Dirichlet series leads us to the approximated solutions of the SEIR model. The solutions *S*_{N}(*t*), *E*_{N}(*t*), *I*_{N}(*t*), *R*_{N}(*t*)) obtained by our method is almost perfectly matched the solution from the RK-4 method. The solutions also obviously preserve the positive property of the SEIR model and carry the long-run behavior (*S*_{∞}, *E*_{∞}, *I*_{∞}, *R*_{∞}) which depends on the initial conditions and parameters. The method presented in this manuscript is not only useful for obtaining the SIR and SEIR models but it also can be used in many kinds of nonlinear dynamical systems.

## Supporting information

### S1 File. Wolfram mathematica codes.

There are no raw data used in this paper. All figures in this manuscript are generated by Wolfram Mathematica posted at https://github.com/Kiattisak-Prathom/Mathematica-Codes-for-PLOS-ONE.

https://doi.org/10.1371/journal.pone.0287556.s001

(ZIP)

## Acknowledgments

The authors appreciate the journal’s anonymous reviewers and editors for their insightful criticism and recommendations.

## References

- 1. Weiss HH. The SIR model and the foundations of public health. Materials matematics. 2013:0001–17.
- 2. Cooper I, Mondal A, Antonopoulos CG. A SIR model assumption for the spread of COVID-19 in different communities. Chaos, Solitons & Fractals. 2020 Oct 1;139:110057. pmid:32834610
- 3. Acemoglu D, Chernozhukov V, Werning I, Whinston MD. Optimal targeted lockdowns in a multigroup SIR model. American Economic Review: Insights. 2021 Dec;3(4):487–502.
- 4. Wintachai P, Prathom K. Stability analysis of SEIR model related to efficiency of vaccines for COVID-19 situation. Heliyon. 2021 Apr 1;7(4):e06812. pmid:33880423
- 5. Biswas MH, Paiva LT, de Pinho MD. A SEIR model for control of infectious diseases with constraints. Mathematical Biosciences and Engineering. 2014 Aug 1;11(4):761–84.
- 6. Mwalili S, Kimathi M, Ojiambo V, Gathungu D, Mbogo R. SEIR model for COVID-19 dynamics incorporating the environment and social distancing. BMC Research Notes. 2020 Dec;13(1):1–5. pmid:32703315
- 7. López L, Rodo X. A modified SEIR model to predict the COVID-19 outbreak in Spain and Italy: simulating control scenarios and multi-scale epidemics. Results in Physics. 2021 Feb 1;21:103746. pmid:33391984
- 8.
Ragusa MA, Razani A. Weak solutions for a system of quasilinear elliptic equations. arXiv preprint arXiv:2006.05262. 2020 Jun 6.
- 9. Goodarzi Z, Mokhtarzadeh MR, Pournaki MR, Razani A. A Note On Periodic Solutions Of Matrix Riccati Differential Equations. Applied Mathematics E-Notes. 2021;21:179–86.
- 10. Razani A. An existence theorem for ordinary differential equation in Menger probabilistic metric space. Miskolc Mathematical Notes. 2014;15(2):711–6.
- 11. Bjørnstad ON, Shea K, Krzywinski M, Altman N. The SEIRS model for infectious disease dynamics. Nature methods. 2020 Jun 1;17(6):557–9. pmid:32499633
- 12. Trejo I, Hengartner NW. A modified Susceptible-Infected-Recovered model for observed under-reported incidence data. PloS one. 2022 Feb 9;17(2):e0263047. pmid:35139110
- 13. Cuspilici A, Monforte P, Ragusa MA. Study of Saharan dust influence on PM10 measures in Sicily from 2013 to 2015. Ecological Indicators. 2017 May 1;76:297–303.
- 14.
Duro A, Piccione V, Ragusa MA, Veneziano V. New environmentally sensitive patch index-ESPI-for MEDALUS protocol. InAIP Conference Proceedings 2014 Dec 10 (Vol. 1637, No. 1, pp. 305-312). American Institute of Physics.
- 15. Salman SM. On a discretized fractional-order SIR model for Influenza A viruses. Prog. Fract. Differ. Appl. 2017;3(2):163–73.
- 16. Das AG, Lahiri BK. Dirichlet series solutions of differential equations. Rendiconti del Circolo Matematico di Palermo. 1984 Sep;33:425–35.
- 17. Sachdev PL, Bujurke NM, Pai NP. Dirichlet series solution of equations arising in boundary layer theory. Mathematical and computer modelling. 2000 Nov 1;32(9):971–80.
- 18. Laohakosol V, Phuksuwan O, Prathom K. Dirichlet series solutions of generalized Riccati equations. European Journal of Mathematics. 2015 Mar;1:170–85.
- 19. Harko T, Lobo FS, Mak M. Exact analytical solutions of the Susceptible-Infected-Recovered (SIR) epidemic model and of the SIR model with equal death and birth rates. Applied Mathematics and Computation. 2014 Jun 1;236:184–94.
- 20. Barlow NS, Weinstein SJ. Accurate closed-form solution of the SIR epidemic model. Physica D: Nonlinear Phenomena. 2020 Jul 1;408:132540. pmid:32362697
- 21. Heng K, Althaus CL. The approximately universal shapes of epidemic curves in the Susceptible-Exposed-Infectious-Recovered (SEIR) model. Scientific Reports. 2020 Nov 9;10(1):19365. pmid:33168932
- 22. Yıldırım A, Cherruault Y. Analytical approximate solution of a SIR epidemic model with constant vaccination strategy by homotopy perturbation method. Kybernetes. 2009 Oct 16;38(9):1566–75.
- 23. Izadi M, Seifaddini M, Afshar M. Approximate solutions of a SIR epidemiological model of computer viruses. Advanced Studies: Euro-Tbilisi Mathematical Journal. 2021 Dec;14(4):203–19.
- 24. Srivastava HM, Area Carracedo IC, Nieto JJ. Power-series solution of compartmental epidemiological models. Mathematical Biosciences and Engineering. 2021 Apr 12. pmid:34198385
- 25. Akindeinde SO. A new multistage technique for approximate analytical solution of nonlinear differential equations. Heliyon. 2020 Oct 1;6(10):e05188. pmid:33088955
- 26. Vazquez-Leal H, Benhammouda B, Filobello-Nino U, Sarmiento-Reyes A, Jimenez-Fernandez VM, Garcia-Gervacio JL, et al. Direct application of Padé approximant for solving nonlinear differential equations. SpringerPlus. 2014 Dec;3(1):1–1. pmid:25332863
- 27.
Baker GA, Baker GA Jr, Graves-Morris P, Baker SS. Pade Approximants: Encyclopedia of Mathematics and It’s Applications, Vol. 59 Baker George A. Jr., Peter Graves-Morris. Cambridge University Press; 1996 Jan 26.
- 28. Turner LR. Inverse of the Vandermonde matrix with applications. 1966 Aug 1.
- 29. Carcione JM, Santos JE, Bagaini C, Ba J. A simulation of a COVID-19 epidemic based on a deterministic SEIR model. Frontiers in public health. 2020 May 28;8:230. pmid:32574303