Skip to content

Update bifurcation_diagram_computation.md, add periodic orbits comput… #2445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions docs/src/tutorials/bifurcation_diagram_computation.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,9 @@ bprob = BifurcationProblem(osys,
jac = false)

p_span = (-3.0, 3.0)
opt_newton = NewtonPar(tol = 1e-9, max_iterations = 20)
opts_br = ContinuationPar(dsmin = 0.001, dsmax = 0.05, ds = 0.01,
max_steps = 100, nev = 2, newton_options = opt_newton,
opts_br = ContinuationPar(nev = 2,
p_max = p_span[2], p_min = p_span[1],
detect_bifurcation = 3, n_inversion = 4, tol_bisection_eigenvalue = 1e-8,
dsmin_bisection = 1e-9)
)

bf = bifurcationdiagram(bprob, PALC(), 2, (args...) -> opts_br; bothside = true)
using Plots
Expand All @@ -131,3 +128,26 @@ plot(bf;
```

Here, the value of `x` in the steady state does not change, however, at `μ=0` a Hopf bifurcation occur and the steady state turn unstable.

We compute the branch of periodic orbits which is nearby the Hopf Bifurcation. We thus provide the branch `bf.γ`, the index of the Hopf point we want to branch from: 2 in this case and a method `PeriodicOrbitOCollProblem(20, 5)` to compute periodic orbits.

```@example Bif2
br_po = continuation(bf.γ, 2, opts_br,
PeriodicOrbitOCollProblem(20, 5);
)

plot(bf; putspecialptlegend = false,
markersize = 2,
plotfold = false,
xguide = "μ",
yguide = "x")
plot!(br_po, xguide = "μ", yguide = "x", label = "Maximum of periodic orbit")
```

Let's see how to plot the periodic solution we just computed:

```@example Bif2
sol = get_periodic_orbit(br_po, 10)
plot(sol.t, sol[1,:], yguide = "x", xguide = "time", label = "")
```