@@ -111,7 +111,7 @@ The first `M` entries of the state are the angles, the last `M` are the momenta.
111111"""
112112function coupledstandardmaps end
113113using SparseArrays
114- function coupledstandardmaps (M:: Int , u0 = 0.001 rand (2 M);
114+ function coupledstandardmaps (M:: Int = 2 , u0 = 0.001 rand (2 M);
115115 ks = ones (M), Γ = 1.0 )
116116
117117 SV = SVector{M, Int}
@@ -130,7 +130,7 @@ function coupledstandardmaps(M::Int, u0 = 0.001rand(2M);
130130 sparseJ = sparse (J)
131131 p = vcat (ks, Γ)
132132 csm (sparseJ, u0, p, 0 )
133- return DeterministicIteratedMap (csm, u0, p, csm, sparseJ )
133+ return DeterministicIteratedMap (csm, u0, p)
134134end
135135struct CoupledStandardMaps{N}
136136 idxs:: SVector{N, Int}
@@ -148,7 +148,7 @@ function (f::CoupledStandardMaps{N})(xnew::AbstractVector, x, p, n) where {N}
148148
149149 xnew[i] = mod2pi (x[i] + xnew[i+ N])
150150 end
151- return xnew
151+ return nothing
152152end
153153function (f:: CoupledStandardMaps{M} )(
154154 J:: AbstractMatrix , x, p, n) where {M}
@@ -250,23 +250,23 @@ x_n(1 + |2x_n|^{z-1}), & \\quad |x_n| \\le 0.5 \\\\
250250[2] : Meyer et al., New. J. Phys **20** (2019)
251251"""
252252function pomeau_manneville (u0 = 0.2 , z = 2.5 )
253- return DeterministicIteratedMap (pm_rule, u0 , [z], pm_jac )
253+ return DeterministicIteratedMap (pm_rule, SVector {1} (u0) , [z])
254254end
255255function pm_rule (x, p, n)
256- if x < - 0.5
257- - 4 x - 3
258- elseif - 0.5 ≤ x ≤ 0.5
259- @inbounds x * (1 + abs (2 x)^ (p[1 ]- 1 ))
256+ if x[ 1 ] < - 0.5
257+ SVector {1} ( - 4 x[ 1 ] - 3 )
258+ elseif - 0.5 ≤ x[ 1 ] ≤ 0.5
259+ @inbounds SVector {1} (x[ 1 ] * (1 + abs (2 x[ 1 ] )^ (p[1 ]- 1 ) ))
260260 else
261- - 4 x + 3
261+ SVector {1} ( - 4 x[ 1 ] + 3 )
262262 end
263263end
264264function pomeau_manneville_jacob (x, p, n)
265- if x < - 0.5
265+ if x[ 1 ] < - 0.5
266266 - 4.0
267- elseif - 0.5 ≤ x ≤ 0.5
267+ elseif - 0.5 ≤ x[ 1 ] ≤ 0.5
268268 @inbounds z = p[1 ]
269- 0.5 (x^ 2 * 2 ^ z * (z- 1 )* abs (x)^ (z- 3 ) + 2 ^ z * abs (x)^ (z- 1 ) + 2 )
269+ 0.5 (x[ 1 ] ^ 2 * 2 ^ z * (z- 1 )* abs (x[ 1 ] )^ (z- 3 ) + 2 ^ z * abs (x[ 1 ] )^ (z- 1 ) + 2 )
270270 else
271271 - 4.0
272272 end
@@ -288,13 +288,13 @@ function's documentation string.
288288[^Manneville1980]: Manneville, P. (1980). Intermittency, self-similarity and 1/f spectrum in dissipative dynamical systems. [Journal de Physique, 41(11), 1235–1243](https://doi.org/10.1051/jphys:0198000410110123500)
289289"""
290290function manneville_simple (x0= 0.4 ; ε = 0.1 )
291- return DeterministicIteratedMap (manneville_f, x0 , [ε], manneville_j )
291+ return DeterministicIteratedMap (manneville_f, SVector {1} (x0) , [ε])
292292end
293293
294294function manneville_f (x, p, t)
295295 e = p[1 ]
296- y = (1 + e)* x + (1 - e)* x* x
297- return y% 1
296+ y = (1 + e)* x[ 1 ] + (1 - e)* x[ 1 ] * x[ 1 ]
297+ return SVector {1} ( y% 1 )
298298end
299299manneville_simple_jacob (x, p, n) = (1 + p[1 ]) + (1 - p[1 ])* 2 x
300300
@@ -411,15 +411,15 @@ function tentmap(u0 = 0.25, μ = 2.0)
411411end
412412function tentmap_rule (x, p, n)
413413 μ = p[1 ]
414- if x < 0.5
415- μ* x
414+ if x[ 1 ] < 0.5
415+ SVector {1} ( μ* x[ 1 ])
416416 else
417- μ* (1 - x)
417+ SVector {1} ( μ* (1 - x[ 1 ]) )
418418 end
419419end
420420function tentmap_jacob (x, p, n)
421421 μ = p[1 ]
422- if x < - 0.5
422+ if x[ 1 ] < - 0.5
423423 μ
424424 else
425425 - μ
@@ -440,14 +440,14 @@ The parameter β controls the dynamics of the map. Its Lyapunov exponent can be
440440At β=2, it becomes the dyadic transformation, also known as the bit shift map, the 2x mod 1 map, the Bernoulli map or the sawtooth map. The typical trajectory for this case is chaotic, though there are countably infinite periodic orbits [^Ott2002].
441441"""
442442function betatransformationmap (u0 = 0.25 ; β= 2.0 )
443- return DeterministicIteratedMap (betatransformation_rule, u0 , [β])
443+ return DeterministicIteratedMap (betatransformation_rule, SVector {1} (u0) , [β])
444444end
445445function betatransformation_rule (x, p, n)
446446 @inbounds β = p[1 ]
447- if 0 ≤ x < 1 / β
448- β* x
447+ if 0 ≤ x[ 1 ] < 1 / β
448+ SVector {1} ( β* x[ 1 ])
449449 else
450- β* x - 1
450+ SVector {1} ( β* x - 1 )
451451 end
452452end
453453function betatransformation_jacob (x, p, n)
520520 a,b,c,d = p
521521 x,y = u
522522 t = c - d/ (1 + x^ 2 + y^ 2 )
523- aux = 2 * d/ (1 + x^ 2 + y^ 2 )
524- return SMatrix {2,2} (b* (cos (t)- x^ 2 * sin (t)* aux - x* y* cos (t)* aux), b* (sin (t) + x^ 2 * cos (t)* aux)- x* y* sin (t)* aux,
525- b* (- sin (t) - x* y* sin (t)* aux - y^ 2 * cos (t)* aux), b* (cos (t) - x* y* cos (t)* aux - y^ 2 * sin (t)* aux))
523+ aux = 2 * d/ (1 + x^ 2 + y^ 2 )
524+ return SMatrix {2,2} (b* (cos (t)- x^ 2 * sin (t)* aux - x* y* cos (t)* aux), b* (sin (t) + x^ 2 * cos (t)* aux)- x* y* sin (t)* aux,
525+ b* (- sin (t) - x* y* sin (t)* aux - y^ 2 * cos (t)* aux), b* (cos (t) - x* y* cos (t)* aux - y^ 2 * sin (t)* aux))
526526end
527527
528528
0 commit comments