1 Introduction

One of the first formal descriptions of chemical interactions between different species of plants (including microorganisms) appears in Küster’s 1909 lectures (Küster and Roux 1909), which Molisch refers to when defining “allelopathy” (Molisch et al. 1938). Allelopathy (from Greek allelon, meaning “mutual", and pathos, meaning “to feel") was coined by Molisch in 1938 (Molisch et al. 1938) to describe the biochemical inhibition or catalysis of one species of plants by another. Initially, in 1974 Rice re-defined it as a solely detrimental interaction between plants in the first edition of his book dedicated to allelopathy (Elroy 1974). Rice, however, changed his definition in a 1984 re-edition of his book (Rice 1984), arguing that the elimination of the positive effects in the definition was rather artificial and did not agree with more recent experimental findings (Rizvi 1992). Although allelopathy is often described as a plant-to-plant interaction, it can also describe the interaction between other species, such as microbes or even herbivores (Weir et al. 2004). During this biochemical phenomenon, a plant releases allelochemicals (biomolecules specific to the context of allelopathy), negatively or positively impacting other susceptible species in its environment. Some of the compounds due to allelochemical release have been found in soil in sufficient quantities to reduce nearby plant growth. This has encouraged the search for active allelochemicals to serve as bio-herbicides (Putnam 1998; Soltys et al. 2013).

Mathematics offers an appropriate language to describe the dynamics of complex physical systems with outstanding applications, particularly in studying many ecological processes. Most notably, ordinary differential equations (ODEs) are powerful mathematical tools for this purpose, playing a crucial role in formulating dynamic models in Ecology, such as the study of allelopathy. The number of contributions in this regard is relatively vast. They can be roughly classified in terms of the class of ODEs used. First, the seminal works were formulated via classical ODEs (An et al. 2003; Martins 2006). Afterward, variations of them, based on delay ODEs (Mukhopadhyay et al. 1998; Mu and Lo 2022; Kumar and Dipesh 2022) or on fractional ODEs (Abbas et al. 2016; Asl and Javidi 2018), have also been proposed. Delay ODEs aim to account for the maturity required for some species to produce a substance that will be toxic (or stimulatory) to another. In contrast, fractional ODEs allow the generalization of results obtained via models with classical ODEs when the differentiation order is a positive non-integer, and the non-local nature of the operator (integral operator) defining fractional derivatives permits to account for possible memory effects in the physical process. Besides classifying the dynamic models for allelopathy by ODE type (classical, fractional, delay), the models can also be classified in terms of their deterministic or stochastic/random nature. Although most of the proposed models are deterministic, over the last decade, there has been an increase in the number of contributions considering uncertainty in formulating dynamical mathematical models explaining the allelopathy phenomenon. Most are constructed via the so-called stochastic differential equations (SDEs) (Allen 2007; Øksendal 2003). Under this approach, the deterministic model’s parameters are the most affected by uncertainties (e.g., growth rates that may be affected by environmental effects) and are perturbed according to some stochastic process. Based on the Central Limit Theorem, one often considers Gaussian-type processes, such as the Wiener process (or some transformation of it). This leads to Itô-type SDEs whose uncertainty is driven by the so-called white noise process. Interesting examples in this regard include Ji et al. (2020) and Mandal and Banerjee (2013). In Mandal and Banerjee (2013), they propose a system of Itô-type SDEs to model the competitiveness of phytoplankton with allelopathy by incorporating the environmental fluctuation in the cell proliferation rates. In Ji et al. (2020), authors develop an Itô-type SDE competitive phytoplankton model with allelopathy and regime-switching, providing sufficient criteria to ensure that the model possesses a unique ergodic stationary distribution. It is worth pointing out that some have also proposed hybrid models based on SDEs, that combine delay and uncertainties in their formulation to understand the effect of environmental fluctuations on two competitive phytoplankton species; see, for example, Bandyopadhyay et al. (2008). As previously pointed out, all these contributions to allelopathy modeling propose to describe uncertainties via SDEs. However, as rightly highlighted in Smith (2014, p. 96), complementary to SDEs, one can model uncertainties through Random Differential Equations (RDEs). As indicated in Han and Kloeden (2017, p. 4), RDEs seem to have remained in the shadow of SDEs for many years. In RDEs, the random effects are directly manifested in model parameters (initial/boundary conditions, forcing or source term and/or coefficients) that are assumed to be random variables or stochastic processes with regular behavior (e.g., sample continuous or differentiable) with respect to time and/or space. SDEs and RDEs exhibit clear distinctions from each other and require entirely different techniques for analysis and approximation (Smith 2014, Sect. 4.7). Excellent texts where RDEs are rigorously treated include Neckel and Rupp (2013), Soong (1973) and Xiu (2017). In contrast with what happens in the deterministic setting, where the main goal is solving, exactly or approximately, the corresponding differential equation, in the stochastic/random context, the goal goes even further. Indeed, when studying SDEs/RDEs, it is also very important to obtain the main statistical properties of the solution, say \(X(t) \equiv X(t,\omega )\) (where \(\omega\) is the outcome). We want to determine properties such as the mean (\(\mu _{X}(t):=\mathbb {E}[X(t)]\)) and the variance (\(\sigma ^2_{X}(t):=\mathbb {V}[X(t)]=\mathbb {E}[(X(t))^2]-(\mu _{X}(t))^2\)) functions. A preferable goal is the calculation of the so-called “fidis” (finite distributions of the solution) (Mikosch 1998), and, particularly the first probability density function (1-PDF), \(f_{X(t)}(x)\), since, from it, one can easily calculate by integration the mean and variance, but also any higher-order one-dimensional moment

$$\begin{aligned} \mathbb {E}[(X(t))^k]= \int _{-\infty }^{\infty } x^k f_{X(t)}(x)\, \textrm{d}x, \qquad k=1,2, \ldots , \end{aligned}$$
(1)

provided it exists. Furthermore, the calculation of the 1-PDF permits constructing exact confidence intervals for a specific confidence level, say \(1-\alpha \in (0,1)\), without using rules-of-thumb, such as \([\mu _{X}(t)\pm 1.96 \sigma _{X}(t)]\), which are only exact for the Gaussian case (Casella and Berger 2007).

This paper aims to revisit a deterministic mathematical model, initially proposed by An et al. (2003) and later generalized by Martins (2006), to study the dynamics of allelochemicals from living plants in the environment. This model is formulated via a system of ODEs with jumps in the source term to account for the synthesis of allelochemicals over time. We shall randomize the original model using the aforementioned RDEs approach. We then will construct the 1-PDF of the solution, which is a stochastic process and will give the probability distribution of its steady state. As will be seen later, a main point in our probabilistic study is the application of our theoretical findings to real-world data. We here point out that this may be of particular interest to the scientific community of Ecology since most of the deterministic and stochastic/random models based on ODEs and SDEs/RDEs, respectively, illustrate their theoretical results via synthetic simulations.

The deterministic model proposed in Martins (2006) is given by

$$\begin{aligned} \left\{ \begin{array}{lcc} A_P'(t) = -k_1A_P(t) + g(t), \\ A_E'(t) = k_1 A_P(t) - k_2 A_E(t), \end{array} \right. \end{aligned}$$
(2)

where \(A_P(t)\) represents the amount of allelochemicals present in the living plant at time t, and \(A_E(t)\) is the amount of allelochemicals present in its environment at the same time t. In Martins (2006), it is also assumed that \(A_P(0)=A_P^0\) and \(A_E(0)=0\), i.e., that, initially, there is an absence of allelochemicals in the environment. The coefficient \(k_1>0\) represents the rate constant of allelochemical release per unit of time, \(k_2>0\) is the rate constant of allelochemical degradation per unit of time, and g(t) is a function that represents the synthesis of allelochemicals during growth and development. The system of ODEs (2) can be represented by means of a compartmental model as shown in Fig. 1.

Fig. 1
figure 1

Compartmental representation of system of ODEs (2)

In Martins (2006), one deals with the case that the amount synthesized, g(t), is constant and positive except at regular time intervals where the plant does not produce any allelochemicals. The study of allelopathy has shown that when the environment becomes particularly stressful, the production of allelochemicals dramatically increases (An et al. 2003). So this function has a biological interpretation and can be viewed as an averaged or mean-field model for allelochemical production of a plant in a periodically stressful environment. The mathematical statement of the function, proposed in Martins (2006), is as follows:

$$\begin{aligned} g(t)= \left\{ \begin{array}{lll} 0, &{} t\in I_1:=[0, t_1),\\ \\ g_0, &{} t\in I_2^n:=[t_1 + nT, t_1 + \delta + nT], \\ \\ 0, &{} t\in I_3^n:=(t_1 + \delta + nT, t_1 + (n+1)T ), \end{array} \right. \end{aligned}$$
(3)

where \(n=0,1, \ldots ,\) is the number of times the synthesis occurs, \(t_1>0\) is the time at which the first synthesis takes place, \(g_0>0\) is the synthesis rate, and \(\delta\) and T with \(0<\delta < T\), are the duration of the synthesis period and the occurrence of stress periods, respectively. To facilitate the visualization of the above-described function g(t), we present in Fig. 2 a graphical representation. The constant term \(g_0>0\) can be seen as an average of the synthesized allelochemical quantity by the plant through all the active periods. As usual, when dealing with mean-field models, this greatly simplifies the expression of g(t) compared to an expression where the constant term may vary in each active interval making the model mathematically more treatable.

Fig. 2
figure 2

Graphical representation of g(t) (in blue) as described in (3)

As reported in different studies on allelopathy (see, for example, Trezzi et al. (2016)), the model parameters \(k_1\), \(k_2\), and \(g_0\) depend on genetic factors or the environment and their interaction, thus making allelopathy a complex phenomenon that is not known deterministically. Consequently, not only due to the aforementioned complexity but also because of the errors associated with the measurements required to calibrate model parameters [see further comments, for example, in Macías et al. (2014, Sect. 5)], it is reasonable to treat \(k_1\), \(k_2\) and \(g_0\) as random quantities. Likewise, in practice, the initial condition \(A_P^0\), representing the amount of allelochemicals present initially at the living plant, is approximated from measurements, which also involves uncertainties. This motivates us to regard all model parameters as random variables rather than deterministic quantities. In this way, model (2)–(3) shall be reformulated as a system of RDEs with random jumps and random initial conditions.

The paper is organized as follows. In Sect. 2, we first introduce the deterministic formulation of the allelochemical dynamics and obtain its explicit solution. Secondly, we formulate the randomization of the model, and we then develop its probabilistic analysis, which includes the calculation of the 1-PDF of its solution. To illustrate the applicability of the findings obtained in the random setting, in Sect. 3, we use inverse uncertainty quantification techniques to calibrate suitable probability distributions for model parameters using real-world data of alkaloid contents from leaching thornapple seed. In Sect. 4, we present an alternative method to compute the 1-PDF of the solution that can be successfully applied even when an explicit solution of the model is not available. We also illustrate the application of this alternative approach. Conclusions are drawn in Sect. 5.

2 From the deterministic to the random model

As has been motivated in the previous section, we have reformulated the deterministic model (2)–(3) in the random setting using the approach based on RDEs. To conduct the subsequent random analysis, we first need to introduce the deterministic solution of the model, including its equilibrium point. The latter is presented in Sect. 2.1 while the former is developed in Sect. 2.2.

2.1 Deterministic solution

To obtain the solution to the deterministic system (2)–(3), we first verified the solution proposed in Martins (2006). Our solution for \(A_P(t)\) is the same, but we found some changes to the solution of \(A_E(t)\), which provides a smoother function. It is mathematically intuitive in the sense that the non-smooth behavior of \(A_P(t)\) is inferred from the discontinuity of g(t) (observe that \(A_P(t)\) can be calculated from the first equation in (2) and that it depends on g(t)). Once \(A_P(t)\) has been obtained, then \(A_E(t)\) is calculated via the integration (which smooths out the solution) of the second equation of (2)). In Fig. 3, we show a graphical representation of \(A_P(t)\) and \(A_E(t)\) taking as deterministic model parameters \(k_1=0.05\), \(k_2=0.2\), \(A^0_p=0.3\), \(g_0=0.02\), \(t_1=6\), \(T=24\) and \(\delta =6\). We select these parameters to facilitate a direct comparison of our results with those in Martins (2006), as they are the same parameters used in Fig. 2 of that publication.

Because the above-mentioned altered analytical result also coincided with our computational solution of the system, we continue to use it throughout this work. Assuming that there are no allelochemicals in the environment at the start, e.g., \(A_E(0)=0\), our solution is:

$$\begin{aligned} A_P(t)= \left\{ \begin{array}{lcc} A_P^{0} \textrm{e}^{-k_1 t} =: P(t), &{} t \in I_1, \\ \\ P(t) +\frac{g_0}{k_1}+ C_P^2(t), &{} t \in I_2^n, \\ \\ P(t) + C_P^3(t), &{} t \in I_3^n, \end{array} \right. \end{aligned}$$
(4)

where

$$\begin{aligned} C_P^2(t):=\frac{g_0}{k_1} \textrm{e}^{-k_1(t-t_1)} \left[ (e^{k_1 \delta } - 1)\frac{1-e^{nk_1 T}}{1-e^{k_1 T}} - e^{nk_1T}\right] ,\quad C_P^3(t) :=\frac{g_0}{k_1} \textrm{e}^{-k_1(t-t_1)} (e^{k_1 \delta } - 1)\left[ \frac{1-e^{(n+1)k_1 T}}{1-e^{k_1 T}}\right] , \end{aligned}$$
(5)

and

$$\begin{aligned} A_E(t)= \left\{ \begin{array}{lcc} \frac{k_1A_P^{0}}{k_2-k_1} (\textrm{e}^{-k_1t} - \textrm{e}^{-k_2t}):= E(t), &{} t \in I_1,\\ \\ E(t) + \frac{g_0}{k_2} + C_E^2(t), &{} t \in I_2^n, \\ \\ E(t) +C_E^3(t), &{} t \in I_3^n, \end{array} \right. \end{aligned}$$
(6)

where

$$\begin{aligned} \begin{aligned} C_E^2(t)&\quad :=\frac{1}{( e^{(k_1 T)}-1) ( e^{(k_2 T)}-1) k_2 (-k_1 + k_2)}[e^{-((k_1 + k_2) t)} g_0 (e^{(k_1 t + k_2 t_1)} k_1 \\&\quad - e^{(k_1 (t + T) + k_2 t_1)} k_1 - e^{(k_1 t + k_2 (\delta + t_1))} k_1 + e^{(k_1 (t + T) + k_2 (\delta + t_1))} k_1 \\&\quad + e^{(k_1 t + k_2 (\delta + n T + t_1))} k_1 - e^{(k_1 (t + T) + k_2 (\delta + n T + t_1))} k_1 \\&\quad + e^{(k_1 t + k_2 (T + n T + t_1))} (-1 + e^{(k_1 T)}) k_1 \\&\quad - e^{(k_2 t + k_1 t_1)} k_2 + e^{(k_2 (t + T) + k_1 t_1)} k_2 \\&\quad + e^{(k_2 t + k_1 (\delta + t_1))} k_2 - e^{(k_2 (t + T) + k_1 (\delta + t_1))} k_2 \\&\quad - e^{(k_2 t + k_1 (\delta + n T + t_1))} k_2 + e^{(k_2 (t + T) + k_1 (\delta + n T + t_1))} k_2 \\&\quad + e^{(k_2 t + k_1 (T + n T + t_1))} k_2 - e^{(k_2 (t + T) + k_1 (T + n T + t_1))} k_2)] \end{aligned} \end{aligned}$$
(7)

and

$$\begin{aligned} \begin{aligned} C_E^3(t)&\quad :=\frac{1}{(e^{k_1 T}-1) (e^{k_2 T} -1)(k_1-k_2)k_2}[e^{-((k_1 + k_2) t)} g_0 (-e^{k_1 t + k_2 t_1} k_1\\&\quad + e^{(k_1 (t + T) + k_2 t_1)} k_1 + e^{(k_1 t + k_2 (\delta + t_1))} k_1\\&\quad - e^{(k_1 (t + T) + k_2 (\delta + t_1))} k_1 + e^{(k_1 t + k_2 (T + n T + t_1))} (-1 + e^{(\delta k_2))} (-1 + e^{(k_1 T)}) k_1\\&\quad + e^{(k_2 t + k_1 t_1)} k_2 - e^{(k_2 (t + T) + k_1 t_1)} k_2 \\&\quad -e^{(k_2 t + k_1 (\delta + t_1))} k_2 + e^{(k_2 (t + T) + k_1 (\delta + t_1))} k_2\\&\quad - e^{(k_2 t + k_1 (T + n T + t_1))} k_2 + e^{(k_2 (t + T) + k_1 (T + n T + t_1))} k_2 \\&\quad -e^{(\delta k_1 + k_2 (t + T) + k_1 (T + n T + t_1))} k_2 + e^{(k_2 t + k_1 (\delta + T + n T + t_1))} k_2)]. \end{aligned} \end{aligned}$$
(8)
Fig. 3
figure 3

Solution to system (2)–(3) with \(k_1=0.05, k_2=0.2,A^0_p=0.3,g_0=0.02,t_1=6,T=24,\delta =6\)

2.2 Random solution

In order to capture the uncertainty present in the complex mechanics of allelochemical production and dissipation in the environment, we shall now consider the model inputs \(A_P^0=A_P^0(\omega )\), \(k_1=k_1(\omega )\), \(k_2=k_2(\omega )\) and \(g_0=g_0(\omega )\) as absolutely continuous random variables defined in a common complete probability space \((\Omega ,\mathcal {F}, \mathbb {P})\), where \(\omega \in \Omega\) denotes an outcome. Although \(k_1\), \(k_2\), \(A_p^0\) and \(g_0\) are assumed random variables, note that we will denote them using lower case letters. Rather than capital letters, as usually done in Probability, to follow the same notation used in the original model (An et al. 2003). Hereinafter, \(f_{k_1, k_2, g_0,A_P^0}(k_1, k_2, g_0,A_P^0)\) will denote their joint PDF. Consequently, the solution \((A_P(t):=A_P(t,\omega ), A_E(t):=A_E(t,\omega ))\) of the randomized model is defined in terms of two parametric stochastic processes, whose expressions are, respectively given by, (4)–(5), and (6)–(8). Our main goal will be calculating their respective 1-PDFs.

As explicit expressions for \(A_P(t)\) and \(A_E(t)\) are available, we will achieve this goal by taking advantage of the Random Variable Transformation (RVT) method. This result permits calculating the joint PDF of a random vector that comes from the mapping of another random vector whose PDF is known. In its n-dimensional form, this result reads as follows:

Theorem 1

(RVT technique) (Soong 1973, Sect. 2.4.2) Let \(\textbf{u}=\textbf{u}(\omega )=(u_1(\omega ),\ldots ,u_n(\omega ))\) and \(\textbf{v}=\textbf{v}(\omega )=(v_1(\omega ),\ldots ,v_n(\omega ))\) be n-dimensional absolutely continuous random vectors defined in a complete probability space \((\Omega ,\mathcal {F}_{\Omega },\mathbb {P})\), where \(\omega \in \Omega\). Let \(\textbf{r}: \mathbb {R}^n \rightarrow \mathbb {R}^n\) be a one-to-one transformation of \(\textbf{u}\) into \(\textbf{v}\), i.e., \(\textbf{v}=\textbf{r}(\textbf{u})\). Assume that \(\textbf{r}\) is continuous in \(\textbf{u}\), has continuous partial derivatives with respect to \(\textbf{u}\) and \(\left| \frac{\partial \textbf{r}}{\partial \textbf{u}}\right| (\textbf{u}) \ne 0\) for all \(\textbf{u}\in \mathbb {R}^n\). Then, if \(f_{\textbf{u}}(\textbf{u})\) denotes the joint PDF of the random vector \(\textbf{u}\), and \(\textbf{s}=\textbf{r}^{-1}=(s_1(v_1,\ldots ,v_n),\ldots ,s_n(v_1,\ldots ,v_n))\) denotes the inverse mapping of \(\textbf{r}=(r_1(u_1,\ldots ,u_n),\ldots ,r_n(u_1,\ldots ,u_n))\), the joint PDF of the random vector \(\textbf{v}\) is given by

$$\begin{aligned} f_{\textbf{v}}(\textbf{v})=f_{\textbf{u}}\left( \textbf{s}(\textbf{v})\right) \left| J_n \right| , \end{aligned}$$

where \(\left| J_n \right|\) is the absolute value of the Jacobian, which is defined by

$$\begin{aligned} J_n=\det \left( \frac{\partial \textbf{s}}{\partial \textbf{v}}\right) = \det \left( \begin{array}{ccc} \dfrac{\partial s_1(v_1,\ldots , v_n)}{\partial v_1} &{} \cdots &{} \dfrac{\partial s_n(v_1,\ldots , v_n)}{\partial v_1}\\ \vdots &{} \ddots &{} \vdots \\ \dfrac{\partial s_1(v_1,\ldots , v_n)}{\partial v_n} &{} \cdots &{} \dfrac{\partial s_n(v_1,\ldots , v_n)}{\partial v_n}\\ \end{array} \right) . \end{aligned}$$

Now, we will take extensive advantage of this result for random vectors to obtain the 1-PDF of the parametric stochastic processes \(A_P(t)\) and \(A_E(t)\). To do this for \(A_P(t)\), we first fix \(t \ge 0\) and then consider the transformation \(\textbf{r}: \mathbb {R}^4 \longmapsto \mathbb {R}^4\) (so here \(n=4\)):

$$\begin{aligned} \textbf{r}(\textbf{u})=\textbf{v}\quad \text {where} \quad \textbf{u}:=(k_1, k_2, A_P^{0}, g_0) \longmapsto \left( k_1, k_2, A_P(t),g_0\right) :=\textbf{v}. \end{aligned}$$
(9)

This mapping \(\textbf{r}\) is invertible and its inverse, \(\textbf{s}: \mathbb {R}^4 \longmapsto \mathbb {R}^4\), is:

$$\begin{aligned} \textbf{v}=(k_1, k_2, A_P(t), g_0) \longmapsto \left( k_1, k_2, A_P^{0},g_0\right) =\textbf{u}, \end{aligned}$$
(10)

where, using expression (4),

$$\begin{aligned} A_P^0= \left\{ \begin{array}{lcc} A_P(t) \textrm{e}^{k_1 t}, &{} t \in I_1,\\ \\ (A_P(t) - C_P^2(t)-\frac{g_0}{k_1})\textrm{e}^{k_1t}, &{} t \in I_2^n, \\ \\ (A_P(t) - C_P^3(t))\textrm{e}^{k_1t}, &{} t \in I_3^n, \end{array} \right. \end{aligned}$$
(11)

where \(\{I_1,I_2^n,I_3^n\}\) and \(\{C_P^2(t),C_P^3(t)\}\) are defined in (4) and (5), respectively. Since \(C_P^2(t)\) and \(C_P^3(t)\) do not depend on \(A_P^0\), for all cases, the absolute value of the Jacobian of the inverse is \(|J_4|=\textrm{e}^{k_1t}>0\). Then, for a given t, applying Th. 1, the PDF of \(A_P(t)\), denoted by \(f_{A_P(t)}(x)\), can be expressed by the following explicit expression:

$$\begin{aligned} f_{A_P(t)}(x)= \left\{ \begin{array}{lcc} {\int }_{\mathbb {R}^3} f_{k_1, k_2, A_P^0, g_0} (k_1, k_2, x\textrm{e}^{k_1t}, g_0) \textrm{e}^{k_1t} \textrm{d}k_1 \textrm{d}k_2 \textrm{d}g_0, &{} t \in I_1,\\ {\int }_{\mathbb {R}^3} f_{k_1, k_2, A_P^0, g_0} (k_1, k_2, (x - C_P^2(t)-\frac{g_0}{k_1})\textrm{e}^{k_1t}, g_0) \textrm{e}^{k_1t} \textrm{d}k_1 \textrm{d}k_2 \textrm{d}g_0, &{} t \in I_2^n, \\ {\int }_{\mathbb {R}^3} f_{k_1, k_2, A_P^0, g_0} (k_1, k_2, (x - C_P^3(t))\textrm{e}^{k_1t}, g_0) \textrm{e}^{k_1t} \textrm{d}k_1 \textrm{d}k_2\, \textrm{d}g_0, &{} t \in I_3^n. \end{array} \right. \end{aligned}$$
(12)

Depending on the specific form of the PDF of model parameters, \(f_{k_1, k_2, A_P^0, g_0}\), the above multidimensional integral representation of the 1-PDF of \(A_P(t)\) may slow down the computational burden. In such a case, it is interesting to observe that \(f_{A_P(t)}(x)\) can be expressed in terms of an expectation in the case that the initial condition, \(A_P^0\), and the rest of the model parameters, \((k_1,k_2,g_0)\), are independent random variables, which is natural from an applied standpoint,

$$\begin{aligned} f_{A_P(t)}(x)= \left\{ \begin{array}{lcc} \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0}\big (x e^{k_1 t}\big ) e^{k_1 t}\big ], &{} t \in I_1,\\ \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0}\big ((x-C_P^2(t)-\frac{g_0}{k_1})e^{k_1 t}\big ) e^{k_1 t}\big ], &{} t \in I_2^n, \\ \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0}\big ((x-C_P^3(t))e^{k_1 t} \big ) e^{k_1 t}\big ], &{} t \in I_3^n. \end{array} \right. \end{aligned}$$
(13)

We can proceed in a similar manner to obtain the 1-PDF, \(f_{A_E(t)}(x)\), of the parametric stochastic process \(A_E(t)\). We first fix \(t\ge 0\), and we now apply the RVT method to the following mapping:

$$\begin{aligned} (k_1, k_2, A_P^{0}, g_0) \longmapsto \left( k_1, k_2, A_E(t),g_0\right) , \end{aligned}$$
(14)

whose inverse is

$$\begin{aligned} (k_1, k_2, A_E(t), g_0) \longmapsto \left( k_1, k_2, A_P^{0},g_0\right) . \end{aligned}$$
(15)

where, taking into account (6),

$$\begin{aligned} A_P^0= \left\{ \begin{array}{lcc} \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}A_E(t), &{} t \in I_1,\\ \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}(A_E(t) - C_E^2(t)-\frac{g_0}{k_2}), &{} t \in I_2^n, \\ \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}(A_E(t) - C_E^3(t)), &{} t \in I_3^n. \end{array} \right. \end{aligned}$$
(16)

As \(C_E^2(t)\) and \(C_E^3(t)\) do not depend on \(A_P^0\), for the three cases, the absolute value of the Jacobian of the inverse mapping is \(\frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\ne 0\) with probability 1 (w.p. 1) since, by hypothesis, \(k_1=k_1(\omega )\) and \(k_2=k_2(\omega )\) are absolutely continuous random variables. Therefore, applying Th. 1, and assuming that \(A_P^0\) is independent of \((k_1,k_2,g_0)\), the 1-PDF of \(A_P(t)\) can be represented by means of the following expectations:

$$\begin{aligned} f_{A_E(t)}(x)= \left\{ \begin{array}{lcc} \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0} \big ( \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}x \big ) \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\big ], &{} t \in I_1,\\ \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0}\big ((x - C_E^2(t)-\frac{g_0}{k_2})\frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\big ) \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\big ], &{} t \in I_2^n, \\ \mathbb {E}_{k_1,k_2,g_0}\big [f_{A_P^0}\big ((x - C_E^3(t))\frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\big ) \frac{k_2 - k_1}{k_1(\textrm{e}^{-k_1 t} - \textrm{e}^{-k_2t})}\big ], &{} t \in I_3^n. \end{array} \right. \end{aligned}$$
(17)

2.3 Study of probabilistic stability

To conduct the probabilistic analysis of the stability, we first calculate, using classical techniques, the equilibria, which now are random vectors, and we then give an explicit expression for their PDFs to characterize their probabilistic behavior.

Let us first note that we have explicit expressions for \(A_P(t)\) and \(A_E(t)\), in (4)–(5), and (6)–(8), respectively. As \(t\rightarrow \infty\), we will be within two types of intervals, namely, \(I_2^n\) and \(I_3^n\). Let us observe, from expression (4), that \(\lim _{t\rightarrow \infty } P(t) = 0\) and \(\lim _{t\rightarrow \infty } C_P^2(t) = 0\) since \(k_1>0\), so \(\lim _{t\rightarrow \infty } A_P(t) = g_0/k_1\). The analysis within the intervals of type \(I_3^n\) is similar. Since \(\lim _{t\rightarrow \infty } C_P^3(t) = 0\), then \(\lim _{t\rightarrow \infty } A_P(t) = 0\). The analysis for the calculation of \(\lim _{t\rightarrow \infty } A_E(t) = 0\) is similar. First, observe that \(\lim _{t\rightarrow \infty } E(t) = 0\) since \(k_1,k_2>0\). Moreover, it is easy to check that \(\lim _{t\rightarrow \infty } C_E^2(t) = 0\), since the factor dominating the limit behavior is \(e^{-(k_1+k_2)t}\longrightarrow 0\) as \(t\rightarrow \infty\) (note that the rest of terms that depend on t are of the form \(e^{k_i t}\), \(i=1,2\)). Consequently, within \(I_2^n\), \(\lim _{t\rightarrow \infty } A_E(t)=g_0/k_2\). Based on the same arguments utilized for analyzing the long-term behavior for \(C_E^2(t)\), it is easy to check that \(\lim _{t\rightarrow \infty } C_E^3(t) = 0\), so within \(I_3^n\), \(\lim _{t\rightarrow \infty } A_E(t)=0\). Summarizing, the two equilibria are (0, 0) and \((g_0/k_1,g_0/k_2)\).

Remark 1

Note that the previous reasoning is based on the fact that an explicit solution of the model is available (Logemann and Ryan 2014). Otherwise, we can obtain the same results using the classical theory of stability for linear systems. To apply, it is convenient first to express the system (2) in its matrix form:

$$\begin{aligned} \dot{\textbf{x}}(t)=\textbf{M} \textbf{x}(t) + \textbf{b}(t), \qquad \text {where } \textbf{x}(t)=\begin{pmatrix} A_P(t) \\ A_E(t) \end{pmatrix}, \,\, \,\, \textbf{M}= \begin{pmatrix} -k_1 &{} 0 \\ k_1 &{} -k_2 \end{pmatrix}, \quad \textbf{b}(t)= \begin{pmatrix} g(t) \\ 0 \end{pmatrix}, \end{aligned}$$
(18)

and g(t) is given in (3). As, according to expression (3), \(g(t)=g_0\) for \(t\in I_2^n\) (\(g(t)=0\) for \(t\in I_3^n\)), then \(\textbf{b}(t)=(g_0,0)^{\top }\) (\(\textbf{b}(t)=(0,0)^{\top }\)), here \(\top\) denotes the transpose. Note that in both cases, \(\textbf{b}(t)=\textbf{b}\) is constant and, then the equilibria, \(\textbf{x}_e\), are calculated by \(\textbf{x}_e= -\textbf{M}^{-1} \textbf{b}=( g_0/k_1, g_0/k_2)^{\top }\). This simple calculation gives the two same equilibria as before. Since the eigenvalues of matrix \(\textbf{M}\) are negative, \(\sigma (\textbf{M})=\{ -k_1<0,-k_2<0\}\), we can state that both are stable in a wide sense because the system has periodic jumps. Indeed, we remark that as long as impulses of allelochemical production, governed by g(t), subsist, the system never reaches an equilibrium: it continuously displays jumps and drops between the two equilibria: (0, 0) and \((g_0/k_1,g_0/k_2)\).

The PDF of the trivial equilibrium, (0, 0), is obviously given by \(f_{(0,0)}(x_1,x_2)=\delta (x_1,x_2)\), where \(\delta (x_1,x_2)\) denotes the two-dimensional Dirac delta distribution.

Now, when \(g(t)=g_0\) for all t, we have that \(\textbf{x}_e=( g_0/k_1, g_0/k_2)^{\top }\), which leads us to a more interesting PDF to study. In a deterministic setting of the model if \(g(t)=g_0\), then \(\textbf{x}(t)\) converges to \(\textbf{x}_e\) as \(t \rightarrow \infty\).

To obtain the PDF of equilibrium point \(\textbf{x}_e=(x_1^e,x_2^e)=(g_0/k_1, g_0/k_2)\), we will apply Th. 1 by defining the transformation \(\textbf{r}: \mathbb {R}^3 \longmapsto \mathbb {R}^3\):

$$\begin{aligned} \textbf{r}(\textbf{u})=\textbf{v}, \qquad \textbf{u}:=(k_1,k_2,g_0) \longmapsto \left( \frac{g_0}{k_1},\frac{g_0}{k_2},g_0\right) =(x_1^e,x_2^e,g_0):=\textbf{v}. \end{aligned}$$

This map is invertible, and its inverse is given by

$$\begin{aligned} \textbf{v}=(x_1^e,x_2^e,g_0) \rightarrow (k_1,k_2,g_0) = \left( \frac{g_0}{x_1^e},\frac{g_0}{x_2^e},g_0\right) . \end{aligned}$$

Then by applying Th. 1 and marginalizing w.r.t. \(g_0\), one obtains the following semi-explicit (in terms of an integral) of the PDF of the equilibrium point:

$$\begin{aligned} f_{x_1^e,x_2^e}(x_1,x_2)= \int _{-\infty }^{\infty } f_{k_1,k_2,g_0} \Big (\frac{g_0}{x_1},\frac{g_0}{x_2},g_0\Big ) \frac{g_0^2}{(x_1 x_2)^2}dg_0. \end{aligned}$$
(19)

Notice that now it is not possible to represent this PDF via an expectation because the equilibrium points are not independent variables.

3 Application to real data

This section is aimed at illustrating how the previous stochastic findings can be applied when real-world data are available. In this manner, the response is more realistic since it takes into account the inherent randomness of the allelochemical phenomena due to their own complexity as well as the uncertainty associated with data measurement errors. The data we will use in this section are the alkaloid contents in the leaching of thornapple seed from Lovett and Potts (1987). These data are measured over 7 days and give the quantities of the alkaloid contents in mg. The solution to \(A_E(t)\) without jumps proposed by An et al. (2003) was fitted to these data in 2003. Because the data points exhibited jumps, it seems reasonable to fit the model for \(A_E(t)\) with impulses governed by g(t) as described in (3).

For the sake of clarity and replicability, we here detail the steps followed in the calibration process and in the probabilistic analysis of the nontrivial equilibrium point. In the first step (Sect. 3.1), we shall perform a deterministic calibration of model parameters using the data from Lovett and Potts (1987) of the amount of alkaloid leached from thornapple seed coats which correspond to allelochemicals found in the environment of the plant. In the second step (Sect. 3.2), we will propose suitable parametric probability distribution for the randomized model parameters, namely, \(k_1\), \(k_2\), \(g_0\) and \(A_P^0\), and we shall apply a method of estimation of parameters for calibrating the parameters of distributions using the deterministic estimates obtained in the first step. In this manner, the PDFs of model parameters will be determined, and the 1-PDF of the solution of the randomized model is then calculated via the expressions given in (13) and (17). From these 1-PDFs, we shall detail the calculation of the expectation and the variance functions of the solution as well as how to build accurate confidence intervals. In the last step (Sect. 3.3), we shall show how to determine the PDF of the nontrivial equilibrium point of the randomized model.

3.1 Deterministic calibration

As we have the explicit solutions to model (2) (or equivalently to (18)), where g(t) is given in (3), we can calibrate \(A_P(t)\) and \(A_E(t)\) to real-world data in a deterministic way. Since the data correspond to allelochemical contents in the environment, first, we have to work with \(A_E(t)\) as expressed in (6) when fitting the data. To do that, we have applied the non-linear least squares (NLLS), implemented in Python’s scipy.optimize.curve_fit function to calibrate the models’ parameters. In this function, we set the initial values as a random seed and take the maximum number of evaluations 10,000 and the bounds (0, 100) (as all parameters must be positive by their definition, and we prefer to set an ample search space). We note that our results were very similar, with different starting points and more restrictive search bounds. In Table 1, we collect the estimates for parameters of model (2) using the NLLS algorithm.

Table 1 Estimates of parameters for model (2) using data retrieved from Lovett and Potts (1987) and non-linear least squares algorithm
Fig. 4
figure 4

Changes in alkaloid contents in leaching of thornapple seed (mg) for the estimates of model’s parameters given in Table 1

We can then use these optimal parameters to extrapolate the behavior of \(A_{P}(t)\), using its explicit expression given in (4)–(5). Note that the fit of \(A_E(t)\) to the data of alkaloid contents captures the jumps in the data. The extrapolated behavior of \(A_P(t)\) is also reasonable, with drops occurring in the same time intervals, as can be observed in Fig. 4.

3.2 Probabilistic calibration of model parameters

The semi-explicit expressions of the 1-PDFs for \(A_P(t)\) and \(A_E(t)\) obtained in (13) and (17), respectively, allow us to apply the random model of allelochemical contents in the plant and the environment to the real-world alkaloid data. To do so, we now consider that model’s parameters \(k_1\), \(k_2\), \(g_0\), and \(A_P^0\) are absolutely continuous random variables and we then assign them suitable PDFs. As mentioned earlier, the support of these PDFs must be contained in the positive real number set. We have, however, very little to no supplementary information on the shape of their distribution. We thus decide to model their distributions as uniform (a non-informative distribution):

$$\begin{aligned} k_1 \sim \textrm{U}(a_1,b_1),\quad k_2 \sim \textrm{U}(a_2,b_2), \quad g_0 \sim \textrm{U}(a_3,b_3), \quad A_P^0 \sim \textrm{U}(a_4,b_4), \end{aligned}$$
(20)

where \(0<a_i<b_i\) for \(i=1,\ldots ,4\). We opted for these non-informative uniform distributions in alignment with the Bayesian approach to selecting non-informative priors (Syversveen 1998). We will subsequently validate that this choice yields meaningful probability density functions (PDFs) based on the data we possess.

Now we will apply the method of moments (Casella and Berger 2007, ch. 7.2) to obtain consistent estimates for the parameters \(a_i,b_i\), \(i=1,\ldots ,4\), of the distribution (20) using the optimal parameters obtained in the deterministic calibration. To do so, let \(\Theta :=\{k_1,k_2,g_0,A_P^0\}\), then for each \(\theta \in \Theta\) we set \(\mathbb {E}[\theta ]=\widehat{\theta }\) and \(\mathbb {V}[\theta ]=(0.05 \times \widehat{\theta })^2\) (\(\mathbb {V}[\cdot ]\) stands for the variance) so that the expected value of the parameter is its deterministic calibration estimate (Table 1), and the standard deviation is \(5\%\) of that value. According to the method of moments, and taking into account that for a uniform random variable, say, \(X\sim \textrm{U}(a,b)\) its expectation and variance are, respectively, \(\mathbb {E}[X]=\frac{a+b}{2}\) and \(\mathbb {V}[X]=\frac{(b-a)^2}{12}\), it leads to four independent nonlinear algebraic systems with two equations that once solved give the following estimates:

$$\begin{aligned} \begin{aligned} \hat{a}_1^{0}=0.6151, \qquad \qquad \hat{b}_1^{0}=0.7317,\\ \hat{a}_2^{0}=0.6170,\qquad \qquad \hat{b}_2^{0}=0.7341,\\ \hat{a}_3^{0}=5.9668, \qquad \qquad \hat{b}_3^{0}=7.0982,\\ \hat{a}_4^{0}=2.0819, \qquad \qquad \hat{b}_4^{0}=2.4767. \end{aligned} \end{aligned}$$

We then set the error function, which we want to minimize,

$$\begin{aligned} \text {Min.}\,\, E(\varvec{\zeta })= \sum _{i=1}^N(\mu _{A_E}(t_i; \varvec{\zeta })-y_i)^2, \end{aligned}$$
(21)

where \(\varvec{\zeta }= (a_1,b_1, \ldots , a_4,b_4)\), \(t_i\) are the times where the data were measured, \(y_i\) are the alkaloid contents measured at times \(t=t_i\), \(i=1,\ldots ,N\) (notice that according to Fig. 4b, \(N=7\)) and

$$\begin{aligned} \mu _{A_E}(t)\equiv \mu _{A_E}(t; \varvec{\zeta })= \int _{-\infty }^{\infty } x f_{A_E(t)}(x)\textrm{d} x \end{aligned}$$
(22)

where \(f_{A_E(t)}(x)\) is the 1-PDF of \(A_E(t)\), defined in (17), which obviously depends on \(\varvec{\zeta }\) as highlighted in the notation for \(\mu _{A_E}(t; \varvec{\zeta })\equiv \mu _{A_E}(t)\).

Table 2 Optimal vector \(\hat{\varvec{\zeta }}= (\hat{a}_1,\hat{b}_1, \ldots , \hat{a}_4,\hat{b}_4)\) for the optimization program (21)

To solve the minimization program given in (21), we first set the initial vector of parameters to be \(\varvec{\zeta }= (\hat{a}_1^{0},\hat{b}_1^{0}, \ldots , \hat{a}_4^{0},\hat{b}_4^{0})\) and use the Mathematica function Nminimize() to find the optimal vector \(\hat{\varvec{\zeta }}\). The results of this calibration are displayed in Table 2.

Using the estimate \(\hat{\varvec{\zeta }}\) given in Table 2, the 1-PDF, \(f_{A_E(t)}(x)\) of \(A_E(t)\) is determined from expression (17). Hence, we can determine, by integration of \(f_{A_E(t)}(x)\), the expectation (see (22)) and the variance of \(A_E(t)\) at every time instant where alkaloid contents were measured

$$\begin{aligned} \sigma _{A_E}^2(t)\equiv \sigma _{A_E}^2(t; \varvec{\zeta })= \int _{-\infty }^{\infty } x^2 f_{A_E(t)}(x)\textrm{d} x - (\mu _{A_E}(t; \varvec{\zeta }))^2. \end{aligned}$$
(23)

Additionally, the calculation of the 1-PDF \(f_{A_E(t)}(x)\) permits constructing confidence intervals (CI) at a designated confidence level \(1-\alpha\), \(\alpha \in (0,1)\) at every time instant t,

$$\begin{aligned} 1-\alpha = \mathbb {P}\big [\{ \omega \in \Omega : A_E(t)(\omega ) \in [\mu _{A_E}(t)-\nu _t \sigma _{A_E}(t),\mu _{A_E}(t)+\nu _t \sigma _{A_E}(t) ]\}\big ] \\ =\int _{l(t)}^{u(t)} f_{A_E(t)}(x) \textrm{d}x, \end{aligned}$$

where \(l(t):=\mu _{A_E}(t)-\nu _t \sigma _{A_E}(t)\) and \(u(t):=\mu _{A_E}(t)+\nu _t \sigma _{A_E}(t)\). Here, \(\nu _t\) is the radius of the CI centered around the mean, and it varies with t. This allows us to dynamically construct the CI to attain the desired confidence level at every \(t=t_i\), \(i=1,\ldots ,7\), being these times the associated to each data (see Fig. 4b). We have taken \(\alpha =0.05\) to build \(95 \%\) CI and calculated the maximum radius, \(\max \{v_{t_{i}}: i=1,\ldots ,7 \}=1.91\) to guarantee the desired confidence level at all time instants. In Fig. 5a and b, we can see, from different perspectives, that the \(95 \%\) CIs capture nearly all data points. Analogously, one can compute the mean function, \(\mu _{A_P}(t)\), and \(95 \%\) CIs for \(A_P(t)\).

3.3 Probabilistic analysis of equilibrium

Once suitable distributions have been determined for model parameters, \(k_1\), \(k_2\) and \(g_0\) (see Sect. 3.2), the theoretical findings about the probabilistic stability analysis shown in Sect. 2.3 can now be applied to the data of thornapple seed alkaloid contents. Indeed, using expression (19), we can obtain the PDF of the equilibrium point \(\textbf{x}_e=(A_P^{e},A_E^{e})\). In Fig. 7, we show this PDF as well as the expectation of the equilibrium point: \(\mathbb {E}[\textbf{x}_e]=(\mathbb {E}[A_P^{e}],\mathbb {E}[A_E^{e}])=(\mathbb {E}[\frac{g_0}{k_1}], \mathbb {E}[\frac{g_0}{k_2}])^\top =( 9.80612, 9.85263)^\top .\) It is important to note that here, for illustrative purposes, we have assumed that the plant receives constant stimuli since, if g(t) is an infinite square wave, the solutions will keep oscillating and not converge to a specific value as indicated in Sect. 2.3. As shown in Fig. 7, the PDF is unimodal, with density centered near the expected value of the equilibrium point. The oval shape of the projection of the PDF onto the plane indicates a correlation between the two components, \(A_P^{e}\) and \(A_E^{e}\), of the equilibrium point, which makes sense since they form part of a system and both share the random variable \(g_0\) in their expression.

In Fig. 6, we illustrate the meaning of equilibrium. In Figure 6b, we show the expectation function of the second component of the solution \(\mu _{A_E}(t)\) (which can be computed by (22)), the expectation of the second component of the equilibrium: \(\mathbb {E}[A_E^{e}]=9.85263\) as well as their respective \(95\%\) CIs. For the expectation, we can graphically see that \(\lim _{t\rightarrow \infty } \mu _{A_E}(t)=9.85263\) as expected. We also can observe convergence for the CIs. Similar comments apply for the expectation and \(95\%\) CIs of the first component of the solution, \(A_P(t)\).

Remark 2

As we have randomized model (2) from its deterministic formulation proposed in Martins (2006), it is now interesting to briefly highlight that both approaches give, in general, different equilibrium points. This comparison is made in average, i.e., comparing the expectation of the random equilibrium point that has been previously calculated with the one deterministically obtained, namely \(\widehat{\textbf{x}}_e=\left( \frac{\widehat{g_0}}{\widehat{k_1}}, \frac{\widehat{g_0}}{\widehat{k_2}}\right) ^\top =( 9. 71768, 9.6888)^\top \ne (9.80612, 9.85263)^{\top }=\Big (\mathbb {E}\Big [\frac{g_0}{k_1}\Big ], \mathbb {E}\Big [\frac{g_0}{k_2}\Big ]\Big )^\top =\mathbb {E}[\textbf{x}_e]\).

Fig. 5
figure 5

Evolution of the 1-PDF of \(A_E(t)\) (blue curves); data from days 1 to 7 (blue points), the expected value (red curve), and \(95\%\) confidence interval (dotted curves). Notice that we have not plotted the PDF at \(t=0\) since \(A_E(0)=0\) almost surely, which corresponds to a Dirac delta function

Fig. 6
figure 6

Illustrating the stability of the equilibrium points by the expectation and \(95\%\) confidence intervals (CIs) of the solution stochastic process \((A_P(t),A_E(t))\) and the equilibrium random variable \((A_P^{e},A_E^{e})\) to the randomized system (2) assuming that model parameters \(k_1\), \(k_2\) and \(g_0\) have the distributions determined in Sect. 2.3

Fig. 7
figure 7

PDF of the equilibrium point, \(\big (\mathbb {E}\big [\frac{g_0}{k_1}\big ],\mathbb {E}\big [\frac{g_0}{k_2}\big ]\big )\), and its expectation when \(g(t)=g_0\). It has been obtained by expression (19) assuming that model parameters \(k_1\), \(k_2\) and \(g_0\) have the distributions determined in Sect. 2.3

4 Going beyond: probabilistic analysis when no explicit solution is available

The success of obtaining the 1-PDFs, \(f_{A_P(t)}(x)\) and \(f_{A_E(t)}(x)\), of the solution of the randomized model (2) by applying the RVT method has strongly relied on knowing explicit expressions for \(A_P(t)\) and \(A_E(t))\). However, as is well known, obtaining explicit expressions for the solution to ODE/RDE systems is not generally possible. For example, the technique used in Martins (2006) is not reproducible in the case that the source term g(t) depends on t, except possibly in very simple cases (note that in the case studied in Martins (2006), g(t) is a piecewise constant function). In this section, we present an alternative approach for dealing with the computation of the 1-PDF of the solution of models formulated via general systems of RDEs, and, in particular, it can be applied to the randomized model (2) with g(t) being a stochastic process. The approach is based on the so-called Continuity, or Liouville partial differential equation (PDE) (Soong 1973; Santambrogio 2015) associated with the solution \(\textbf{X}(t,\omega )\equiv \textbf{X}(t)\) a random initial value problem (IVP), say,

$$\begin{aligned} \left\{ \begin{array}{rl} \displaystyle \frac{\textrm{d}\textbf{X}(t,\omega )}{\textrm{d}t} &{}=\displaystyle \textbf{v}(\textbf{X}(t,\omega ),\textbf{A}(\omega ),t),\quad t>t_0, \\ \textbf{X}(t_0,\omega ) &{}=\textbf{X}_0(\omega ). \end{array}\right. \end{aligned}$$
(24)

Here, \(t_0>0\) denotes the initial time of the system, \(\textbf{X}_0 \equiv \textbf{X}_0(\omega )\) and \(\textbf{A} \equiv \textbf{A}(\omega ):=(A_1(\omega ),\ldots ,A_m(\omega ))\) are absolutely continuous random vectors, with a joint PDF \(f_{\textbf{X}_0,\textbf{A}}(\textbf{x}_0,\textbf{a})\), defined in a complete probability space \((\Omega ,\mathcal {F},\mathbb {P})\), \(\omega \in \Omega\), and \(\textbf{v}\) is known as the (vector) field function. Notice that model (2) is a particular case of (24) taking

$$\begin{aligned} \begin{array}{c} \textbf{X}(t)= (A_P(t),A_E(t))^{\top },\,\, \textbf{X}_0= (A_P^0,0)^{\top },\,\, \textbf{A}= (A_1,A_2,A_3):= (k_1,k_2,g_0),\,\, \\ \\ \textbf{v}(\textbf{X}(t,\omega ),\textbf{A}(\omega ),t):= (-k_1 A_P(t) +g(t), k_1 A_P(t)-k_2 A_E(t))^{\top }, \end{array} \end{aligned}$$
(25)

where g(t) is defined in (3). Then, according to the Liouville-Gibbs theorem (Soong 1973, ch. 6), the joint 1-PDF of \(\textbf{X}(t)\) and \(\textbf{A}\), denoted by \(f_{\textbf{X}(t),\textbf{A}}(\textbf{x},\textbf{a})\equiv f(\textbf{x},\textbf{a},t)\), verifies the deterministic initial and boundary value problem given by the following PDE:

$$\begin{aligned} \left\{ \begin{array}{ll} \partial _t f(\textbf{x},\textbf{a},t) + \nabla _{\textbf{x}}\cdot [\textbf{v}\,f ](\textbf{x},\textbf{a},t)=0,\quad &{}(\textbf{x},\textbf{a})\in \mathcal {D}\times \mathbb {R}^m,\quad t>t_0,\\ \\ f(\textbf{x},\textbf{a},t_0)=f_{\textbf{X}_0,\textbf{A}}(\textbf{x},\textbf{a}),\quad &{}(\textbf{x},\textbf{a})\in \overline{\mathcal {D}}\times \mathbb {R}^m,\\ \\ \nabla _{\textbf{x}} f(\textbf{x},\textbf{a},t)\cdot \textbf{n}(\textbf{x})=0,\quad &{}(\textbf{x},\textbf{a})\in \partial \mathcal {D}\times \mathbb {R}^m,\quad t\ge t_0, \end{array}\right. \end{aligned}$$
(26)

where \(\partial \mathcal {D}\) denotes the boundary of \(\mathcal {D}\), which is a set where all the probability of the system is located; that is, \(\int _{\mathcal {D}\times \mathbb {R}^m}f(\textbf{x},\textbf{a},t)\textrm{d}\textbf{x}\textrm{d}\textbf{a}=1\) for all \(t\ge t_0\). \(\nabla _{\textbf{x}}\) denotes the gradient, and thus, \(\nabla _{\textbf{x}}\cdot\) is the divergence operator. Finally, \(\textbf{n}\) denotes the normal vector to \(\partial \mathcal {D}\).

This result permits approximating the 1-PDF of the solution of a random IVP like (2) by solving the deterministic boundary value problem (26) using advanced numerical methods for PDEs and, afterward, by marginalizing the approximate joint PDF \(f(\textbf{x},\textbf{a},t)\) with respect to the random vector parameters \(\textbf{A}\):

$$\begin{aligned} f(\textbf{x},t)=\int _{\mathbb {R}^m} f(\textbf{x},\textbf{a},t) \textrm{d}\textbf{a} = \int _{\mathbb {R}^m} f(\textbf{x},t\,|\,\textbf{a})f_{\textbf{A}}(\textbf{a}) \textrm{d}\textbf{a}=\mathbb {E}_{\textbf{A}}[f(\textbf{x},t\,|\,\textbf{A})], \end{aligned}$$

where in the second equality, we have applied the law of total probability. We here point out that this approach has been recently applied to different classes of RDEs (Bevia et al. 2023a, 2023b, 2023c).

As we shall see below, we will first calculate approximations of the 1-PDFs, \(f_{A_P(t)}(x)\) and \(f_{A_E(t)}(x)\) for the solution \((A_P(t),A_E(t))\) of the randomized model (2) in the case that the source term g(t) is given by the random square wave given in (3). To illustrate the usefulness of the Liouville equation, as a second example, we shall consider the case where g(t) is defined by a parametric time-dependent stochastic process for which an explicit solution to the random IVP (2) is not available.

In the particular case of the random IVP defined in (2), the Liouville equation, after computing the gradient and considering a fixed parameter realization \((k_1,k_2,g_0)\), becomes

$$\begin{aligned} \partial _t f(x_1,x_2,t) + \underbrace{\left( [-k_1 x_1 + g(t),\,k_1 x_1 - k_2 x_2]\cdot \begin{bmatrix} \partial _{x_1} f(x_1,x_2,t)\\ \partial _{x_2} f(x_1,x_2,t) \end{bmatrix}\right) }_{\textbf{v}(\textbf{x},t)\cdot \nabla _{\textbf{x}}f(\textbf{x},t)} = \underbrace{(k_1+k_2)}_{-\nabla _{\textbf{x}}\cdot \textbf{v}(\textbf{x},t)}f(x_1,x_2,t), \end{aligned}$$
(27)

where g(t) is the function defined at (3) and \(x_1 = A_P,\,x_2=A_E\). Now, using the optimized values from Table 2, we can compute the evolution of the joint PDF of \((A_P(t), A_E(t))\) using the specialized software developed by one of the authors (Bevia 2023).

Figure 8 shows some statistical information from the simulation output: the mean (solid red curves) and \(95\%\) CI (dashed black curves) computed using the algorithm described in Bevia et al. (2023b, Sect. 3.3). Observe that the mean and \(95\%\) CI for \(A_E(t)\) are consistent with the results shown in Fig. 5b (see Table 3 for the computational details of the simulation). Furthermore, both plots in Fig. 8 resemble the curves obtained using the exact, closed-form deterministic solution shown in Fig. 3. Both facts support the numerical results obtained by the Liouville equation.

Fig. 8
figure 8

Points: Data. Solid curve: Mean. Dashed curves: \(95\%\) confidence intervals (CIs). The mean and CIs have determined after solving the Liouville equation associated with the randomized model (2) taking as PDFs for model parameters \(k_1\), \(k_2\), \(g_0\) and \(A_P^0\) the Uniform distributions given in (20) with parameters collected in Table 2

We finish this section by illustrating the usefulness of the approach based on the Liouville-Gibbs PDE when no explicit solution is available. Indeed, regarding the complexity of computing the solution, we mentioned that if any model parameter were not constant, the closed-form solution would have been much more complicated to find or even impossible. In particular, this happens for slightly more complicated expressions of g(t). With this aim, let us consider the following modified, non-constant, forcing term:

$$\begin{aligned} g(t)= \left\{ \begin{array}{lll} 0, &{} t\in I_1,\\ \\ g_0\exp {\left\{ -\left( \frac{t-nT}{\delta }\right) ^2\right\} }, &{} t\in I_2^n, \\ \\ 0, &{} t\in I_3^n, \end{array} \right. \end{aligned}$$
(28)

which corresponds to Gaussian-decaying allelochemical production. Because of the Liouville equation computational approach, we can compute the evolution of the total uncertainty in the system using similar computational resources as with the previous model, despite being considerably more complex. Figure 9 shows the solution’s mean and \(95\%\) CIs for this example. As was expected, when the plant chemical concentration increases, it dampens its growth before suddenly stopping, and the environmental concentration \(A_E\) decays faster than in the constant chemical production case (compare with Fig. 3). Also, note that the confidence interval is much larger than in previous examples, but this is because the environmental allelochemical concentration remains very low throughout the simulation. Figure 10 shows the mean and CIs of \(A_E(t)\) together with its marginal PDF at several time instants as obtained by solving the Liouville equation.

We remark that all the statistical information analyzed in the examples of the current section, and shown in Figs. 89 and 10, are directly computed using the joint PDF of \((A_P(t),\,A_E(t))\), which is obtained by solving the Liouville equation numerically with the corresponding parameters for the vector field’s random parameters. See Table 3 for the computational details of the simulation.

Fig. 9
figure 9

Solid curve: Mean. Dashed curves: \(95\%\) confidence intervals (CIs). The mean and CIs have been determined after solving the Liouville equation associated with the randomized model (2) taking as PDFs for model parameters the same as in Fig. 3 and being g(t) the modified forcing term given in (28)

Fig. 10
figure 10

In light blue: \(A_E(t)\)-marginal PDF slices at several time instants. The red and black curves correspond to the same mean and \(95\%\) confidence intervals as shown in the bottom plot of Fig. 9

Table 3 Simulation computational details

5 Conclusions

In this paper, we have revisited a deterministic model for studying a plant’s allelochemical production and subsequent dissipation in the environment. The model includes an external source, described by means of a piecewise constant function (square wave) that describes the synthesis of allelochemicals during the growth and development of the plant. We first calculated a closed-form solution of the model. Later, to account for the inherent uncertainties present in the data and in the model itself, we randomized the model by assuming that model parameters (initial condition, coefficients, and the source term) are random variables with arbitrary probability density functions. We have then performed a full probabilistic analysis of the stochastic model by obtaining the first probability density function of the solution under very general hypotheses. From this key information, we have obtained relevant statistical information for the solution, such as the expectation and confidence intervals. Furthermore, we have presented a probabilistic analysis of the stability that includes the computation of the density of the non-trivial equilibrium point, which is a random vector. This provides a more comprehensive depiction of the model since, as anticipated, the expected values of the randomized model converge toward the expected values of these equilibrium points.

This study has strongly relied on the application of the Random Variable Transformation technique, whose success, in turn, depends on the availability of an explicit solution of the model. Despite the cumbersome expression of the explicit solution, it has been possible to calculate it because of the simple form of the source term. Motivated by this fact, we have used an alternative approach based on the so-called Liouville or Continuity equation. This mathematical tool enables us to approximate the probability density function of the solution in the foregoing scenario, where both approaches show full agreement, but also when the source term is a time-dependent stochastic process, as shown by means of an illustrative example.

Remarkably, our theoretical findings have been applied using real-world data by combining them with Inverse Uncertainty Quantification techniques to assign suitable probability distributions to model parameters so that the response of the random model captures the uncertainties of the natural phenomenon under analysis. This is particularly interesting from an applied standpoint since it may be useful in applications of Mathematical Ecology.