.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "api/gallery/topology/surfaces/plot_03_classification_of_surfaces.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 or to run this example in your browser via JupyterLite. .. rst-class:: sphx-glr-example-title .. _sphx_glr_api_gallery_topology_surfaces_plot_03_classification_of_surfaces.py: The classification of surfaces (Dehn and Heegaard 1907, Brahana 1921) ===================================================================== Every compact connected surface is a sphere with handles or with cross-caps, minus some discs. Three numbers decide which: orientability, the Euler characteristic, and the number of boundary circles. Here :func:`~mathematicskit.topology.classify_surface` names nine triangulated surfaces from those invariants alone. .. GENERATED FROM PYTHON SOURCE LINES 13-46 .. code-block:: Python import matplotlib.pyplot as plt from mathematicskit.topology import ( SimplicialComplex, barycentric_subdivision, classify_surface, klein_bottle, mobius_strip, projective_plane, simplex, sphere, torus, ) T = torus(6, 4) surfaces = { "boundary of a tetrahedron": sphere(2), "triangle": simplex(2), "ring of squares": T.induced_subcomplex([v for v in T.vertices if v // 4 in range(4)]), "doughnut grid": T, "torus minus a triangle": SimplicialComplex(T.simplices(2)[1:]), "twisted band": mobius_strip(), "6-vertex RP^2": projective_plane(), "subdivided RP^2": barycentric_subdivision(projective_plane()), "twisted grid": klein_bottle(), } rows = [] for label, K in surfaces.items(): c = classify_surface(K) rows.append([label, f"{K.f_vector}", str(c.euler_characteristic), "yes" if c.orientable else "no", str(c.boundary_components), c.name]) print(f"{label:>26} -> {c.name}") .. rst-class:: sphx-glr-script-out .. code-block:: none boundary of a tetrahedron -> sphere triangle -> disk ring of squares -> annulus doughnut grid -> torus torus minus a triangle -> orientable surface of genus 1 with 1 boundary component twisted band -> Möbius strip 6-vertex RP^2 -> projective plane subdivided RP^2 -> projective plane twisted grid -> Klein bottle .. GENERATED FROM PYTHON SOURCE LINES 47-49 The invariants side by side --------------------------- .. GENERATED FROM PYTHON SOURCE LINES 49-58 .. code-block:: Python fig, ax = plt.subplots(figsize=(12, 3.6)) ax.axis("off") table = ax.table(cellText=rows, colLabels=["triangulation", "(V, E, F)", "χ", "orientable", "boundary", "surface"], loc="center", cellLoc="left") table.auto_set_font_size(False) table.set_fontsize(9) table.auto_set_column_width(range(6)) table.scale(1, 1.4) ax.set_title("Orientability, χ and boundary circles determine the surface") .. image-sg:: /api/gallery/topology/surfaces/images/sphx_glr_plot_03_classification_of_surfaces_001.png :alt: Orientability, χ and boundary circles determine the surface :srcset: /api/gallery/topology/surfaces/images/sphx_glr_plot_03_classification_of_surfaces_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none Text(0.5, 1.0, 'Orientability, χ and boundary circles determine the surface') .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.091 seconds) .. _sphx_glr_download_api_gallery_topology_surfaces_plot_03_classification_of_surfaces.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: lite-badge .. image:: images/jupyterlite_badge_logo.svg :target: ../../../../lite/lab/index.html?path=api/gallery/topology/surfaces/plot_03_classification_of_surfaces.ipynb :alt: Launch JupyterLite :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_03_classification_of_surfaces.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_03_classification_of_surfaces.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_03_classification_of_surfaces.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_