Skip to content

Commit 05bd8c8

Browse files
committed
better display
1 parent 1f1e3ae commit 05bd8c8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

docs/src/steady_state_functionality/examples/bifurcationkit_bifpoint_continuation.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Next, we create a `BifurcationProblem` for our model. We will compute the bifurc
1616
```@example bifurcationkit_bifpoint_continuation
1717
using BifurcationKit
1818
bif_par = :v
19-
u_guess = [:X => 15.0, :Y => 15.0, :Z => 15.0]
19+
u_guess = [:X => 20.0, :Y => 15.0, :Z => 15.0]
2020
p_start = [:v => 10.0, :K => 15.0, :n => 3, :d => 0.2]
2121
plot_var = :X
2222
bprob = BifurcationProblem(repressilator, u_guess, p_start, bif_par; plot_var)
@@ -63,8 +63,10 @@ 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$).
6565
```@example bifurcationkit_bifpoint_continuation
66-
plot(bifdia; branchlabel = "Continuation of steady state w.r.t. v, (K = 15)", linewidthstable = 6, linewidthunstable = 3, markersize = 5)
67-
plot!(cont_hopf; vars = (:p1, :x), xlimit = v_span, xguide = bif_par, yguide = plot_var, branchlabel = "Continuation of Hopf bifurcation w.r.t. K")
66+
plot(bifdia; branchlabel = "Continuation of steady state w.r.t. v, (K = 15)", linewidthstable = 6,
67+
linewidthunstable = 3, markersize = 5)
68+
plot!(cont_hopf; vars = (:p1, :x), xlimit = v_span, xguide = bif_par, yguide = plot_var,
69+
branchlabel = "Continuation of Hopf bifurcation w.r.t. K")
6870
```
6971
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.
7072

@@ -82,7 +84,8 @@ Finally, we have already noted that the Hopf bifurcation splits parameter space
8284
```@example bifurcationkit_bifpoint_continuation
8385
xlimit = extrema(getfield.(cont_hopf.branch, :p1))
8486
ylimit = extrema(getfield.(cont_hopf.branch, :p2))
85-
plot(cont_hopf; vars = (:p1, :p2), xlimit, ylimit, branchlabel = "Hopf bifurcation", xguide = "v", yguide = "K", lw = 6)
87+
plot(cont_hopf; vars = (:p1, :p2), xlimit, ylimit, branchlabel = "Hopf bifurcation",
88+
xguide = "v", yguide = "K", lw = 6)
8689
```
8790
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).
8891
```@example bifurcationkit_bifpoint_continuation
@@ -95,11 +98,11 @@ scatter!(sample2; label = "Non-oscillatory parameter set", markersize = 7)
9598
```
9699
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.
97100
```@example bifurcationkit_bifpoint_continuation
98-
ps_osc = [:v => sample1[1], :K => sample1[2], :n => 3, :d => 0.2]
99101
ps_nosc = [:v => sample2[1], :K => sample2[2], :n => 3, :d => 0.2]
100-
oprob_osc = ODEProblem(repressilator, u_guess, 100.0, ps_osc)
102+
ps_osc = [:v => sample1[1], :K => sample1[2], :n => 3, :d => 0.2]
101103
oprob_nosc = ODEProblem(repressilator, u_guess, 100.0, ps_nosc)
102-
sol_osc = OrdinaryDiffEqDefault.solve(oprob_osc)
104+
oprob_osc = ODEProblem(repressilator, u_guess, 100.0, ps_osc)
103105
sol_nosc = OrdinaryDiffEqDefault.solve(oprob_nosc)
104-
plot(plot(sol_osc; title = "Oscillation"), plot(sol_nosc; title = "No oscillation"); size = (1000, 400), lw = 4)
106+
sol_osc = OrdinaryDiffEqDefault.solve(oprob_osc)
107+
plot(plot(sol_nosc; title = "No oscillation"), plot(sol_osc; title = "Oscillation"); size = (1000, 400), lw = 4)
105108
```

0 commit comments

Comments
 (0)