Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: JNCF2018
Views: 400
Kernel: SageMath (stable)

Smooth manifolds, charts and scalar fields

This woksheet accompanies the lecture Symbolic tensor calculus on manifolds at JNCF 2018.

Click here to download the worksheet file (ipynb format). To run it, you must start SageMath with the Jupyter notebook, via the command sage -n jupyter

NB: a version of SageMath at least equal to 7.5 (8.2 for the SymPy part) is required to run this worksheet:

version()
'SageMath version 8.4, Release Date: 2018-10-17'

First we set up the notebook to use LaTeX display:

%display latex

Starting with a manifold

Manifolds are constructed via the global function Manifold:

M = Manifold(2, 'M') print(M)
2-dimensional differentiable manifold M

By default, Manifold returns a manifold over R\mathbb{R}:

M.base_field()
R\renewcommand{\Bold}[1]{\mathbf{#1}}\Bold{R}

Other base fields must be specified with the optional keyword field, like

M = Manifold(2, 'M', field='complex')

We may check that MM is a topological space:

M in Sets().Topological()
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Actually, MM belongs to the following categories:

M.categories()
[SmoothR,DifferentiableR,ManifoldsR,TopologicalSpaces(Sets),Sets,SetsWithPartialMaps,Objects]\renewcommand{\Bold}[1]{\mathbf{#1}}\left[\mathbf{Smooth}_{\Bold{R}}, \mathbf{Differentiable}_{\Bold{R}}, \mathbf{Manifolds}_{\Bold{R}}, \mathbf{TopologicalSpaces}(\mathbf{Sets}), \mathbf{Sets}, \mathbf{SetsWithPartialMaps}, \mathbf{Objects}\right]

As we can see, by default, Manifold constructs a smooth manifold. If one would like to stick to the topological level, one should write

M = Manifold(2, 'M', structure='topological')

Smooth manifolds are implemented by the Python class DifferentiableManifold:

type(M)
[removed]\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|[removed]|

The type of M appears as DifferentiableManifold-with-category because it is actually a subclass of DifferentiableManifold, which is dynamically generated by SageMath's category mechanism:

isinstance(M, sage.manifolds.differentiable.manifold.DifferentiableManifold)
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

The class DifferentiableManifold inherits from TopologicalManifold:

isinstance(M, sage.manifolds.manifold.TopologicalManifold)
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Coordinate charts

We declare a chart, along with the symbols used to denote the coordinates (here x=x0x=x^0 and y=x1y=x^1) by

U = M.open_subset('U') XU.<x,y> = U.chart() XU
(U,(x,y))\renewcommand{\Bold}[1]{\mathbf{#1}}\left(U,(x, y)\right)

Open subsets are implemented by a (dynamically generated) subclass of DifferentiableManifold, since they are manifolds in their own:

isinstance(U, sage.manifolds.differentiable.manifold.DifferentiableManifold)
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Points on MM are created by passing their coordinates in a given chart:

p = U((1,2), chart=XU, name='p') print(p)
Point p on the 2-dimensional differentiable manifold M

The syntax U(...) used to create pp as an element of UU reflects the parent/element pattern employed in SageMath; indeed UU is the parent of pp:

p.parent()
U\renewcommand{\Bold}[1]{\mathbf{#1}}U

Points are implemented by the class ManifoldPoint. The principal attribute of this class is a Python dictionary storing the point's coordinates in various charts:

p._coordinates
{(U,(x,y)):(1,2)}\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\left(U,(x, y)\right) : \left(1, 2\right)\right\}

Of course, we can recover the point's coordinates by letting the chart act on the point:

XU(p)
(1,2)\renewcommand{\Bold}[1]{\mathbf{#1}}\left(1, 2\right)

Let us introduce a second chart on MM:

V = M.open_subset('V') XV.<xp,yp> = V.chart("xp:x' yp:y'") XV
(V,(x′,y′))\renewcommand{\Bold}[1]{\mathbf{#1}}\left(V,({x'}, {y'})\right)

and declare that MM is covered by only two charts, i.e. that M=U∪VM=U\cup V:

M.declare_union(U,V)
M.atlas()
[(U,(x,y)),(V,(x′,y′))]\renewcommand{\Bold}[1]{\mathbf{#1}}\left[\left(U,(x, y)\right), \left(V,({x'}, {y'})\right)\right]

Transition map

We define the transition map XU →\to XV on W=U∩VW = U\cap V as follows:

XU_to_XV = XU.transition_map(XV, (x/(x^2+y^2), y/(x^2+y^2)), intersection_name='W', restrictions1= x^2+y^2!=0, restrictions2= xp^2+yp^2!=0) XU_to_XV.display()
{x′=xx2+y2y′=yx2+y2\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\begin{array}{lcl} {x'} & = & \frac{x}{x^{2} + y^{2}} \\ {y'} & = & \frac{y}{x^{2} + y^{2}} \end{array}\right.

The value of the argument restrictions1 means that W=U∖{S}W = U\setminus \{S\}, where SS is the point of coordinates (x,y)=(0,0)(x,y)=(0,0), while the value of restrictions2 means that W=V∖{N}W = V\setminus \{N\}, where NN is the point of coordinates (x′,y′)=(0,0)(x',y')=(0,0). Since M=U∪VM=U\cup V, we have then U=M∖{N},V=M∖{S},andW=M∖{N,S}. U = M \setminus \{N\},\qquad V = M \setminus \{S\},\quad\mbox{and}\quad W = M \setminus \{N, S\} .

The transition map XV →\to XU is obtained by computing the inverse of the one defined above:

XU_to_XV.inverse().display()
{x=x′x′2+y′2y=y′x′2+y′2\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\begin{array}{lcl} x & = & \frac{{x'}}{{x'}^{2} + {y'}^{2}} \\ y & = & \frac{{y'}}{{x'}^{2} + {y'}^{2}} \end{array}\right.

At this stage, the smooth manifold MM is fully specified, being covered by one atlas with all transition maps specified. One may have recognized that MM is nothing but the 2-dimensional sphere: M=S2, M = \mathbb{S}^2 , with XU (resp. XV) being the chart of \defin{stereographic coordinates}\index{stereographic!coordinates} from the North pole NN (resp. the South pole SS).

Since the transition maps have been defined, we can ask for the coordinates (x′,y′)(x',y') of the point pp:

XV(p)
(15,25)\renewcommand{\Bold}[1]{\mathbf{#1}}\left(\frac{1}{5}, \frac{2}{5}\right)

This operation has updated the dictionary _coordinates:

p._coordinates
{(U,(x,y)):(1,2),(V,(x′,y′)):(15,25)}\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\left(U,(x, y)\right) : \left(1, 2\right), \left(V,({x'}, {y'})\right) : \left(\frac{1}{5}, \frac{2}{5}\right)\right\}

Smooth maps

As a example of smooth map, let us consider the canonical embedding of M=S2M=\mathbb{S}^2 into R3\mathbb{R}^3. We need first to introduce R3\mathbb{R}^3 as a 3-dimensional smooth manifold, endowed with a single chart:

R3 = Manifold(3, 'R^3', r'\mathbb{R}^3') XR3.<X,Y,Z> = R3.chart() XR3
(R3,(X,Y,Z))\renewcommand{\Bold}[1]{\mathbf{#1}}\left(\mathbb{R}^3,(X, Y, Z)\right)

The embedding Φ:S2→R3\Phi: \mathbb{S}^2 \to \mathbb{R}^3 is then defined in terms of its coordinate expression in the two charts covering M=S2M=\mathbb{S}^2:

Phi = M.diff_map(R3, {(XU, XR3): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], (XV, XR3): [2*xp/(1+xp^2+yp^2), 2*yp/(1+xp^2+yp^2), (1-xp^2-yp^2)/(1+xp^2+yp^2)]}, name='Phi', latex_name=r'\Phi') Phi.display()
Φ:M⟶R3on U:(x,y)⟼(X,Y,Z)=(2 xx2+y2+1,2 yx2+y2+1,x2+y2−1x2+y2+1)on V:(x′,y′)⟼(X,Y,Z)=(2 x′x′2+y′2+1,2 y′x′2+y′2+1,−x′2+y′2−1x′2+y′2+1)\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} \Phi:& M & \longrightarrow & \mathbb{R}^3 \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \left(X, Y, Z\right) = \left(\frac{2 \, x}{x^{2} + y^{2} + 1}, \frac{2 \, y}{x^{2} + y^{2} + 1}, \frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1}\right) \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & \left(X, Y, Z\right) = \left(\frac{2 \, {x'}}{{x'}^{2} + {y'}^{2} + 1}, \frac{2 \, {y'}}{{x'}^{2} + {y'}^{2} + 1}, -\frac{{x'}^{2} + {y'}^{2} - 1}{{x'}^{2} + {y'}^{2} + 1}\right) \end{array}

We may use Φ\Phi for graphical purposes, for instance to display the grids of the stereographic charts XU (in red) and XV (in green), with the point pp atop:

graph = XU.plot(chart=XR3, mapping=Phi, number_values=25, label_axes=False) + \ XV.plot(chart=XR3, mapping=Phi, number_values=25, color='green', label_axes=False) + \ p.plot(chart=XR3, mapping=Phi, label_offset=0.05) show(graph, viewer='threejs', online=True)

Scalar fields

Let us define a scalar field, i.e. a smooth map M→RM\to \mathbb{R}:

f = M.scalar_field({XU: 1/(1+x^2+y^2), XV: (xp^2+yp^2)/(1+xp^2+yp^2)}, name='f') f.display()
f:M⟶Ron U:(x,y)⟼1x2+y2+1on V:(x′,y′)⟼x′2+y′2x′2+y′2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} f:& M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \frac{1}{x^{2} + y^{2} + 1} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & \frac{{x'}^{2} + {y'}^{2}}{{x'}^{2} + {y'}^{2} + 1} \end{array}

Scalar fields are implemented by the class DiffScalarField and the function chart representations are stored in the attribute _express of this class, which is a Python dictionary whose keys are the various charts defined on MM:

f._express
{(U,(x,y)):1x2+y2+1,(V,(x′,y′)):x′2+y′2x′2+y′2+1}\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\left(U,(x, y)\right) : \frac{1}{x^{2} + y^{2} + 1}, \left(V,({x'}, {y'})\right) : \frac{{x'}^{2} + {y'}^{2}}{{x'}^{2} + {y'}^{2} + 1}\right\}

One may wonder about the compatibility of the two coordinate expressions provided in the definition of ff. Actually, to enforce the compatibility, it is possible to declare the scalar field in a single chart, XU say, and then to obtain its expression in chart XV by analytic continuation from the expression in W=U∩VW=U\cap V, where both expressions are known, thanks to the transition map XV →\to XU:

f0 = M.scalar_field({XU: 1/(1+x^2+y^2)}) f0.add_expr_by_continuation(XV, U.intersection(V)) f == f0
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

The representation of the scalar field in a given chart, i.e. the public access to the directory _express, is obtained via the method coord_function():

fU = f.coord_function(XU) fU.display()
(x,y)↦1x2+y2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\left(x, y\right) \mapsto \frac{1}{x^{2} + y^{2} + 1}
fV = f.coord_function(XV) fV.display()
(x′,y′)↦x′2+y′2x′2+y′2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\left({x'}, {y'}\right) \mapsto \frac{{x'}^{2} + {y'}^{2}}{{x'}^{2} + {y'}^{2} + 1}

Both fU and fV are instances of the class ChartFunction:

isinstance(fU, sage.manifolds.chart_func.ChartFunction)
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Mathematically, chart functions are real-valued functions on the codomain of the considered chart. They map coordinates to elements of the base field (here R\mathbb{R}):

fU(1,2)
16\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{6}
fU(*XU(p))
16\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{6}

while scalar fields maps manifold points to R\mathbb{R}:

f(p)
16\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{6}

Internally, each chart function stores coordinate expressions with respect to various computational engines:

  • SageMath symbolic engine, based on the Pynac backend, with Maxima used for some simplifications or computation of integrals;

  • SymPy (Python library for symbolic mathematics);

  • in the future, more symbolic engines (e.g. Giac) or numerical ones will be implemented

The coordinate expressions are stored in the dictionary _express, whose keys are strings identifying the computational engines. By default only SageMath symbolic expressions, i.e. expressions pertaining to the so-called Symbolic Ring (SR), are stored:

fU._express
{SR:1x2+y2+1}\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\verb|SR| : \frac{1}{x^{2} + y^{2} + 1}\right\}

The public access to the dictionary _express is performed via the method expr():

fU.expr()
1x2+y2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{x^{2} + y^{2} + 1}
type(fU.expr())
[removed]\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|[removed]|

Actually, fU.expr() is a shortcut for fU.expr('SR') since SR is the default symbolic engine. Note that the class Expression is that devoted to SageMath symbolic expressions. The method expr() can also be invoked to get the expression in another symbolic engine, for instance SymPy:

fU.expr('sympy')
1/(x**2x+xy**2x+x1)\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|1/(x**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|y**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|1)|
type(fU.expr('sympy'))
[removed]\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|[removed]|

This operation has updated the dictionary _express:

fU._express
{SR:1x2+y2+1,sympy:1/(x**2x+xy**2x+x1)}\renewcommand{\Bold}[1]{\mathbf{#1}}\left\{\verb|SR| : \frac{1}{x^{2} + y^{2} + 1}, \verb|sympy| : \verb|1/(x**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|y**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|1)|\right\}

The default calculus engine for chart functions of chart XU can changed thanks to the method set_calculus_method():

XU.set_calculus_method('sympy') fU.expr()
1/(x**2x+xy**2x+x1)\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|1/(x**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|y**2|\phantom{\verb!x!}\verb|+|\phantom{\verb!x!}\verb|1)|

We can have better (i.e. LaTeX) rendering of SymPy objects with

from sympy import init_printing init_printing()

We don't use it here to make clear the distinction between SR objects and SymPy ones.

Reverting to SageMath's symbolic engine:

XU.set_calculus_method('SR') fU.expr()
1x2+y2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{x^{2} + y^{2} + 1}

Symbolic expressions can be accessed directly from the scalar field, f.expr(XU) being a shortcut for f.coord_function(XU).expr():

f.expr(XU)
1x2+y2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{x^{2} + y^{2} + 1}
f.expr(XV)
x′2+y′2x′2+y′2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{{x'}^{2} + {y'}^{2}}{{x'}^{2} + {y'}^{2} + 1}

Algebra of scalar fields

The commutative algebra of scalar fields on MM is

CM = M.scalar_field_algebra() CM
C∞(M)\renewcommand{\Bold}[1]{\mathbf{#1}}C^{\infty}\left(M\right)
CM.category()
CommutativeAlgebrasSR\renewcommand{\Bold}[1]{\mathbf{#1}}\mathbf{CommutativeAlgebras}_{\text{SR}}

As for the manifold classes, the actual Python class implementing C∞(M)C^\infty(M) is inherited from DiffScalarFieldAlgebra via the category mechanism, hence it bares the name DiffScalarFieldAlgebra-with-category:

type(CM)
[removed]\renewcommand{\Bold}[1]{\mathbf{#1}}\verb|[removed]|

The class DiffScalarFieldAlgebra-with-category is dynamically generated as a subclass of DiffScalarFieldAlgebra with extra functionalities, like for instance the method is_commutative():

CM.is_commutative()
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Let us have a look at the code of this method; it suffices to use the double question mark:

CM.is_commutative??

We see from the File field that the code belongs to the category part of SageMath, not to the manifold part, where the class DiffScalarFieldAlgebra is defined.

Regarding the scalar field ff introduced above, we have of course

f in CM
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

Actually, in Sage language, CM=C∞(M)C^\infty(M) is the parent of f:

f.parent() is CM
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}

The zero element of the algebra C∞(M)C^\infty(M) is

CM.zero().display()
0:M⟶Ron U:(x,y)⟼0on V:(x′,y′)⟼0\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} 0:& M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 0 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 0 \end{array}

while its unit element is

CM.one().display()
1:M⟶Ron U:(x,y)⟼1on V:(x′,y′)⟼1\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} 1:& M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 1 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 1 \end{array}

Implementation of algebraic operations on scalar fields

Let us consider some operation in the algebra C∞(M)C^\infty(M):

h = f + 2*CM.one() h.display()
M⟶Ron U:(x,y)⟼2 x2+2 y2+3x2+y2+1on V:(x′,y′)⟼3 x′2+3 y′2+2x′2+y′2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \frac{2 \, x^{2} + 2 \, y^{2} + 3}{x^{2} + y^{2} + 1} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & \frac{3 \, {x'}^{2} + 3 \, {y'}^{2} + 2}{{x'}^{2} + {y'}^{2} + 1} \end{array}
h(p)
136\renewcommand{\Bold}[1]{\mathbf{#1}}\frac{13}{6}

We are going to investigate how the above addition is performed. For the Python interpreter h = f + 2*CM.one() is equivalent to h = f.__add__(2*CM.one()), i.e. the + operator amounts to calling the method __add__() on f. To have a look at the source code of this method, we use the double question mark:

f.__add__??

We see that the method __add__() is implemented at the level of the class Element from which DiffScalarField inherits, via CommutativeAlgebraElement. In the present case, left = f and right = 2*CM.one() have the same parent, namely the algebra CM, so that the actual result is computed in the line

return (<Element>left)._add_(right)

This invokes the method _add_() (note the single underscore on each side of add). This operator is implemented at the level of ScalarField, as it can be checked from the source code:

f._add_??

This reflects a general strategy in SageMath: the arithmetic Python operators __add__, __sub__, etc. are implemented at the top-level class Element, while the specific element subclasses, like ScalarField here, implement single-underscore methods _add_, _sub_, etc., which perform the actual computation when both operands have the same parent.

Looking at the code, we notice that the first step is to search for the charts in which both operands of the addition operator have a coordinate expression. This is performed by the method common_charts(); in the current case, we get the two stereographic charts defined on MM:

f.common_charts(2*CM.one())
[(U,(x,y)),(V,(x′,y′))]\renewcommand{\Bold}[1]{\mathbf{#1}}\left[\left(U,(x, y)\right), \left(V,({x'}, {y'})\right)\right]

In general, common_charts() returns the charts for which both operands have already a known coordinate expression or for which a coordinate expression can be computed by a known transition map, as we can see on the source code:

f.common_charts??

Once the list of charts in which both operands have a coordinate expression, the addition is performed at the chart function level. The code for the addition of chart functions defined on the same chart is (recall that fU is the chart function representing ff in chart XU):

fU._add_??

We notice that the addition is performed on the symbolic expression with respect to the symbolic engine currently at work (SageMath/Pynac, SymPy,...), as returned by the method expr(). Let us recall that the user can change the symbolic engine at any time by means of the method set_calculus_method(), applied either to a chart or to an open subset (possibly M itself). Besides, we notice in the code above that the result of the symbolic addition is automatically simplified, by means of the method _simplify. It invokes a chain of simplification functions, which depends on the symbolic engine (See here for details).

Let us now discuss the second case in the __add__ method of Element, namely the case for which the parents of both operands are different. This case is treated via SageMath coercion model, which allows one to deal with additions like

h1 = f + 2 h1.display()
M⟶Ron U:(x,y)⟼2 x2+2 y2+3x2+y2+1on V:(x′,y′)⟼3 x′2+3 y′2+2x′2+y′2+1\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \frac{2 \, x^{2} + 2 \, y^{2} + 3}{x^{2} + y^{2} + 1} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & \frac{3 \, {x'}^{2} + 3 \, {y'}^{2} + 2}{{x'}^{2} + {y'}^{2} + 1} \end{array}

A priori, f + 2 is not a well defined operation, since the integer 22 does not belong to the algebra C∞(M)C^\infty(M). However SageMath manages to treat it because 22 can be coerced (i.e. automatically and unambigously converted) via CM(2) into a element of C∞(M)C^\infty(M), namely the constant scalar field whose value is 22:

CM(2).display()
M⟶Ron U:(x,y)⟼2on V:(x′,y′)⟼2\renewcommand{\Bold}[1]{\mathbf{#1}}\begin{array}{llcl} & M & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 2 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \end{array}

This happens because there exists a coercion map from the parent of 22, namely the ring of integers Z\mathbb{Z} (denoted ZZ in SageMath), to C∞(M)C^\infty(M):

2.parent()
Z\renewcommand{\Bold}[1]{\mathbf{#1}}\Bold{Z}
CM.has_coerce_map_from(ZZ)
True\renewcommand{\Bold}[1]{\mathbf{#1}}\mathrm{True}