CoCalc Public FilesSageManifolds / Worksheets / JNCF2018 / jncf18_vector.ipynbOpen with one click!
Author: Eric Gourgoulhon
Views : 146
Compute Environment: Ubuntu 18.04 (Deprecated)

Smooth manifolds, vector fields and tensor 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

In [1]:
%display latex

Let us restore the 2-sphere manifold constructed in the preceeding worksheet:

In [2]:
M = Manifold(2, 'M') U = M.open_subset('U') XU.<x,y> = U.chart() V = M.open_subset('V') XV.<xp,yp> = V.chart("xp:x' yp:y'") M.declare_union(U,V) 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) XV_to_XU = XU_to_XV.inverse() M.atlas()
[(U,(x,y)),(V,(x,y)),(W,(x,y)),(W,(x,y))]\left[\left(U,(x, y)\right), \left(V,({x'}, {y'})\right), \left(W,(x, y)\right), \left(W,({x'}, {y'})\right)\right]

We also reconstruct the point pp:

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

and the embedding S2R3\mathbb{S}^2 \to \mathbb{R}^3:

In [4]:
R3 = Manifold(3, 'R^3', r'\mathbb{R}^3') XR3.<X,Y,Z> = R3.chart() 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()
In [5]:
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)

Finally we reconstruct the scalar field ff:

In [6]:
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()

and assign the Python variable CM to the algebra of scalar fields:

In [7]:
CM = M.scalar_field_algebra() CM

Tangent vectors

The tangent space at the point pp introduced above is generated by

In [8]:
Tp = M.tangent_space(p) Tp

It is a vector space over R\mathbb{R}, which is represented by Sage's Symbolic Ring:

In [9]:
Category of finite dimensional vector spaces over Symbolic Ring

The dimension of TpMT_p M is the same as that of MM:

In [10]:

Tangent spaces are implemented as a class inherited from TangentSpace via the category framework:

In [11]:

The class TangentSpace actually inherits from the generic class FiniteRankFreeModule, which, in SageMath, is devoted to free modules of finite rank without any distinguished basis:

In [12]:
isinstance(Tp, FiniteRankFreeModule)

Two bases of TpMT_p M are already available: those generated by the derivations at pp along the coordinates of charts XU and XV respectively:

In [13]:
[(x,y),(x,y)]\left[\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right), \left(\frac{\partial}{\partial {x'} },\frac{\partial}{\partial {y'} }\right)\right]

None of these bases is distinguished, but one if the default one, which simply means that it is the basis to be considered if the basis argument is skipped in some methods:

In [14]:
(x,y)\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right)

A tangent vector is created as an element of the tangent space by the standard SageMath procedure new\_element = parent(...), where ... stands for some material sufficient to construct the element:

In [15]:
vp = Tp((-3, 2), name='v') print(vp)
Tangent vector v at Point p on the 2-dimensional differentiable manifold M

Since the basis is not specified, the pair (3,2)(-3,2) refers to components with respect to the default basis:

In [16]:
v=3x+2yv = -3 \frac{\partial}{\partial x } + 2 \frac{\partial}{\partial y }

We have of course

In [17]:
In [18]:
vp in Tp

As other manifold objects, tangent vectors have some plotting capabilities:

In [19]:
graph += vp.plot(chart=XR3, mapping=Phi, scale=0.5, color='gold') show(graph, viewer='threejs', online=True)