Given the values
$$ \begin{array}{|c|ccccc|} \hline t & 1 & 2 & 3 & 4 & 5\\ \hline Q & 14 & 58 & 260 & 1140 & 5660 \\\hline \end{array} $$fit the exponential function $Q\left(t\right)=r\,e^{\,st},$ finding $r$ and $s$ with least squares criterion.
The exponential function is used in simple models of populations and epidemics. It is assumed that the variation in a population $P$ over time, $\dfrac{dP}{dt},$ is proportional to the existing population. And in an epidemic model, the appearance of new cases of infected individuals is proportional to the number of the already infected.
In an epidemic, the constant $k$ depends on the probability that one person infects others. This is a simple model that assumes that $k$ is constant.
Without losing generality, we can assume that $t_0 = 0$ and that $P(t_0)=P_0$ and solving the differential equation
The exponential function depends on two parameters. In the case of a population model, $P_0$ is the number of individuals at the considered initial moment and $k$ is the relative population growth constant. In the case of an epidemic, $P_0$ would the number of infected at the considered initial moment and $k$ is part of the basic reproductive number, which is the average number of cases that an infected individual generates and is $R_0=e^{\,k\tau}$ where $\tau$ is the infectious period. If $R_0\lt 1$ the epidemic declines while if $R_0\gt 1$ it spreads.
If the data satisfy (approximately) that $Q = r\,e^{st}$ the (most suitable) fit will not be linear. We have two options:
that using the points
it is
This function is differentiable, but the problem is that if we calculate the partial derivatives with respect to $r$ and $s$, we obtain a system of non-linear equations that are, in general, difficult to solve. Like nonlinear equations, systems of nonlinear equations are usually solved iteratively and can be sensitive to the chosen starting point.
Another way to solve it would be to minimize this function directly with an optimization algorithm. These algorithms are also often iterative and the results depend on the starting point.
The advantage of this method is that (if we have enough points and they meet certain conditions) the solution is determined and is calculated by solving a system of linear equations. The solution does not totally match the solution in the first approach, but it works very well in a much simpler way.
So we linearize the function to approximate. If we take into account that
$$ \ln(AB)=\ln A +\ln B \quad \ln A^B =B\ln A \quad \ln e = 1 $$then
$$ Q = r\,e^{\,st} \quad \Longrightarrow \quad \ln Q = \ln(r\,e^{\,st}) \quad \Longrightarrow \quad \ln Q = \ln r +\ln(e^{\,st}) \quad \Longrightarrow$$$$\Longrightarrow \quad \ln Q = \ln r +st\,\ln e \quad \Longrightarrow \quad \ln Q = \ln r +s\,t $$And if we call
$$ y_k = \ln Q_k, \quad x_k =t_k, \quad a_0 = \ln r, \quad a_1=s $$we have
$$ \ln Q_k \approx \ln r +s\,t_k \quad \Longrightarrow \quad y_k \approx a_0 + a_1\, x_k $$The problem is now to fit a least squares regression line
$$ P_1(x) = a_0 + a_1\, x $$to the transformed data $(x_k,y_k),\quad k = 1,\ldots,5$ with the system
We compute the elements of these matrices
and
$$ \begin{array}{rcrcc} 5\,a_{0} & + & 15\,a_{1} & = & 27.94\\ 15\,a_{0} & + & 55\,a_{1} & = & 98.80 \end{array} $$And the solution is $a_0 = 1.093 \quad a_1=1.498$. As
The approximate curve is
$$ Q(t)=3\,e^{\,1.5t} $$Summarizing: