.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/chaos/billiards/plot_poincare_comparison.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_chaos_billiards_plot_poincare_comparison.py: Comparing All Five Billiards ============================= Every billiard here is a point particle moving in a straight line at constant speed inside a closed boundary, undergoing specular reflection .. math:: \mathbf{v}' = \mathbf{v} - 2(\mathbf{v}\cdot\mathbf{n})\,\mathbf{n} whenever it strikes the boundary; the five shapes below differ only in that boundary's geometry: a disk :math:`x^2+y^2=r^2` (Circle), a rectangle :math:`|x|\le w/2,\ |y|\le h/2` (Rectangle), a disk with a flat chord cut off (Truncated Circle), a square cell with a circular scatterer removed from its center (Sinai), and two semicircular caps joined by straight edges (Bunimovich Stadium). This is a side-by-side comparison of the Poincare section for every billiard shape ``physicskit.chaos`` ships, from fully integrable (Circle, Rectangle) through mixed (Truncated Circle) to fully chaotic (Sinai, Bunimovich Stadium). .. GENERATED FROM PYTHON SOURCE LINES 22-34 .. code-block:: Python import matplotlib.pyplot as plt from physicskit.chaos.systems.billiards import ( BunimovichStadium, CircleBilliard, RectangleBilliard, SinaiBilliard, TruncatedCircleBilliard, ) from physicskit.chaos.visualizers.phase_space import plot_poincare_section .. GENERATED FROM PYTHON SOURCE LINES 35-39 Build one instance of each billiard and plot its Poincare section into its own subplot, using the ``ax=`` parameter of :func:`physicskit.chaos.visualizers.phase_space.plot_poincare_section` to draw into a shared figure. .. GENERATED FROM PYTHON SOURCE LINES 39-55 .. code-block:: Python billiards = { "Circle (integrable)": CircleBilliard(radius=1.0), "Rectangle (integrable)": RectangleBilliard(width=2.0, height=1.0), "Truncated Circle (mixed)": TruncatedCircleBilliard(radius=1.0, cut=0.3), "Sinai (chaotic)": SinaiBilliard(cell_size=2.0, scatterer_radius=0.5), "Bunimovich Stadium (chaotic)": BunimovichStadium(radius=1.0, straight_length=2.0), } fig, axes = plt.subplots(2, 3, figsize=(15, 9)) for ax, (name, billiard) in zip(axes.flat, billiards.items()): plot_poincare_section(billiard, n_rays=25, n_bounces=150, ax=ax, s=1.0) ax.set_title(name) axes.flat[-1].axis("off") fig.tight_layout() plt.show() .. image-sg:: /api/gallery/chaos/billiards/images/sphx_glr_plot_poincare_comparison_001.png :alt: Circle (integrable), Rectangle (integrable), Truncated Circle (mixed), Sinai (chaotic), Bunimovich Stadium (chaotic) :srcset: /api/gallery/chaos/billiards/images/sphx_glr_plot_poincare_comparison_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.179 seconds) .. _sphx_glr_download_api_gallery_chaos_billiards_plot_poincare_comparison.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_poincare_comparison.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_poincare_comparison.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_poincare_comparison.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_