Course Test · University: upper level

Dynamical systems and chaos: RatMath answers

The same twenty exercises, answered with RatMath Core and the Shelf libraries only. The code below was run when this page was built; its output is shown as printed, and compared with the independent answer.

Agrees 20

Libraries used here: core, chaos. In this code each library is in scope under its own name (linalg.det, stats.tTest), and Core's names (R, Rational, …) are in scope directly.

  1. 1.Fixed points and stabilityAgrees
    Find the fixed points of the logistic map f(x)=3x(1−x)f(x) = 3x(1 - x) and classify them.
    Independent answer
    x=3x−3x2x = 3x - 3x^2: x=0x = 0 or x=23x = \tfrac23. f′(x)=3−6xf'(x) = 3 - 6x: f′(0)=3f'(0) = 3 (repelling), f′(23)=−1f'(\tfrac23) = -1: the linear test is inconclusive there (the boundary where the period doubling starts). Writing x=23+ux = \tfrac23 + u, ff is u↦−u−3u2u \mapsto -u - 3u^2 and f∘ff \circ f is u−18u3−27u4u - 18u^3 - 27u^4, so 23\tfrac23 attracts, slowly (equivalently, the Schwarzian derivative −32f′′2=−54-\tfrac32 f''^2 = -54 is negative).
    RatMath code
    chaos.logistic(3).fixedPoints().map((p) => [p.text, p.stability, p.nonlinear ?? null])
    Output
    [["0", "repelling", null], ["2/3", "neutral", "attracting"]]
    23\tfrac23 has multiplier exactly −1-1, so the linear test says "neutral"; the higher-order terms (the Schwarzian derivative) then decide that it attracts.
    Fix: ratmath/chaos#10, neutral fixed points classified beyond the linear test (nonlinear, by the Schwarzian derivative)
  2. 2.MultipliersAgrees
    For f(x)=52x(1−x)f(x) = \tfrac52x(1 - x), find the non-zero fixed point and its multiplier.
    Independent answer
    x∗=1−1r=35x^* = 1 - \tfrac1r = \tfrac35; f′(x∗)=2−r=−12f'(x^*) = 2 - r = -\tfrac12: attracting, with orbits spiralling in (alternating sides).
    RatMath code
    chaos.logistic("5/2").derivativeAt("3/5")
    Output
    -1/2
  3. 3.Period-2 orbitsAgrees
    Find the 2-cycle of f(x)=4x(1−x)f(x) = 4x(1 - x) and its stability.
    Independent answer
    Divide f(f(x))−xf(f(x)) - x by x(4x−3)x(4x - 3): 16x2−20x+5=016x^2 - 20x + 5 = 0, x=5±58x = \tfrac{5 \pm \sqrt5}{8}. The multiplier is f′(x1)f′(x2)=16(1−2x1)(1−2x2)=−4f'(x_1)f'(x_2) = 16(1 - 2x_1)(1 - 2x_2) = -4: repelling.
    RatMath code
    chaos.logistic(4).periodicPoints(2).map((p) => [p.text, p.stability])
    Output
    [["(5 − √5)/8", "repelling"], ["(5 + √5)/8", "repelling"]]
  4. 4.Period doublingAgrees
    At which rr do the first two period doublings of the logistic map occur?
    Independent answer
    The fixed point loses stability when 2−r=−12 - r = -1: r1=3r_1 = 3. The 2-cycle has multiplier −r2+2r+4-r^2 + 2r + 4, which is −1-1 at r2=1+6≈3.449490r_2 = 1 + \sqrt6 \approx 3.449490.
    RatMath code
    chaos.periodDoubling(chaos.logistic(), { parameter: "r", levels: 2, start: [2.9, 0.6] }).parameters
    Output
    [2.99999999999999999997:3.00000000000000000003, 3.449489742783178[09639:10001]]
  5. 5.Superstable cyclesAgrees
    Find the rr at which the logistic map has a superstable 2-cycle (the critical point 12\tfrac12 has period 2).
    Independent answer
    f(f(12))=12f(f(\tfrac12)) = \tfrac12 with f(12)=r4f(\tfrac12) = \tfrac r4: r⋅r4(1−r4)=12r\cdot\tfrac r4(1 - \tfrac r4) = \tfrac12, i.e. r3−4r2+8=0=(r−2)(r2−2r−4)r^3 - 4r^2 + 8 = 0 = (r - 2)(r^2 - 2r - 4): r=1+5≈3.236068r = 1 + \sqrt5 \approx 3.236068.
    RatMath code
    chaos.superstable(chaos.logistic(), { parameter: "r", period: 2, range: [3, "7/2"] })[0]
    Output
    32951280099/10182505537:40730022148/12586269025
  6. 6.Lyapunov exponentAgrees
    What is the Lyapunov exponent of the logistic map at r=4r = 4?
    Independent answer
    ff is conjugate to the tent map with slope ±2\pm2 by x=sin⁡2(πθ/2)x = \sin^2(\pi\theta/2), so λ=ln⁡2≈0.6931\lambda = \ln 2 \approx 0.6931 for almost every orbit.
    RatMath code
    const e = chaos.lyapunovExponent(chaos.logistic(4), { digits: 4 });
    [e.value, e.invariance.proven]
    Output
    [0.693[09123838845071073:16811440211244592], true]
    lyapunovExponent encloses ∫log⁡∣f′∣ dμ\int \log|f'|\,d\mu against the invariant measure dx/(πx(1−x))dx/(\pi\sqrt{x(1-x)}), which is the limit itself and not a finite average. The measure is invariant by the conjugacy with the tent map; ergodicity is taken from the theory. lyapunov still gives the certified average along one orbit.
    Fix: ratmath/chaos#8, the escape test compares sizes, so long bounded orbits are not refused
    Fix: ratmath/chaos#9, lyapunovExponent: the exponent as a certified integral against the invariant density
  7. 7.Tent map orbitsAgrees
    Find the orbit of 15\tfrac15 under the tent map T(x)=2min⁡(x,1−x)T(x) = 2\min(x, 1 - x).
    Independent answer
    15→25→45→25→⋯\tfrac15 \to \tfrac25 \to \tfrac45 \to \tfrac25 \to \cdots: eventually periodic with period 2.
    RatMath code
    chaos.tent(2).orbit("1/5", 4)
    Output
    [1/5, 2/5, 4/5, 2/5, 4/5]
  8. 8.The doubling mapAgrees
    Find the orbit of 17\tfrac17 under x↦2x mod 1x \mapsto 2x \bmod 1.
    Independent answer
    17=0.001‾2\tfrac17 = 0.\overline{001}_2: the orbit 17,27,47\tfrac17, \tfrac27, \tfrac47 repeats, period 3 with no preperiod.
    RatMath code
    const d = chaos.doubling("1/7");
    [d.orbit, d.preperiod, d.period]
    Output
    [[1/7, 2/7, 4/7], 0, 3]
  9. 9.Sharkovskii's theoremAgrees
    For a continuous map of the line, does a 3-cycle force a 5-cycle? Does a 5-cycle force a 3-cycle?
    Independent answer
    Sharkovskii's order starts 3▹5▹7▹⋯3 \triangleright 5 \triangleright 7 \triangleright \cdots: period 3 forces every period, but period 5 does not force period 3.
    RatMath code
    [chaos.sharkovskii.forces(3, 5), chaos.sharkovskii.forces(5, 3)]
    Output
    [true, false]
  10. 10.The Hénon mapAgrees
    Find the fixed points of the Hénon map (x,y)↦(1−1.4x2+y, 0.3x)(x, y) \mapsto (1 - 1.4x^2 + y,\ 0.3x).
    Independent answer
    y=0.3xy = 0.3x and 1.4x2+0.7x−1=01.4x^2 + 0.7x - 1 = 0: x=−0.7±0.49+5.62.8≈0.631354x = \dfrac{-0.7 \pm \sqrt{0.49 + 5.6}}{2.8} \approx 0.631354 and −1.131354-1.131354. Both are saddles.
    RatMath code
    chaos.henon().fixedPoints({ x: [-2, 2], y: [-2, 2] }).map((p) => [p.point[0], p.stability])
    Output
    [[-1.13135447708950[653834:298562], "saddle"], [0.63135447708950[398482:553914], "saddle"]]
  11. 11.Lorenz equilibriaAgrees
    Find the equilibria of the Lorenz system with σ=10\sigma = 10, ρ=28\rho = 28, β=83\beta = \tfrac83, and classify them.
    Independent answer
    The origin, and (±β(ρ−1),±β(ρ−1),ρ−1)=(±72,±72,27)(\pm\sqrt{\beta(\rho - 1)}, \pm\sqrt{\beta(\rho - 1)}, \rho - 1) = (\pm\sqrt{72}, \pm\sqrt{72}, 27). At the origin the eigenvalues are −83-\tfrac83 and −11±12012\tfrac{-11 \pm \sqrt{1201}}2: a saddle. The other two are saddle-foci (one real negative eigenvalue and a complex pair with positive real part).
    RatMath code
    const E = chaos.lorenz().equilibria({ x: [-30, 30], y: [-30, 30], z: [-10, 60] });
    [E.complete, E.map((e) => e.kind), E.map((e) => e.point[2])]
    Output
    [true, ["saddle-focus", "saddle", "saddle-focus"], [26.99999999999998578914:27.00000000000001421086, -0.00000000000000000001:0.00000000000000000001, 26.99999999999998578914:27.00000000000001421086]]
  12. 12.The damped pendulumAgrees
    For θ′′+12θ′+sin⁡θ=0\theta'' + \tfrac12\theta' + \sin\theta = 0, classify the equilibria with −4≤θ≤4-4 \le \theta \le 4.
    Independent answer
    θ=0\theta = 0: Jacobian (01−1−12)\begin{pmatrix}0&1\\-1&-\frac12\end{pmatrix}, eigenvalues −1±i154\tfrac{-1 \pm i\sqrt{15}}{4}: a spiral sink. θ=±π\theta = \pm\pi: (011−12)\begin{pmatrix}0&1\\1&-\frac12\end{pmatrix}, real eigenvalues of opposite sign: saddles.
    RatMath code
    chaos.pendulum("1/2").equilibria({ x: [-4, 4], y: [-1, 1] }).map((e) => [e.point[0], e.kind])
    Output
    [[-3.14159265358979[666872:045146], "saddle"], [-0.00000000000000000001:0.00000000000000000001, "spiral sink"], [3.14159265358979[045146:666872], "saddle"]]
  13. 13.Arnold's cat mapAgrees
    For the cat map (2111)\begin{pmatrix}2&1\\1&1\end{pmatrix} on the torus, how many fixed points and how many points of period dividing 2 are there? What is its entropy?
    Independent answer
    The number of points with Anx=xA^n x = x is ∣det⁡(An−I)∣=∣tr⁡An−2∣|\det(A^n - I)| = |\operatorname{tr}A^n - 2|: ∣3−2∣=1|3 - 2| = 1 and ∣7−2∣=5|7 - 2| = 5. The entropy is ln⁡λmax⁡=ln⁡3+52≈0.9624\ln\lambda_{\max} = \ln\tfrac{3 + \sqrt5}{2} \approx 0.9624.
    RatMath code
    const T = chaos.catMap();
    [T.fixedPointCount(1), T.fixedPointCount(2), T.entropy().text]
    Output
    [1n, 5n, "log((3 + √5)/2)"]
  14. 14.Cantor setAgrees
    Find the box-counting dimension of the middle-thirds Cantor set.
    Independent answer
    Two copies at scale 13\tfrac13: 2⋅(13)s=12\cdot(\tfrac13)^s = 1, s=ln⁡2ln⁡3≈0.6309s = \dfrac{\ln2}{\ln3} \approx 0.6309.
    RatMath code
    const d = chaos.cantor().dimension();
    [d.formula, d.interval[0]]
    Output
    ["log(2)/log(3)", 5682910006162749/9007199254740992]
  15. 15.Sierpinski triangleAgrees
    Find the similarity dimension of the Sierpinski triangle.
    Independent answer
    Three copies at scale 12\tfrac12: s=log⁡23≈1.58496s = \log_2 3 \approx 1.58496.
    RatMath code
    const d = chaos.attractors.sierpinski().similarityDimension();
    [d.formula, d.interval[0]]
    Output
    ["log(3)/log(2)", 57104292221152067/36028797018963968]
  16. 16.Moran's equationAgrees
    A self-similar set has two pieces, scaled by 12\tfrac12 and 14\tfrac14. Find its dimension.
    Independent answer
    (12)s+(14)s=1(\tfrac12)^s + (\tfrac14)^s = 1. With u=2−su = 2^{-s}: u2+u=1u^2 + u = 1, u=5−12u = \tfrac{\sqrt5 - 1}2, so s=log⁡2φ≈0.694242s = \log_2\varphi \approx 0.694242.
    RatMath code
    chaos.moran(["1/2", "1/4"]).interval[0]
    Output
    381663528263/549755813888
  17. 17.The Mandelbrot setAgrees
    Are c=−1c = -1 and c=1c = 1 in the Mandelbrot set?
    Independent answer
    c=−1c = -1: 0→−1→0→⋯0 \to -1 \to 0 \to \cdots, a bounded 2-cycle: inside. c=1c = 1: 0→1→2→5→⋯0 \to 1 \to 2 \to 5 \to \cdots escapes: outside (∣z3∣=5>2|z_3| = 5 > 2).
    RatMath code
    [chaos.mandelbrotPoint("-1").verdict, chaos.mandelbrotPoint("1").verdict, chaos.mandelbrotPoint("1").escape]
    Output
    ["inside", "outside", 3]
  18. 18.Game of LifeAgrees
    Classify the blinker and the glider in Conway's Game of Life.
    Independent answer
    The blinker is an oscillator of period 2. The glider is a spaceship of period 4 that moves one cell diagonally each period (speed c/4c/4).
    RatMath code
    const L = (p) => chaos.life(chaos.patterns[p]).classify();
    [L("blinker").kind, L("blinker").period, L("glider").kind, L("glider").period, L("glider").speed]
    Output
    ["oscillator", 2, "spaceship", 4, "c/4"]
  19. 19.Sensitive dependenceAgrees
    For the tent map T(x)=2min⁡(x,1−x)T(x) = 2\min(x, 1 - x), the points 13\tfrac13 and 13+10−6\tfrac13 + 10^{-6} start close. After how many steps are they more than 110\tfrac1{10} apart?
    Independent answer
    While both stay on one side of each fold the distance doubles: 2n⋅10−6>0.12^n\cdot10^{-6} > 0.1 needs 2n>1052^n > 10^5, n=17n = 17. The growth rate is ln⁡2\ln 2 per step.
    RatMath code
    const s = chaos.sensitivity(chaos.tent(2), "1/3", "1/1000000");
    [s.reaches, s.factor]
    Output
    [17, 2]
    chaos.map knows no mod or floor, so the doubling map itself cannot be written as a formula; chaos.doubling handles exact orbits only.
  20. 20.ItinerariesAgrees
    Under f(x)=4x(1−x)f(x) = 4x(1 - x), write the first 6 symbols of the itinerary of x0=15x_0 = \tfrac15 (L if x<12x < \tfrac12, R if x>12x > \tfrac12).
    Independent answer
    15→1625→576625→…\tfrac15 \to \tfrac{16}{25} \to \tfrac{576}{625} \to \ldots: 0.20.2 L, 0.640.64 R, 0.92160.9216 R, 0.289010.28901 L, 0.821940.82194 R, 0.585420.58542 R. Itinerary LRRLRR.
    RatMath code
    chaos.itinerary(chaos.logistic(4), "1/5", 6)
    Output
    LRRLRR