You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorials/attractors.md
+15-11
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,7 @@ Hence the "nonlocal-" component.
14
14
More differences and pros & cons are discussed in the documentation of Attractors.jl.
15
15
16
16
!!! note "Attractors and basins"
17
+
17
18
This tutorial assumes that you have some familiarity with dynamical systems,
18
19
specifically what are attractors and basins of attraction. If you don't have
19
20
this yet, we recommend Chapter 1 of the textbook
@@ -27,13 +28,13 @@ Let's showcase this framework by modelling a chaotic bistable dynamical system t
27
28
using ModelingToolkit
28
29
using ModelingToolkit: t_nounits as t, D_nounits as D
29
30
30
-
@variables x(t) = -4.0 y(t) = 5.0 z(t) = 0.0
31
-
@parameters a = 5.0 b = 0.1
31
+
@variables x(t)=-4.0 y(t)=5.0 z(t)=0.0
32
+
@parameters a=5.0 b=0.1
32
33
33
34
eqs = [
34
35
D(x) ~ y - x,
35
-
D(y) ~ - x*z + b*abs(z),
36
-
D(z) ~ x*y - a,
36
+
D(y) ~ -x * z + b * abs(z),
37
+
D(z) ~ x * y - a
37
38
]
38
39
```
39
40
@@ -74,7 +75,7 @@ To use this technique, we first need to create a tessellation of the state space
74
75
grid = (
75
76
range(-15.0, 15.0; length = 150), # x
76
77
range(-20.0, 20.0; length = 150), # y
77
-
range(-20.0, 20.0; length = 150), # z
78
+
range(-20.0, 20.0; length = 150) # z
78
79
)
79
80
```
80
81
@@ -83,9 +84,10 @@ which we then give as input to the `AttractorsViaRecurrences` mapper along with
83
84
```@example Attractors
84
85
mapper = AttractorsViaRecurrences(ds, grid;
85
86
consecutive_recurrences = 1000,
86
-
consecutive_lost_steps = 100,
87
+
consecutive_lost_steps = 100
87
88
)
88
89
```
90
+
89
91
to learn about the metaparameters of the algorithm visit the documentation of Attractors.jl.
90
92
91
93
This `mapper` object is incredibly powerful! It can be used to map initial conditions to attractor they converge to, while ensuring that initial conditions that converge to the same attractor are given the same label.
@@ -120,7 +122,7 @@ This is a dictionary that maps attractor IDs to the attractor sets themselves.
120
122
```@example Attractors
121
123
using CairoMakie
122
124
fig = Figure()
123
-
ax = Axis(fig[1,1])
125
+
ax = Axis(fig[1,1])
124
126
colors = ["#7143E0", "#191E44"]
125
127
for (id, A) in attractors
126
128
scatter!(ax, A[:, [1, 3]]; color = colors[id])
@@ -130,8 +132,8 @@ fig
130
132
131
133
## Basins of attraction
132
134
133
-
Estimating the basins of attraction of these attractors is a matter of a couple lines of code.
134
-
First we define the state space are to estimate the basins for.
135
+
Estimating the basins of attraction of these attractors is a matter of a couple lines of code.
136
+
First we define the state space are to estimate the basins for.
135
137
Here we can re-use the `grid` we defined above. Then we only have to call
0 commit comments