{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Manifold graphics in SageMath" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook illustrates some plotting capabilities of manifold objects in SageMath.\n", "\n", "More examples can be found on the [SageManifolds page](https://sagemanifolds.obspm.fr/examples.html)." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%display latex" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## The 2-sphere example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let us consider the sphere $\\mathbb{S}^2$. In SageMath, we declare it as a 2-dimensional \n", "differentiable manifold:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-dimensional differentiable manifold S^2\n" ] } ], "source": [ "S2 = Manifold(2, 'S^2', latex_name=r'\\mathbb{S}^2', start_index=1)\n", "print(S2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We then introduce the standard spherical coordinates $(\\theta,\\phi)$ as a chart on $\\mathbb{S}^2$, denoting the chart as `spher` and the coordinates `th` and `ph`.\n", "We shall be lazy here and consider that the spherical chart covers the whole manifold $\\mathbb{S}^2$; this amounts to authorize coordinate singularities:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\(\\displaystyle \\left(\\mathbb{S}^2,({\\theta}, {\\phi})\\right)\\)" ], "text/latex": [ "$\\displaystyle \\left(\\mathbb{S}^2,({\\theta}, {\\phi})\\right)$" ], "text/plain": [ "Chart (S^2, (th, ph))" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "spher.