Skip to content

Commit 5e87b5b

Browse files
committed
updates after comments
1 parent bbf6578 commit 5e87b5b

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

docs/src/model_simulation/finite_state_projection_simulation.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
The following code sets up an environment for running the code on this page.
66
```julia
77
using Pkg
8-
Pkg.activate(".")
8+
Pkg.activate(; temp = true) # Creates a temporary environment, which is deleted when the Julia session ends.
99
Pkg.add("Catalyst")
1010
Pkg.add("FiniteStateProjection")
1111
Pkg.add("JumpProcesses")
@@ -60,10 +60,10 @@ One can study the dynamics of stochastic chemical kinetics models by simulating
6060
[*The chemical master equation*](https://en.wikipedia.org/wiki/Master_equation) (CME) describes the time development of this probability distribution[^1], and is given by a (possibly infinite) coupled system of ODEs (with one ODE for each possible chemical state, i.e. number configuration, of the system). For a simple [birth-death model](@ref basic_CRN_library_bd) ($\varnothing \xrightleftharpoons[d]{p} X$) the CME looks like
6161
```math
6262
\begin{aligned}
63-
\frac{dP(X=0)}{dt} &= d \cdot P(X=1) - p \cdot P(X=0) \\
64-
\frac{dP(X=1)}{dt} &= p \cdot P(X=0) + d \cdot 2P(X=2) - (p + d) P(X=1) \\
63+
\frac{dP(X(t)=0)}{dt} &= d \cdot P(X(t)=1) - p \cdot P(X(t)=0) \\
64+
\frac{dP(X(t)=1)}{dt} &= p \cdot P(X(t)=0) + d \cdot 2P(X(t)=2) - (p + d) P(X(t)=1) \\
6565
&\vdots\\
66-
\frac{dP(X=i)}{dt} &= p \cdot P(X=i-1) + d \cdot (i + 1)P(X=i+1) - (p + D \cdot i) P(X=i) \\
66+
\frac{dP(X(t)=i)}{dt} &= p \cdot P(X(t)=i-1) + d \cdot (i + 1)P(X(t)=i+1) - (p + D \cdot i) P(X(t)=i) \\
6767
&\vdots\\
6868
\end{aligned}
6969
```
@@ -148,15 +148,14 @@ using FiniteStateProjection # hide
148148
fsp_sys = FSPSystem(rs, [:X, :X₂])
149149
nothing # hide
150150
```
151-
Finally, we can simulate the model just like in the 1-dimensional case. As we are simulating an ODE with $25⋅25 = 625$ states, we need to make some considerations regarding performance. In this case, we will simply specify the `Rodas5P()` ODE solver (more extensive advice on performance can be found [here](@ref ode_simulation_performance)).
151+
Finally, we can simulate the model just like in the 1-dimensional case. As we are simulating an ODE with $25⋅25 = 625$ states, we need to make some considerations regarding performance. In this case, we will simply specify the `Rodas5P()` ODE solver (more extensive advice on performance can be found [here](@ref ode_simulation_performance)). Here, we perform a simulation with a long time span ($t = 100.0$), aiming to find the system's steady state distribution. Next, we plot it using the `heatmap` function.
152152
```@example state_projection_multi_species
153153
using Plots # hide
154154
using OrdinaryDiffEqRosenbrock
155155
oprob = ODEProblem(fsp_sys, u0, 100.0, ps)
156156
osol = solve(oprob, Rodas5P())
157157
heatmap(0:24, 0:24, osol[end]; xguide = "X₂", yguide = "X")
158158
```
159-
Here we perform a simulation with a long time span ($t = 100.0$) aiming to find the system's steady state distribution. Next, we plot it using the `heatmap` function.
160159

161160
!!! warning
162161
The `heatmap` function "flips" the plot contrary to what many would consider intuitive. I.e. here the x-axis corresponds to the second species ($X₂$) and the y-axis to the first species ($X$).

0 commit comments

Comments
 (0)