# Mathematical Modeling and Simulation of Logistic Growth
## 3 Materials and Methods
### Proposed Simulation of Logistic Growth
Time advances in steps, with a fixed increment of \(\Delta t=1\), and, at each timestep, for each creature that makes up the current population \(N\), starting from \(N_{0}\), we draw \(R\) and \(D+cN\) as samples from the uniform distribution. To account for the corresponding random processes of reproduction and death adjusted for crowding, we apply the _rejection sampling_ method [17], which requires _threshold_ probability values for comparison with the stochastic ones. Threshold values result from the exploration and tuning of the simulation parameters with respect to the mathematical model described in Section 3.3, and they were employed to test each creature with the following conditions. * If the drawn probability for \(R\) is smaller than the corresponding threshold set for \(R\), then the creature reproduces, introducing a new one in the system. * If the drawn probability for \(D+cN\) is smaller than its threshold, then the same creature dies. We note that the threshold probability value for \(D+cN\) is dynamic, depending on the current value of \(N\) at each timestep. * If both probability samples satisfy or do not satisfy their matching inequalities, then \"nothing happens\": either the same creature reproduces, dies, and is replaced by its own copy, or it keeps living without causing any change. After taking into account all current \(N\) creatures, the value of \(N\) is updated. As a consequence, the number of creatures that die is subtracted from the number of creatures that are born, leading to either an increase, decrease, or zero net change in the population for the next timestep. The number of timesteps or iterations is an additional parameter of the system, since it is otherwise non-terminating: when the carrying capacity \(L\) is reached, the value of \(N\) becomes stationary. Depending on the research question and computational resources, users can arbitrarily interrupt the simulation. For example, they can focus on the short-term, logistic behavior of the system or on the long-term, steady-state behavior. Conforming to the method of _independent replications_[17], the number of simulations can also be set as a system parameter, complying with customized accuracy standards. To handle multiple simulation runs, we have set matching sequential prime numbers as seeds, employing the PRNG that implements the Mersenne Twister 1997 algorithm from the _Math.NET_ Project ([[https://numerics.mathdotnet.com/Random](https://numerics.mathdotnet.com/Random)]([https://numerics.mathdotnet.com/Random](https://numerics.mathdotnet.com/Random)), accessed on 14 February 2025). To conduct a statistical analysis of the output, we ran the simulation 1000 times, with a specific parameter setting derived from the exploration and tuning steps of the pipeline, whose detailed description and reported results are, respectively, available in Sections 3.3 and 4.3. We mainly focused on three behaviors of the system (see Section 4.1):  
* _short-term_, which represents the _sigmoid_ phase, including lag, acceleration, and deceleration, also named _head_, with \(t\in[t_{0},2t^{*}]\);
* _steady-state_, or _tail_, when the system hits the carrying capacity limit and becomes stationary, with \(t\in[2t^{*},t_{max}]\);
* _long-term_, which comprises both _head_ and _tail_, accounting for the whole evolution of the system, with \(t\in[t_{0},t_{max}]\). We captured the trend of the simulated growth through two main measures: the iteration mean \(\mu(N_{i})\) and the iteration variance \(\sigma^{2}(N_{i})\). The iteration (sample) mean \(\mu(N_{i})\) is computed, on iteration \(i\), by summing over the set \(\mathcal{S}\) of simulations performed and dividing by \(|\mathcal{S}|\):  
\[\mu(N_{i})=\frac{\sum_{j\in\mathcal{S}}N_{ij}}{|\mathcal{S}|} \tag{14}\]  
where \(N_{ij}\) is the current population per simulation, or the value \(N_{i}\) of \(N\) at timestep \(i\), corresponding to simulation \(j\).