Skip to content

Commit 8c6bd0e

Browse files
committed
solve some problems with standard map and cat map
1 parent 5cc78d9 commit 8c6bd0e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicalSystemsBase"
22
uuid = "6e36e845-645a-534a-86f2-f5d4aa5a06b4"
33
repo = "https://github.com/JuliaDynamics/DynamicalSystemsBase.jl.git"
4-
version = "1.5.5"
4+
version = "1.5.6"
55

66
[deps]
77
DelayEmbeddings = "5732040d-69e3-5649-938a-b6b4f237613f"

src/discrete_famous_systems.jl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ introduced in [1] to study diffusion and chaos thresholds.
127127
The *total* dimension of the system
128128
is `2M`. The maps are coupled through `Γ`
129129
and the `i`-th map has a nonlinear parameter `ks[i]`.
130+
The first `M` parameters are the `ks`, the `M+1`th parameter is `Γ`.
130131
131132
The first `M` entries of the state are the angles, the last `M` are the momenta.
132133
@@ -151,7 +152,7 @@ function coupledstandardmaps(M::Int, u0 = 0.001rand(2M);
151152
J[i+M, i+M] = 1
152153
end
153154
sparseJ = sparse(J)
154-
p = (ks, Γ)
155+
p = vcat(ks, Γ)
155156
csm(sparseJ, u0, p, 0)
156157
return DDS(csm, u0, p, csm, sparseJ)
157158
end
@@ -161,7 +162,7 @@ struct CoupledStandardMaps{N}
161162
idxsp1::SVector{N, Int}
162163
end
163164
function (f::CoupledStandardMaps{N})(xnew::AbstractVector, x, p, n) where {N}
164-
ks, Γ = p
165+
ks = view(p, 1:N); Γ = p[end]
165166
@inbounds for i in f.idxs
166167

167168
xnew[i+N] = mod2pi(
@@ -171,12 +172,12 @@ function (f::CoupledStandardMaps{N})(xnew::AbstractVector, x, p, n) where {N}
171172

172173
xnew[i] = mod2pi(x[i] + xnew[i+N])
173174
end
174-
return nothing
175+
return xnew
175176
end
176177
function (f::CoupledStandardMaps{M})(
177178
J::AbstractMatrix, x, p, n) where {M}
178179

179-
ks, Γ = p
180+
ks = view(p, 1:M); Γ = p[end]
180181
# x[i] ≡ θᵢ
181182
# x[[idxsp1[i]]] ≡ θᵢ+₁
182183
# x[[idxsm1[i]]] ≡ θᵢ-₁
@@ -328,6 +329,6 @@ function arnoldcat(u0 = rand(2))
328329
end # Should give Lyapunov exponents [2.61803, 0.381966]
329330
function arnoldcat_eom(u, p, n)
330331
x,y = u
331-
return SVector{2}(2x + y, x + y)
332+
return SVector{2}((2x + y) % 1.0, (x + y) % 1)
332333
end
333334
arnoldcat_jacob(u, p, n) = @SMatrix [2 1; 1 1]

0 commit comments

Comments
 (0)