Skip to content

Commit 7547841

Browse files
committed
save progress
1 parent 96ecf22 commit 7547841

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

docs/src/steady_state_functionality/examples/nullcline_plotting.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
# [Plotting Nullclines and Steady States in Phase Space](@id nullcline_plotting)
2+
In this tutorial we will show how to extract a system's steady states and [nullclines](https://en.wikipedia.org/wiki/Nullcline), and how to plot these in [phase space](https://en.wikipedia.org/wiki/Phase_space). Generally, while nullclines are not directly needed for much analysis, plotting these can give some understanding of a systems steady state and stability properties. While nullclines can be "brute forced", we will here use [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl) to rack their path exactly.
23

3-
Introduction text.
4+
For a ordinary differential equation
5+
```math
6+
\begin{aligned}
7+
\frac{dx_1}{dt} &= f_1(x_1, x_2, ..., x_3) \\
8+
\frac{dx_2}{dt} &= f_2(x_1, x_2, ..., x_3) \\
9+
&\vdots\\
10+
\frac{dx_n}{dt} &= f_3(x_1, x_2, ..., x_3) \\
11+
\end{aligned}
12+
```
13+
The nullclines are the curves
14+
```math
15+
\begin{aligned}
16+
0 &= f_1(x_1, x_2, ..., x_3) \\
17+
0 &= f_2(x_1, x_2, ..., x_3) \\
18+
&\vdots\\
19+
0 &= f_3(x_1, x_2, ..., x_3) \\
20+
\end{aligned}
21+
```
22+
where the $i$'th nullclines is the curve along which $\frac{dx_i}{dt} = 0$. Generally, nullclines are primarily computed for models with 2 variable (as only here can they be easily plotted).
423

24+
## [Computing nucclines and steady states for a bistable switch](@id nullcline_plotting_computation)
525
For our example we will use a simple bistable switch model, consisting of two species ($X$ and $Y$) which mutually inhibits each other through repressive hill functions. We will create our model [programmatically](@ref programmatic_CRN_construction).
626
```@example nullcline_plotting
727
using Catalyst
@@ -17,13 +37,27 @@ rxs = [
1737
@named bs_switch = ReactionSystem(rxs, t)
1838
bs_switch = complete(bs_switch)
1939
```
40+
2041
Next, we compute the steady states [using homotopy continuation](@ref homotopy_continuation).
2142
```@example nullcline_plotting
2243
import HomotopyContinuation
2344
ps = [v => 1.0, K => 0.6, n => 4.0]
2445
sss = hc_steady_states(bs_switch, ps; show_progress = false)
2546
```
26-
Next we wish to compute the nullclines. We will first extract the equations corresponding to these from our model. Next, we will compute them using [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl). To generate our equations, we first convert our model to a `NonlinearSystem`. For each nullcline equation, we also have to replace the corresponding variable with a parameter (which can be varied to compute the full nullcline curve).
47+
48+
Finally, we will compute the nullclines. We will first extract our models steady state equations (which we do by creating a `NonlinearSystem`).
49+
```@example nullcline_plotting
50+
nlsys = convert(NonlinearSystem, bs_switch)
51+
eqs = equations(nlsys)
52+
```
53+
Here, each equation is an expression of two variables. To plot the corr
54+
55+
@parameters Xval Yval
56+
nc_eq_X = substitute(equations(nlsys)[1], Dict([X => Xval]))
57+
nc_eq_Y = substitute(equations(nlsys)[2], Dict([Y => Yval]))
58+
```
59+
60+
We will first extract the equations corresponding to these from our model. Next, we will compute them using [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl). To generate our equations, we first convert our model to a `NonlinearSystem`. For each nullcline equation, we also have to replace the corresponding variable with a parameter (which can be varied to compute the full nullcline curve).
2761
```@example nullcline_plotting
2862
@parameters Xval Yval
2963
nlsys = convert(NonlinearSystem, bs_switch)

0 commit comments

Comments
 (0)