.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/classical/hamiltonian/plot_06_kam_tori_standard_map.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_classical_hamiltonian_plot_06_kam_tori_standard_map.py: The KAM theorem: which invariant tori survive a perturbation ================================================================ Kolmogorov (1954), Arnold (1963) and Moser (1962) proved that when an integrable Hamiltonian system is perturbed slightly, *most* of its invariant tori survive, merely deformed. The ones that break first are the resonant tori, whose frequency ratio is rational; the last to go are those with the "most irrational" ratio, poorly approximated by fractions, the golden mean above all. The cleanest place to watch this is the Chirikov-Taylor standard map, :class:`~physicskit.chaos.systems.maps.StandardMap`, the surface of section of a periodically kicked rotor: .. math:: p' = p + K\sin\theta, \qquad \theta' = \theta + p' . At :math:`K=0` every line :math:`p=\text{const}` is an invariant torus with rotation number :math:`\nu=p/2\pi`. This example turns :math:`K` on and follows which tori remain. .. GENERATED FROM PYTHON SOURCE LINES 26-33 .. code-block:: Python import matplotlib.pyplot as plt import numpy as np from physicskit.chaos.systems.maps import StandardMap GOLDEN = (np.sqrt(5.0) - 1.0) / 2.0 # 0.618..., the most irrational number .. GENERATED FROM PYTHON SOURCE LINES 34-42 Tori deform, resonances break up ------------------------------------ Orbits launched on a grid of momenta, for increasing kick strength. At small :math:`K` almost every orbit still traces a curve that wraps all the way around in :math:`\theta`: a surviving KAM torus. The rational tori at :math:`\nu=0,\ 1/2,\ 1/3,\ 2/3` are the first to go, replaced by chains of islands with thin chaotic layers. By :math:`K=1.2` the last wrapping curves are gone. .. GENERATED FROM PYTHON SOURCE LINES 42-59 .. code-block:: Python Ks = [0.3, 0.7, 0.97, 1.2] fig1, axes = plt.subplots(1, 4, figsize=(15, 4), sharey=True) for ax, K in zip(axes, Ks): smap = StandardMap(k=K) for p0 in np.linspace(0.0, 2.0 * np.pi, 40, endpoint=False): for th0 in (0.0, np.pi): traj = smap.trajectory(np.array([th0, p0]), n_iter=600) ax.plot(traj[:, 0], traj[:, 1], ",", color=plt.cm.twilight(p0 / (2 * np.pi))) ax.axhline(2 * np.pi * GOLDEN, color="k", lw=0.6, ls="--") ax.set_title(f"K = {K}") ax.set_xlabel(r"$\theta$") ax.set_xlim(0, 2 * np.pi) ax.set_ylim(0, 2 * np.pi) axes[0].set_ylabel("p") fig1.suptitle(r"Standard map: KAM tori (dashed: golden-mean torus at $K=0$)") fig1.tight_layout() .. image-sg:: /api/gallery/classical/hamiltonian/images/sphx_glr_plot_06_kam_tori_standard_map_001.png :alt: Standard map: KAM tori (dashed: golden-mean torus at $K=0$), K = 0.3, K = 0.7, K = 0.97, K = 1.2 :srcset: /api/gallery/classical/hamiltonian/images/sphx_glr_plot_06_kam_tori_standard_map_001.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 60-68 The golden torus is the last barrier ---------------------------------------- A rotational KAM torus is a wall: no orbit can cross it. Start an orbit in the chaotic layer at the :math:`\nu=0` resonance and record the largest distance it ever wanders from :math:`p=0`. As long as golden-mean tori survive, that distance stays below them; past Greene's critical value :math:`K_c\approx0.9716` the last wall is gone and the orbit reaches the :math:`\nu=1/2` resonance at :math:`p=\pi`. .. GENERATED FROM PYTHON SOURCE LINES 68-91 .. code-block:: Python K_values = np.linspace(0.5, 1.3, 33) reach = [] for K in K_values: traj = StandardMap(k=K).trajectory(np.array([1e-3, 0.0]), n_iter=200_000) p_centred = (traj[:, 1] + np.pi) % (2 * np.pi) - np.pi reach.append(np.max(np.abs(p_centred))) reach = np.array(reach) for K, r in zip(K_values[::4], reach[::4]): print(f"K = {K:.3f}: max |p| reached = {r:.3f} ({'trapped' if r < 0.9 * np.pi else 'escaped to p = pi'})") fig2, ax2 = plt.subplots(figsize=(6, 3.8)) ax2.plot(K_values, reach, "o-", color="steelblue", ms=4) ax2.axvline(0.9716, color="firebrick", ls="--", label=r"$K_c\approx0.9716$ (golden torus breaks)") ax2.axhline(np.pi, color="0.6", lw=0.8) ax2.set_xlabel("kick strength K") ax2.set_ylabel(r"max $|p|$ reached from $p\approx0$") ax2.set_title("Crossing the last KAM torus") ax2.legend(fontsize=8) fig2.tight_layout() plt.show() .. image-sg:: /api/gallery/classical/hamiltonian/images/sphx_glr_plot_06_kam_tori_standard_map_002.png :alt: Crossing the last KAM torus :srcset: /api/gallery/classical/hamiltonian/images/sphx_glr_plot_06_kam_tori_standard_map_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none K = 0.500: max |p| reached = 1.460 (trapped) K = 0.600: max |p| reached = 1.627 (trapped) K = 0.700: max |p| reached = 1.822 (trapped) K = 0.800: max |p| reached = 2.043 (trapped) K = 0.900: max |p| reached = 2.358 (trapped) K = 1.000: max |p| reached = 3.142 (escaped to p = pi) K = 1.100: max |p| reached = 3.142 (escaped to p = pi) K = 1.200: max |p| reached = 3.142 (escaped to p = pi) K = 1.300: max |p| reached = 3.142 (escaped to p = pi) .. GENERATED FROM PYTHON SOURCE LINES 92-97 Check ----- KAM tori confine p until the last (golden-mean) torus breaks at Greene's K_c = 0.9716; above it orbits from p ~ 0 reach p = pi (just above K_c only slowly, through the leaky cantori the torus leaves behind). .. GENERATED FROM PYTHON SOURCE LINES 97-99 .. code-block:: Python assert np.all(reach[K_values < 0.95] < 0.9 * np.pi) assert np.all(reach[K_values > 1.06] > 0.99 * np.pi) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.376 seconds) .. _sphx_glr_download_api_gallery_classical_hamiltonian_plot_06_kam_tori_standard_map.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_06_kam_tori_standard_map.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_06_kam_tori_standard_map.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_06_kam_tori_standard_map.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_