Skip to content

Commit f506011

Browse files
committed
doc fix
1 parent 12d8af1 commit f506011

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

docs/pages.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pages = Any[
4545
"steady_state_functionality/bifurcation_diagrams.md",
4646
"steady_state_functionality/dynamical_systems.md",
4747
"Examples" => Any[
48-
"steady_state_functionality/examples/bifurcationkit_bifpoint_continuation.md"
48+
"steady_state_functionality/examples/bifurcationkit_codim2.md"
4949
]
5050
],
5151
"Inverse problems" => Any[

docs/src/steady_state_functionality/examples/bifurcationkit_bifpoint_continuation.md renamed to docs/src/steady_state_functionality/examples/bifurcationkit_codim2.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# # [Tracking Bifurcation Point w.r.t. Secondary Parameters using BifurcationKit](@id bifurcationkit_bifpoint_continuation)
1+
# [Tracking Bifurcation Point w.r.t. Secondary Parameters using BifurcationKit.jl](@id bifurcationkit_codim2)
22
Previously, we have shown how to [compute bifurcation diagrams](@ref bifurcation_diagrams) using [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl). In this example, we will show how, after computing the initial diagram, we can track how the position of a bifurcation point moves as a secondary parameter is changed (so-called codimensional 2 bifurcation analysis). More information on how to track bifurcation points along secondary parameters can be found in the [BifurcationKit documentation](https://bifurcationkit.github.io/BifurcationKitDocs.jl/stable/tutorials/ode/tutorialCO/#CO-oxidation-(codim-2)).
33

4-
## [Computing the bifurcation diagram for the Repressilator](@id bifurcationkit_bifpoint_continuation_bifdia)
4+
## [Computing the bifurcation diagram for the Repressilator](@id bifurcationkit_codim2_bifdia)
55
We will first compute the bifurcation diagram, using the same approach as in the [corresponding tutorial](@ref bifurcation_diagrams). For this example, we will use the oscillating [Repressilator](@ref basic_CRN_library_repressilator) model.
6-
```@example bifurcationkit_bifpoint_continuation
6+
```@example bifurcationkit_codim2
77
using Catalyst
88
repressilator = @reaction_network begin
99
    hillr(Z,v,K,n), ∅ --> X
@@ -13,7 +13,7 @@ repressilator = @reaction_network begin
1313
end
1414
```
1515
Next, we create a `BifurcationProblem` for our model. We will compute the bifurcation diagram with respect to the parameter $v$, and plot the species $X$ in the diagram.
16-
```@example bifurcationkit_bifpoint_continuation
16+
```@example bifurcationkit_codim2
1717
using BifurcationKit
1818
bif_par = :v
1919
u_guess = [:X => 20.0, :Y => 15.0, :Z => 15.0]
@@ -23,20 +23,20 @@ bprob = BifurcationProblem(repressilator, u_guess, p_start, bif_par; plot_var)
2323
nothing # hide
2424
```
2525
We compute the bifurcation diagram using the `bifurcationdiagram` function. We will compute it across the interval $v \in (0,20)$.
26-
```@example bifurcationkit_bifpoint_continuation
26+
```@example bifurcationkit_codim2
2727
v_span = (0.0, 20.0)
2828
opts_br = ContinuationPar(p_min = v_span[1], p_max = v_span[2])
2929
bifdia = bifurcationdiagram(bprob, PALC(), 3, opts_br; bothside = true)
3030
nothing # hide
3131
```
3232
Finally, we plot the bifurcation diagram.
33-
```@example bifurcationkit_bifpoint_continuation
33+
```@example bifurcationkit_codim2
3434
using Plots
3535
plot(bifdia; xguide = bif_par, yguide = plot_var, branchlabel = "Continuation of steady state w.r.t. v",
3636
linewidthstable = 6, linewidthunstable = 3, markersize = 5)
3737
```
3838
We note that for small values of $v$ the system's single steady state is stable (where the line is thicker). After a [Hopf](https://en.wikipedia.org/wiki/Hopf_bifurcation) bifurcation (the red point), the state turns unstable (where the line is thinner). For chemical reaction networks (which mostly are well-behaved) a single unstable steady state typically corresponds to an oscillation. We can confirm that the system oscillates in the unstable region (while it reaches a stable steady state in the stable region) using simulations:
39-
```@example bifurcationkit_bifpoint_continuation
39+
```@example bifurcationkit_codim2
4040
using OrdinaryDiffEqDefault
4141
p_nosc = [:v => 5.0, :K => 15.0, :n => 3, :d => 0.2]
4242
p_osc = [:v => 15.0, :K => 15.0, :n => 3, :d => 0.2]
@@ -47,22 +47,22 @@ sol_osc = OrdinaryDiffEqDefault.solve(prob_osc)
4747
plot(plot(sol_nosc; title = "v = 5"), plot(sol_osc; title = "v = 15"), size = (1000,400), lw = 4)
4848
```
4949

50-
## [Tracking the bifurcation point w.r.t. a second parameter](@id bifurcationkit_bifpoint_continuation_codim2_2ndpar_cont)
50+
## [Tracking the bifurcation point w.r.t. a second parameter](@id bifurcationkit_codim2_2ndpar_cont)
5151
Next, we will investigate how the Hopf bifurcation point moves (in $v$-$X$ space) as a second parameter ($K$) is changed. To do this we will use BifurcationKit.jl's [`continuation` function](https://bifurcationkit.github.io/BifurcationKitDocs.jl/dev/library/#BifurcationKit.continuation) (the [`bifurcationdiagram` function](https://bifurcationkit.github.io/BifurcationKitDocs.jl/dev/library/#BifurcationKit.bifurcationdiagram), which we previously have used, works by calling `continuation` recursively). We will call it on the Hopf bifurcation point. First, we will designate the parameter we wish to change, as well as which interval to change it. For this, we compute the parameter index (`K_idx`) that BifurcationKit will see (a smoother interface for this will hopefully be added in the future). We also create a new `ContinuationPar`, to which we add our $K$ interval.
52-
```@example bifurcationkit_bifpoint_continuation
52+
```@example bifurcationkit_codim2
5353
K_span = (0.01, 27.0)
5454
opts_br_2 = ContinuationPar(p_min = K_span[1], p_max = K_span[2])
5555
K_idx = findfirst(isequal(repressilator.K), parameters(complete(convert(NonlinearSystem, repressilator))))
5656
nothing # hide
5757
```
5858
Now we can compute the continuation of the Hopf bifurcation. First we must extract a branch from our bifurcation diagram (using [`get_branch`](https://bifurcationkit.github.io/BifurcationKitDocs.jl/stable/library/#BifurcationKit.get_branch)), as `continuation` cannot work on bifurcation diagrams directly (our bifurcation diagram consists of a single branch, which we here extract). Next, we can call `continuation` on it, designating that we wish to perform continuation from the second point on the branch (which corresponds to the Hopf bifurcation, the first point is one of the branch's two endpoints).
59-
```@example bifurcationkit_bifpoint_continuation
59+
```@example bifurcationkit_codim2
6060
branch = get_branch(bifdia, ()).γ
6161
cont_hopf = continuation(branch, 2, (@optic _[K_idx]), opts_br_2; start_with_eigen = true, bothside = true)
6262
nothing # hide
6363
```
6464
We can now plot how the position of the bifurcation point changes with $K$. Here, we use `vars = (:p1, :x)` to designate that we wish to plot (across the continuation branch) the plotting variable ($X$, which we designated when we created our `BifurcationProblem`) against the first parameter ($v$).
65-
```@example bifurcationkit_bifpoint_continuation
65+
```@example bifurcationkit_codim2
6666
plot(bifdia; branchlabel = "Continuation of steady state w.r.t. v, (K = 15)", linewidthstable = 6,
6767
linewidthunstable = 3, markersize = 5)
6868
plot!(cont_hopf; vars = (:p1, :x), xlimit = v_span, xguide = bif_par, yguide = plot_var,
@@ -71,7 +71,7 @@ plot!(cont_hopf; vars = (:p1, :x), xlimit = v_span, xguide = bif_par, yguide = p
7171
In this case we cannot see directly which part of the $K$ continuation branch corresponds to low values, however, for low $K$ the Hopf bifurcation occurs for much lower values of $v$ (and corresponds to lower steady state values of $X$). We can check this by e.g. re-computing the Hopf branch for `K_span = (0.01, 20.0)` and see that the rightmost part of the branch is shortened.
7272

7373
We can confirm that the new line corresponds to the Hopf Bifurcation point by recomputing the initial bifurcation diagram, but for a lower $K$ value.
74-
```@example bifurcationkit_bifpoint_continuation
74+
```@example bifurcationkit_codim2
7575
p_start_2 = [:v => 10.0, :K => 10.0, :n => 3, :d => 0.2]
7676
bprob_2 = BifurcationProblem(repressilator, u_guess, p_start_2, bif_par; plot_var)
7777
bifdia_2 = bifurcationdiagram(bprob_2, PALC(), 3, opts_br; bothside = true)
@@ -81,14 +81,14 @@ plot!(bifdia_2; xguide = bif_par, yguide = plot_var, branchlabel = "Continuation
8181
Here we see that the Hopf bifurcation point of the new diagram also lies on the Hopf continuation line.
8282

8383
Finally, we have already noted that the Hopf bifurcation splits parameter space into one part where the system oscillates and one where it doesn't. Previously we plotted the Hopf continuation in $v$-$X$ space, however, it is also possible to plot it in $v$-$K$ space using the `vars = (:p1, :p2)` argument:
84-
```@example bifurcationkit_bifpoint_continuation
84+
```@example bifurcationkit_codim2
8585
xlimit = extrema(getfield.(cont_hopf.branch, :p1))
8686
ylimit = extrema(getfield.(cont_hopf.branch, :p2))
8787
plot(cont_hopf; vars = (:p1, :p2), xlimit, ylimit, branchlabel = "Hopf bifurcation",
8888
xguide = "v", yguide = "K", lw = 6)
8989
```
9090
Next, we colour parameter space according to whether the steady state is stable (blue) or unstable (red). We also mark two sample values (one in each region).
91-
```@example bifurcationkit_bifpoint_continuation
91+
```@example bifurcationkit_codim2
9292
sample1 = (15.0, 10.0)
9393
sample2 = (5.0, 15.0)
9494
plot(cont_hopf; vars = (:p1, :p2), fillrange = ylimit[2])
@@ -97,7 +97,7 @@ scatter!(sample1; label = "Oscillatory parameter set", markersize = 7)
9797
scatter!(sample2; label = "Non-oscillatory parameter set", markersize = 7)
9898
```
9999
Finally, we can perform one simulation using each of the parameter samples, confirming that one corresponds to an oscillation, while the other one does not.
100-
```@example bifurcationkit_bifpoint_continuation
100+
```@example bifurcationkit_codim2
101101
ps_nosc = [:v => sample2[1], :K => sample2[2], :n => 3, :d => 0.2]
102102
ps_osc = [:v => sample1[1], :K => sample1[2], :n => 3, :d => 0.2]
103103
oprob_nosc = ODEProblem(repressilator, u_guess, 100.0, ps_nosc)
@@ -109,7 +109,7 @@ plot(plot(sol_nosc; title = "No oscillation"), plot(sol_osc; title = "Oscillatio
109109

110110

111111
---
112-
## [Citation](@id bifurcation_kit_citation)
112+
## [Citation](@id bifurcationkit_codim2_citation)
113113
If you use this functionality in your research, please cite the following paper to support the author of the BifurcationKit package:
114114
```
115115
@misc{veltz:hal-02902346,

0 commit comments

Comments
 (0)