## File: ExamplesImmigrationDeath.htd

package info (click to toggle)
cain 1.10+dfsg-2
• area: main
• in suites: stretch
• size: 29,856 kB
• sloc: cpp: 49,612; python: 14,988; xml: 11,654; ansic: 3,644; makefile: 133; sh: 2
 file content (114 lines) | stat: -rw-r--r-- 4,466 bytes parent folder | download | duplicates (4)
 `123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114` `````` Immigration-Death

Immigration-Death

Transient Dynamics

Consider a system with a single species X and two reactions: immigration and death. The immigration reaction is 0→X with a unit propensity factor. The death reaction is X→0 and has propensity factor 0.1. Since both reactions use mass-action kinetic laws, the propensities are 1 and 0.1 X, respectively. Open the file examples/cain/ImmigrationDeath.xml. Select the "ImmigrationDeath" model and the "Direct" method and then generate 10 trajectories. Below is a plot of these trajectories.

The analogous deterministic process is X' = 1 - 0.1X. We numerically solve this equation by selecting "ODE" in the list of methods and generating a single trajectory. The solution is shown below.

Note that both the stochastic model and the deterministic model have a steady state behavior. For the latter the solution approaches a stationary point as time increases. We can determine the steady state solution algebraically by setting X' to zero and solving for X, which yields X = 10.

The stochastic system does not have the same kind of steady state solution as the continuous model. At steady state, there is a probability distribution for the population of X. To determine this distribution we will record the state in a time averaged histogram. First select "ImmigrationDeath10" from the model list, for which the initial population has been set to 10. Then select "SteadyState" from the list of methods. From the simulation parameters in the method editor you can see that the system is allowed to equilibrate for 100 seconds and then the state is recorded for 10,000 seconds. Generate 10 trajectories and then plot the resulting empirical probability distribution using the histograms tab of the plot configuration window. The result is shown below.

From the plot we can see that the distribution is close to a normal distribution and is centered near X = 10. We can obtain statistics on the distribution by clicking the table button   and selecting the "Mean and standard deviation" option. From this we see that the mean is 9.96 and that the standard deviation is 3.20.

Next one might consider the accuracy of the empirical probability distribution for the steady state solution. Since the solution is recorded in multiple histograms, we can estimate the error in the combined result. Click the table button   and select "Estimated error." The result depends upon the stream of random number used, I got an estimated error of 0.0071. This indicates that the histogram is fairly accurate and captures the typical behavior of the system. We could obtain a more accurate answer by generating more trajectories.

Inhomogeneous Model

Now we will consider an inhomogeneous model, meaning that the reaction propensities have explicit time dependence. In the models list, clone ImmigrationDeath10 and name the result Periodic. In the reactions editor, uncheck the MA field for the Immigration reaction. Then change the propensity function to "1+sin(2*pi*t/20)", a function with a period of 20. In the methods list, clone Direct and name the result Inhom. Then select the "Time Inhomogenous" time dependence category in the method editor. Next change the recording time to 200 and set the number of frames to 401. Generate a trajectory by clicking the compile-and-launch button   in the launcher panel. A plot of the species population is shown below. We can clearly see the effect of the periodic variation in the rate of the immigration reaction, as well as the stochastic noise.

``````