Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

Github repo cloud-examples: https://github.com/sagemath/cloud-examples

Views: 8060
License: MIT
%auto typeset_mode(True, display=False)

Sphere S2\mathbb{S}^2

This worksheet demonstrates a few capabilities of  SageManifolds (version 0.8) on the example of the 2-dimensional sphere.

The whole worksheet file can be downloaded from here.

S2\mathbb{S}^2 as a 2-dimensional differentiable manifold

We start by declaring S2\mathbb{S}^2 as a differentiable manifold of dimension 2 over R\mathbb{R}:

S2 = Manifold(2, 'S^2', latex_name=r'\mathbb{S}^2', start_index=1)

The first argument, 2, is the dimension of the manifold, while the second argument is the symbol used to label the manifold.

The argument start_index sets the index range to be used on the manifold for labelling components w.r.t. a basis or a frame: start_index=1 corresponds to {1,2}\{1,2\}; the default value is start_index=0 and yields to {0,1}\{0,1\}.

print S2
2-dimensional manifold 'S^2'
S2
S2\mathbb{S}^2

The manifold is a Sage Parent object:

isinstance(S2, Parent)
True\mathrm{True}
S2.category()
Sets\mathbf{Sets}

Coordinate charts on S2\mathbb{S}^2

The sphere cannot be covered by a single chart. At least two charts are necessary, for instance the charts associated with the stereographic projections from the North pole and the South pole respectively. Let us introduce the open subsets covered by these two charts: U:=S2{N}, U := \mathbb{S}^2\setminus\{N\},   V:=S2{S}, V := \mathbb{S}^2\setminus\{S\}, where NN is a point of S2\mathbb{S}^2, which we shall call the North pole, and SS is the point of UU of stereographic coordinates (0,0)(0,0), which we call the South pole:

U = S2.open_subset('U') ; print U
open subset 'U' of the 2-dimensional manifold 'S^2'
V = S2.open_subset('V') ; print V
open subset 'V' of the 2-dimensional manifold 'S^2'

We declare that S2=UV\mathbb{S}^2 = U \cup V:

S2.declare_union(U, V)

Then we declare the stereographic chart on UU, denoting by (x,y)(x,y) the coordinates resulting from the stereographic projection from the North pole:

stereoN.<x,y> = U.chart()
stereoN
(U,(x,y))\left(U,(x, y)\right)
y is stereoN[2]
True\mathrm{True}

Similarly, we introduce on VV the coordinates (x,y)(x',y') corresponding to the stereographic projection from the South pole:

stereoS.<xp,yp> = V.chart(r"xp:x' yp:y'")
stereoS
(V,(x,y))\left(V,({x'}, {y'})\right)

At this stage, the user's atlas on the manifold has two charts:

S2.atlas()
[(U,(x,y))\left(U,(x, y)\right), (V,(x,y))\left(V,({x'}, {y'})\right)]

We have to specify the transition map between the charts 'stereoN' = (U,(x,y))(U,(x,y)) and 'stereoS' = (V,(x,y))(V,(x',y')); it is given by the standard inversion formulas:

stereoN_to_S = stereoN.transition_map(stereoS, (x/(x^2+y^2), y/(x^2+y^2)), intersection_name='W', restrictions1= x^2+y^2!=0, restrictions2= xp^2+xp^2!=0)
stereoN_to_S.display()
{x=xx2+y2y=yx2+y2\left\{\begin{array}{lcl} {x'} & = & \frac{x}{x^{2} + y^{2}} \\ {y'} & = & \frac{y}{x^{2} + y^{2}} \end{array}\right.

In the above declaration, 'W' is the name given to the chart-overlap subset: W:=UV, W := U\cap V, the condition x2+y20x^2+y^2 \not=0  defines WW as a subset of UU, and the condition x2+y20x'^2+y'^2\not=0 defines WW as a subset of VV.

The inverse coordinate transformation is computed by means of the method inverse():

stereoS_to_N = stereoN_to_S.inverse() stereoS_to_N.display()
{x=xx2+y2y=yx2+y2\left\{\begin{array}{lcl} x & = & \frac{{x'}}{{x'}^{2} + {y'}^{2}} \\ y & = & \frac{{y'}}{{x'}^{2} + {y'}^{2}} \end{array}\right.

In the present case, the situation is of course perfectly symmetric regarding the coordinates (x,y)(x,y) and (x,y)(x',y').

At this stage, the user's atlas has four charts:

S2.atlas()
[(U,(x,y))\left(U,(x, y)\right), (V,(x,y))\left(V,({x'}, {y'})\right), (W,(x,y))\left(W,(x, y)\right), (W,(x,y))\left(W,({x'}, {y'})\right)]

Let us store W=UVW = U\cap V into a Python variable for future use:

W = U.intersection(V)

Similarly we store the charts (W,(x,y))(W,(x,y)) (the restriction of  (U,(x,y))(U,(x,y)) to WW) and (W,(x,y))(W,(x',y')) (the restriction of (V,(x,y))(V,(x',y')) to WW) into Python variables:

stereoN_W = stereoN.restrict(W) stereoN_W
(W,(x,y))\left(W,(x, y)\right)
stereoS_W = stereoS.restrict(W) stereoS_W
(W,(x,y))\left(W,({x'}, {y'})\right)

We may plot the chart (W,(x,y))(W, (x',y')) in terms of itself, as a grid:

stereoS_W.plot()

More interestingly, let us plot the stereographic chart (x,y)(x',y') in terms of the stereographic chart (x,y)(x,y) on the domain WW where both systems overlap (we split the plot in four parts to avoid the singularity at (x,y)=(0,0)(x',y')=(0,0)):

graphSN1 = stereoS_W.plot(stereoN, ranges={xp:[-6,-0.02], yp:[-6,-0.02]}) graphSN2 = stereoS_W.plot(stereoN, ranges={xp:[-6,-0.02], yp:[0.02,6]}) graphSN3 = stereoS_W.plot(stereoN, ranges={xp:[0.02,6], yp:[-6,-0.02]}) graphSN4 = stereoS_W.plot(stereoN, ranges={xp:[0.02,6], yp:[0.02,6]}) show(graphSN1+graphSN2+graphSN3+graphSN4, xmin=-1.5, xmax=1.5, ymin=-1.5, ymax=1.5)

Spherical coordinates

The standard spherical (or polar) coordinates (θ,ϕ)(\theta,\phi) are defined on the open domain AWS2A\subset W \subset \mathbb{S}^2 that is the complement of the "origin meridian"; since the latter is the half-circle defined by y=0y=0 and x0x\geq 0, we declare:

A = W.open_subset('A', coord_def={stereoN_W: (y!=0, x<0)}) print A
open subset 'A' of the 2-dimensional manifold 'S^2'

The restriction of the stereographic chart from the North pole to AA is

stereoN_A = stereoN_W.restrict(A) stereoN_A
(A,(x,y))\left(A,(x, y)\right)

We then declare the chart (A,(θ,ϕ))(A,(\theta,\phi)) by specifying the intervals (0,π)(0,\pi) and (0,2π)(0,2\pi) spanned by respectively θ\theta and ϕ\phi:

spher.<th,ph> = A.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') ; spher
(A,(θ,ϕ))\left(A,({\theta}, {\phi})\right)

The specification of the spherical coordinates is completed by providing the transition map with the stereographic chart (A,(x,y))(A,(x,y)):

spher_to_stereoN = spher.transition_map(stereoN_A, (sin(th)*cos(ph)/(1-cos(th)), sin(th)*sin(ph)/(1-cos(th))) ) spher_to_stereoN.display()
{x=cos(ϕ)sin(θ)cos(θ)1y=sin(ϕ)sin(θ)cos(θ)1\left\{\begin{array}{lcl} x & = & -\frac{\cos\left({\phi}\right) \sin\left({\theta}\right)}{\cos\left({\theta}\right) - 1} \\ y & = & -\frac{\sin\left({\phi}\right) \sin\left({\theta}\right)}{\cos\left({\theta}\right) - 1} \end{array}\right.

We also provide the inverse transition map:

spher_to_stereoN.set_inverse(2*atan(1/sqrt(x^2+y^2)), atan2(-y,-x)+pi)
Check of the inverse coordinate transformation: th == 2*arctan(sqrt(-cos(th) + 1)/sqrt(cos(th) + 1)) ph == pi + arctan2(sin(ph)*sin(th)/(cos(th) - 1), cos(ph)*sin(th)/(cos(th) - 1)) x == x y == y

The check is passed, up to some lack of simplification in the functions atan and atan2.


The user atlas of S2\mathbb{S}^2 is now

S2.atlas()
[(U,(x,y))\left(U,(x, y)\right), (V,(x,y))\left(V,({x'}, {y'})\right), (W,(x,y))\left(W,(x, y)\right), (W,(x,y))\left(W,({x'}, {y'})\right), (A,(x,y))\left(A,(x, y)\right), (A,(θ,ϕ))\left(A,({\theta}, {\phi})\right)]

Let us draw the grid of spherical coordinates (θ,ϕ)(\theta,\phi) in terms of stereographic coordinates from the North pole (x,y)(x,y):

spher.plot(stereoN, nb_values=15, ranges={th: (pi/8,pi)})

Conversly, we may represent the grid of the stereographic coordinates (x,y)(x,y) restricted to AA in terms of the spherical coordinates (θ,ϕ)(\theta,\phi). We limit ourselves to one quarter (cf. the argument ranges):

stereoN_A.plot(spher, ranges={x: (0.01,8), y: (0.01,8)}, nb_values=20, plot_points=200)

Points on S2\mathbb{S}^2

We declare the North pole (resp. the South pole) as the point of coordinates (0,0)(0,0) in the chart (V,(x,y))(V,(x',y')) (resp. in the chart (U,(x,y))(U,(x,y))):

N = V.point((0,0), chart=stereoS, name='N') ; print N S = U.point((0,0), chart=stereoN, name='S') ; print S
point 'N' on 2-dimensional manifold 'S^2' point 'S' on 2-dimensional manifold 'S^2'

Since points are Sage Element's, the corresponding (facade) Parent being the manifold subsets, an equivalent writing of the above declarations is

N = V((0,0), chart=stereoS, name='N') ; print N S = U((0,0), chart=stereoN, name='S') ; print S
point 'N' on 2-dimensional manifold 'S^2' point 'S' on 2-dimensional manifold 'S^2'

Moreover, since stereoS in the default chart on VV and stereoN is the default one on UU, their mentions can be omitted, so that the above can be shortened to

N = V((0,0), name='N') ; print N S = U((0,0), name='S') ; print S
point 'N' on 2-dimensional manifold 'S^2' point 'S' on 2-dimensional manifold 'S^2'
N.parent()
S2\mathbb{S}^2
S.parent()
S2\mathbb{S}^2

We have of course

N in V
True\mathrm{True}
N in S2
True\mathrm{True}
N in U
False\mathrm{False}
N in A
False\mathrm{False}

Let us introduce some point at the equator:

E = S2((0,1), chart=stereoN, name='E')

The point EE is in the open subset AA:

E in A
True\mathrm{True}

We may then ask for its spherical coordinates (θ,ϕ)(\theta,\phi):

E.coord(spher)
(12π\frac{1}{2} \, \pi, 12π\frac{1}{2} \, \pi)

which is not possible for the point NN:

N.coord(spher)
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/point.py", line 341, in coord "of " + str(chart)) ValueError: The point does not belong to the domain of chart (A, (th, ph))

Mappings between manifolds: the embedding of S2\mathbb{S}^2 into R3\mathbb{R}^3

Let us first declare R3\mathbb{R}^3 as a 3-dimensional manifold covered by a single chart (the so-called Cartesian coordinates):

R3 = Manifold(3, 'R^3', r'\mathbb{R}^3', start_index=1) cart.<X,Y,Z> = R3.chart() ; cart
(R3,(X,Y,Z))\left(\mathbb{R}^3,(X, Y, Z)\right)

The embedding of the sphere is defined as a differential mapping Φ:S2R3\Phi: \mathbb{S}^2 \rightarrow \mathbb{R}^3:

Phi = S2.diff_mapping(R3, {(stereoN, cart): [2*x/(1+x^2+y^2), 2*y/(1+x^2+y^2), (x^2+y^2-1)/(1+x^2+y^2)], (stereoS, cart): [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()
Φ:S2R3on U:(x,y)(X,Y,Z)=(2xx2+y2+1,2yx2+y2+1,x2+y21x2+y2+1)on V:(x,y)(X,Y,Z)=(2xx2+y2+1,2yx2+y2+1,x2+y21x2+y2+1)\begin{array}{llcl} \Phi:& \mathbb{S}^2 & \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}
Phi.parent()
Hom(S2,R3)\mathrm{Hom}\left(\mathbb{S}^2,\mathbb{R}^3\right)
print Phi.parent()
Set of Morphisms from 2-dimensional manifold 'S^2' to 3-dimensional manifold 'R^3' in Category of sets
Phi.parent() is Hom(S2, R3)
True\mathrm{True}

Φ\Phi maps points of S2\mathbb{S}^2 to points of R3\mathbb{R}^3:

N1 = Phi(N) ; print N1 ; N1 ; N1.coord()
point 'Phi(N)' on 3-dimensional manifold 'R^3'
Φ(N)\Phi\left(N\right)
(00, 00, 11)
S1 = Phi(S) ; print S1 ; S1 ; S1.coord()
point 'Phi(S)' on 3-dimensional manifold 'R^3'
Φ(S)\Phi\left(S\right)
(00, 00, 1-1)
E1 = Phi(E) ; print E1 ; E1 ; E1.coord()
point 'Phi(E)' on 3-dimensional manifold 'R^3'
Φ(E)\Phi\left(E\right)
(00, 11, 00)

Φ\Phi has been defined in terms of the stereographic charts (U,(x,y))(U,(x,y)) and (V,(x,y))(V,(x',y')), but we may ask its expression in terms of spherical coordinates. The latter is then computed by means of the transition map (A,(x,y))(A,(θ,ϕ))(A,(x,y))\rightarrow (A,(\theta,\phi)):

Phi.expr(stereoN_A, cart)
(2xx2+y2+1\frac{2 \, x}{x^{2} + y^{2} + 1}, 2yx2+y2+1\frac{2 \, y}{x^{2} + y^{2} + 1}, x2+y21x2+y2+1\frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1})
Phi.expr(spher, cart)
(cos(ϕ)sin(θ)\cos\left({\phi}\right) \sin\left({\theta}\right), sin(ϕ)sin(θ)\sin\left({\phi}\right) \sin\left({\theta}\right), cos(θ)\cos\left({\theta}\right))
Phi.display(spher, cart)
Φ:S2R3on A:(θ,ϕ)(X,Y,Z)=(cos(ϕ)sin(θ),sin(ϕ)sin(θ),cos(θ))\begin{array}{llcl} \Phi:& \mathbb{S}^2 & \longrightarrow & \mathbb{R}^3 \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & \left(X, Y, Z\right) = \left(\cos\left({\phi}\right) \sin\left({\theta}\right), \sin\left({\phi}\right) \sin\left({\theta}\right), \cos\left({\theta}\right)\right) \end{array}

Let us use Φ\Phi to draw the grid of spherical coordinates (θ,ϕ)(\theta,\phi) in terms of the Cartesian coordinates (X,Y,Z)(X,Y,Z) of R3\mathbb{R}^3:

graph_spher = spher.plot(chart=cart, mapping=Phi, nb_values=11, color='blue') show(graph_spher)
3D rendering not yet implemented

For future use, let us store a version without any label on the axes:

graph_spher = spher.plot(chart=cart, mapping=Phi, nb_values=11, color='blue', label_axes=False)

We may also use the embedding Φ\Phi to display the stereographic coordinate grid in terms of the Cartesian coordinates in R3\mathbb{R}^3. First for the stereographic coordinates from the North pole:

graph_stereoN = stereoN.plot(chart=cart, mapping=Phi, nb_values=25) show(graph_stereoN)
3D rendering not yet implemented

and then have a view with the stereographic coordinates from the South pole superposed (in green):

graph_stereoS = stereoS.plot(chart=cart, mapping=Phi, nb_values=25, color='green') show(graph_stereoN + graph_stereoS)
3D rendering not yet implemented

We may also add the two poles to the graphic:

pointN = N.plot(chart=cart, mapping=Phi, color='red', label_offset=0.05) pointS = S.plot(chart=cart, mapping=Phi, color='green', label_offset=0.05) show(graph_stereoN + graph_stereoS + pointN + pointS)
3D rendering not yet implemented

Tangent spaces

The tangent space to the manifold S2\mathbb{S}^2 at the point NN is

T_N = N.tangent_space() print T_N ; T_N
tangent space at point 'N' on 2-dimensional manifold 'S^2'
TNS2T_{N}\,\mathbb{S}^2

TNS2T_N \mathbb{S}^2 is a vector space over R\mathbb{R} (represented here by Sage's symbolic ring SR):

T_N.category()
VectorSpacesSR\mathbf{VectorSpaces}_{\text{SR}}

Its dimension equals the manifold's dimension:

dim(T_N)
22
dim(T_N) == dim(S2)
True\mathrm{True}

TNS2T_N \mathbb{S}^2 is endowed with a basis inherited from the coordinate frame defined around NN, namely the frame associated with the chart (V,(x,y))(V,(x',y')):

T_N.bases()
[(x,y)\left(\frac{\partial}{\partial {x'} },\frac{\partial}{\partial {y'} }\right)]

(V,(x,y))(V,(x',y')) is the only chart defined so far around the point NN. If various charts have been defined around a point, then the tangent space at this point is automatically endowed with the bases inherited from the coordinate frames associated to all these charts. For instance, for the equator point EE:

T_E = E.tangent_space() print T_E ; T_E
tangent space at point 'E' on 2-dimensional manifold 'S^2'
TES2T_{E}\,\mathbb{S}^2
T_E.bases()
[(x,y)\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right), (x,y)\left(\frac{\partial}{\partial {x'} },\frac{\partial}{\partial {y'} }\right), (θ,ϕ)\left(\frac{\partial}{\partial {\theta} },\frac{\partial}{\partial {\phi} }\right)]
T_E.default_basis()
(x,y)\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right)

An element of TES2T_E\mathbb{S}^2:

v = T_E((-3, 2), name='v') print v
tangent vector v at point 'E' on 2-dimensional manifold 'S^2'
v in T_E
True\mathrm{True}
v.parent()
TES2T_{E}\,\mathbb{S}^2
v.display()
v=3x+2yv = -3 \frac{\partial}{\partial x } + 2 \frac{\partial}{\partial y }
v.display(T_E.bases()[1])
v=3x2yv = -3 \frac{\partial}{\partial {x'} } -2 \frac{\partial}{\partial {y'} }
v.display(T_E.bases()[2])
v=2θ+3ϕv = -2 \frac{\partial}{\partial {\theta} } + 3 \frac{\partial}{\partial {\phi} }

Differential of a smooth mapping

The differential of the mapping Φ\Phi at the point EE is

dPhi_E = Phi.differential(E) print dPhi_E ; dPhi_E
Generic morphism: From: tangent space at point 'E' on 2-dimensional manifold 'S^2' To: tangent space at point 'Phi(E)' on 3-dimensional manifold 'R^3'
dΦE\mathrm{d}\Phi_{E}
dPhi_E.domain()
TES2T_{E}\,\mathbb{S}^2
dPhi_E.codomain()
TΦ(E)R3T_{\Phi\left(E\right)}\,\mathbb{R}^3
dPhi_E.parent()
Hom(TES2,TΦ(E)R3)\mathrm{Hom}\left(T_{E}\,\mathbb{S}^2,T_{\Phi\left(E\right)}\,\mathbb{R}^3\right)

The image by dΦE\mathrm{d}\Phi_E of the vector vTES2v\in T_E\mathbb{S}^2 introduced above is

dPhi_E(v)
dΦE(v)\mathrm{d}\Phi_{E}\left(v\right)
print dPhi_E(v)
tangent vector dPhi_E(v) at point 'Phi(E)' on 3-dimensional manifold 'R^3'
dPhi_E(v) in Phi(E).tangent_space()
True\mathrm{True}
dPhi_E(v).display()
dΦE(v)=3X+2Z\mathrm{d}\Phi_{E}\left(v\right) = -3 \frac{\partial}{\partial X } + 2 \frac{\partial}{\partial Z }

Algebra of scalar fields

The set C(S2)C^\infty(\mathbb{S}^2) of all smooth functions S2R\mathbb{S}^2\rightarrow \mathbb{R} has naturally the structure of a commutative algebra over R\mathbb{R}. C(S2)C^\infty(\mathbb{S}^2) is obtained via the method scalar_field_algebra() applied to the manifold S2\mathbb{S}^2:

CS = S2.scalar_field_algebra() ; CS
C(S2)C^\infty(\mathbb{S}^2)

Since the algebra internal product is the pointwise multiplication, it is clearly commutative, so that C(S2)C^\infty(\mathbb{S}^2) belongs to Sage's category of commutative algebras:

CS.category()
CommutativeAlgebrasSR\mathbf{CommutativeAlgebras}_{\text{SR}}

The base ring of the algebra C(S2)C^\infty(\mathbb{S}^2) is the field R\mathbb{R}, which is represented here by Sage's Symbolic Ring (SR):

CS.base_ring()
SR\text{SR}

Elements of C(S2)C^\infty(\mathbb{S}^2) are of course (smooth) scalar fields:

print CS.an_element()
scalar field on the 2-dimensional manifold 'S^2'

This example element is the constant scalar field that takes the value 2:

CS.an_element().display()
S2Ron U:(x,y)2on V:(x,y)2on A:(θ,ϕ)2\begin{array}{llcl} & \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 2 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & 2 \end{array}

A specific element is the zero one:

f = CS.zero() print f
scalar field 'zero' on the 2-dimensional manifold 'S^2'

Scalar fields map points of S2\mathbb{S}^2 to real numbers:

f(N), f(E), f(S)
(00, 00, 00)
f.display()
0:S2Ron U:(x,y)0on V:(x,y)0on A:(θ,ϕ)0\begin{array}{llcl} 0:& \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 0 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 0 \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & 0 \end{array}

Another specific element is the algebra unit element, i.e. the constant scalar field 1:

f = CS.one() print f
scalar field on the 2-dimensional manifold 'S^2'
f(N), f(E), f(S)
(11, 11, 11)
f.display()
S2Ron U:(x,y)1on V:(x,y)1on A:(θ,ϕ)1\begin{array}{llcl} & \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 1 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 1 \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & 1 \end{array}

Let us define a scalar field by its coordinate expression in the two stereographic charts:

f = CS({stereoN: pi - 2*atan(x^2+y^2), stereoS: 2*atan(xp^2+yp^2)}) f.display()
S2Ron U:(x,y)π2arctan(x2+y2)on V:(x,y)2arctan(x2+y2)on A:(θ,ϕ)π+2arctan(cos(θ)+1cos(θ)1)\begin{array}{llcl} & \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \pi - 2 \, \arctan\left(x^{2} + y^{2}\right) \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & \pi + 2 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right) \end{array}

Instead of using CS() (i.e. the Parent __call__ function), we may invoke the scalar_field method on the manifold to create ff; this allows to pass the name of the scalar field:

f = S2.scalar_field({stereoN: pi - 2*atan(x^2+y^2), stereoS: 2*atan(xp^2+yp^2)}, name='f') f.display()
f:S2Ron U:(x,y)π2arctan(x2+y2)on V:(x,y)2arctan(x2+y2)on A:(θ,ϕ)π+2arctan(cos(θ)+1cos(θ)1)\begin{array}{llcl} f:& \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \pi - 2 \, \arctan\left(x^{2} + y^{2}\right) \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & \pi + 2 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right) \end{array}
f.parent()
C(S2)C^\infty(\mathbb{S}^2)

Internally, the various coordinate expressions of the scalar field are stored in the dictionary _express, whose keys are the charts:

f._express
{(A,(x,y)):π2arctan(x2+y2),(A,(θ,ϕ)):π+2arctan(cos(θ)+1cos(θ)1),(U,(x,y)):π2arctan(x2+y2),(V,(x,y)):2arctan(x2+y2)}\left\{\left(A,(x, y)\right) : \pi - 2 \, \arctan\left(x^{2} + y^{2}\right), \left(A,({\theta}, {\phi})\right) : \pi + 2 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right), \left(U,(x, y)\right) : \pi - 2 \, \arctan\left(x^{2} + y^{2}\right), \left(V,({x'}, {y'})\right) : 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right)\right\}

The expression in a specific chart is recovered by passing the chart as the argument of the method display():

f.display(stereoS)
f:S2Ron V:(x,y)2arctan(x2+y2)\begin{array}{llcl} f:& \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \end{array}

Scalar fields map the manifold's points to real numbers:

f(N)
00
f(E)
12π\frac{1}{2} \, \pi
f(S)
π\pi

We may define the restrictions of ff to the open subsets UU and VV:

fU = f.restrict(U) fU.display()
f:UR(x,y)π2arctan(x2+y2)on W:(x,y)2arctan(x2+y2)on A:(θ,ϕ)π+2arctan(cos(θ)+1cos(θ)1)\begin{array}{llcl} f:& U & \longrightarrow & \mathbb{R} \\ & \left(x, y\right) & \longmapsto & \pi - 2 \, \arctan\left(x^{2} + y^{2}\right) \\ \mbox{on}\ W : & \left({x'}, {y'}\right) & \longmapsto & 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & \pi + 2 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right) \end{array}
fV = f.restrict(V) fV.display()
f:VR(x,y)2arctan(x2+y2)on W:(x,y)π2arctan(x2+y2)on A:(θ,ϕ)π+2arctan(cos(θ)+1cos(θ)1)\begin{array}{llcl} f:& V & \longrightarrow & \mathbb{R} \\ & \left({x'}, {y'}\right) & \longmapsto & 2 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \\ \mbox{on}\ W : & \left(x, y\right) & \longmapsto & \pi - 2 \, \arctan\left(x^{2} + y^{2}\right) \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & \pi + 2 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right) \end{array}
fU(E), fU(S)
(12π\frac{1}{2} \, \pi, π\pi)
fU.parent()
C(U)C^\infty(U)
fV.parent()
C(V)C^\infty(V)
CU = U.scalar_field_algebra() fU.parent() is CU
True\mathrm{True}

A scalar field on S2\mathbb{S}^2 can be coerced to a scalar field on UU, the coercion being simply the restriction:

CU.has_coerce_map_from(CS)
True\mathrm{True}
fU == CU(f)
True\mathrm{True}

The arithmetic of scalar fields:

g = f*f - 2*f g.display()
S2Ron U:(x,y)2π+π24(π1)arctan(x2+y2)+4arctan(x2+y2)2on V:(x,y)4arctan(x2+y2)24arctan(x2+y2)on A:(θ,ϕ)2π+π2+4(π1)arctan(cos(θ)+1cos(θ)1)+4arctan(cos(θ)+1cos(θ)1)2\begin{array}{llcl} & \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & -2 \, \pi + \pi^{2} - 4 \, {\left(\pi - 1\right)} \arctan\left(x^{2} + y^{2}\right) + 4 \, \arctan\left(x^{2} + y^{2}\right)^{2} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 4 \, \arctan\left({x'}^{2} + {y'}^{2}\right)^{2} - 4 \, \arctan\left({x'}^{2} + {y'}^{2}\right) \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & -2 \, \pi + \pi^{2} + 4 \, {\left(\pi - 1\right)} \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right) + 4 \, \arctan\left(\frac{\cos\left({\theta}\right) + 1}{\cos\left({\theta}\right) - 1}\right)^{2} \end{array}

Module of vector fields

The set X(S2)\mathcal{X}(\mathbb{S}^2) of all smooth vector fields on S2\mathbb{S}^2 is a module over the algebra (ring) C(S2)C^\infty(\mathbb{S}^2). It is obtained by the method vector_field_module():

XS = S2.vector_field_module() XS
X(S2)\mathcal{X}\left(\mathbb{S}^2\right)
print XS
module X(S^2) of vector fields on the 2-dimensional manifold 'S^2'
XS.base_ring()
C(S2)C^\infty(\mathbb{S}^2)
XS.category()
ModulesC(S2)\mathbf{Modules}_{C^\infty(\mathbb{S}^2)}

X(S2)\mathcal{X}(\mathbb{S}^2) is not a free module:

isinstance(XS, FiniteRankFreeModule)
False\mathrm{False}

because S2\mathbb{S}^2 is not a parallelizable manifold:

S2.is_manifestly_parallelizable()
False\mathrm{False}

On the contrary, the set X(U)\mathcal{X}(U) of smooth vector fields on UU is a free module:

XU = U.vector_field_module() isinstance(XU, FiniteRankFreeModule)
True\mathrm{True}

because UU is parallelizable:

U.is_manifestly_parallelizable()
True\mathrm{True}

Due to the introduction of the stereographic coordinates (x,y)(x,y) on UU, a basis has already been defined on the free module X(U)\mathcal{X}(U), namely the coordinate basis (/x,/y)(\partial/\partial x, \partial/\partial y):

XU.print_bases()
Bases defined on the free module X(U) of vector fields on the open subset 'U' of the 2-dimensional manifold 'S^2': - (U, (d/dx,d/dy)) (default basis)
XU.default_basis()
(U,(x,y))\left(U ,\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right)\right)

Similarly

XV = V.vector_field_module() XV.default_basis()
(V,(x,y))\left(V ,\left(\frac{\partial}{\partial {x'} },\frac{\partial}{\partial {y'} }\right)\right)
eU = XU.default_basis() eV = XV.default_basis()

From the point of view of the open set UU, eU is also the default vector frame:

eU is U.default_frame()
True\mathrm{True}

It is also the default vector frame on S2\mathbb{S}^2 (although not defined on the whole S2\mathbb{S}^2), for it is the first vector frame defined on an open subset of S2\mathbb{S}^2:

eU is S2.default_frame()
True\mathrm{True}
eV is V.default_frame()
True\mathrm{True}

Let us introduce a vector field on S2\mathbb{S}^2:

v = S2.vector_field(name='v') v[eU,:] = [1, -2] v.display(eU)
v=x2yv = \frac{\partial}{\partial x } -2 \frac{\partial}{\partial y }
v.parent()
X(S2)\mathcal{X}\left(\mathbb{S}^2\right)
stereoSW = stereoS.restrict(W) eSW = stereoSW.frame() eSW
(W,(x,y))\left(W ,\left(\frac{\partial}{\partial {x'} },\frac{\partial}{\partial {y'} }\right)\right)
vW = v.restrict(W) vW.display()
v=x2yv = \frac{\partial}{\partial x } -2 \frac{\partial}{\partial y }
vW.parent()
X(W)\mathcal{X}\left(W\right)
print vW.parent()
free module X(W) of vector fields on the open subset 'W' of the 2-dimensional manifold 'S^2'
vW.display(eSW)
v=(x24xyy2x4+2x2y2+y4)x+(2(x2+xyy2)x4+2x2y2+y4)yv = \left( -\frac{x^{2} - 4 \, x y - y^{2}}{x^{4} + 2 \, x^{2} y^{2} + y^{4}} \right) \frac{\partial}{\partial {x'} } + \left( -\frac{2 \, {\left(x^{2} + x y - y^{2}\right)}}{x^{4} + 2 \, x^{2} y^{2} + y^{4}} \right) \frac{\partial}{\partial {y'} }
vW.display(eSW, stereoSW)
v=(x2+4xy+y2)x+(2x22xy+2y2)yv = \left( -{x'}^{2} + 4 \, {x'} {y'} + {y'}^{2} \right) \frac{\partial}{\partial {x'} } + \left( -2 \, {x'}^{2} - 2 \, {x'} {y'} + 2 \, {y'}^{2} \right) \frac{\partial}{\partial {y'} }

We extend the definition of vv to VV thanks to the above expression:

v.add_comp_by_continuation(eV, W, chart=stereoS)
v.display(eV)
v=(x2+4xy+y2)x+(2x22xy+2y2)yv = \left( -{x'}^{2} + 4 \, {x'} {y'} + {y'}^{2} \right) \frac{\partial}{\partial {x'} } + \left( -2 \, {x'}^{2} - 2 \, {x'} {y'} + 2 \, {y'}^{2} \right) \frac{\partial}{\partial {y'} }

At this stage, the vector field vv is defined on the whole manifold S2\mathbb{S}^2; it has expressions in each of the two frames eU and eV which cover S2\mathbb{S}^2:

print v v.display(eU)
vector field 'v' on the 2-dimensional manifold 'S^2'
v=x2yv = \frac{\partial}{\partial x } -2 \frac{\partial}{\partial y }
v.display(eV)
v=(x2+4xy+y2)x+(2x22xy+2y2)yv = \left( -{x'}^{2} + 4 \, {x'} {y'} + {y'}^{2} \right) \frac{\partial}{\partial {x'} } + \left( -2 \, {x'}^{2} - 2 \, {x'} {y'} + 2 \, {y'}^{2} \right) \frac{\partial}{\partial {y'} }

According to the hairy ball theorem, vv has to vanish somewhere. This occurs at the North pole:

vN = v.at(N) print vN
tangent vector v at point 'N' on 2-dimensional manifold 'S^2'
vN.display()
v=0v = 0

vNv|_N is the zero vector of the tangent vector space TNS2T_N\mathbb{S}^2:

vN.parent()
TNS2T_{N}\,\mathbb{S}^2
vN.parent() is N.tangent_space()
True\mathrm{True}
vN == N.tangent_space().zero()
True\mathrm{True}

On the contrary, vv is non-zero at the South pole:

vS = v.at(S) print vS
tangent vector v at point 'S' on 2-dimensional manifold 'S^2'
vS.display()
v=x2yv = \frac{\partial}{\partial x } -2 \frac{\partial}{\partial y }
vS.parent()
TSS2T_{S}\,\mathbb{S}^2
vS.parent() is S.tangent_space()
True\mathrm{True}
vS != S.tangent_space().zero()
True\mathrm{True}

Let us plot the vector field vv is terms of the stereographic chart (U,(x,y))(U,(x,y)), with the South pole SS superposed:

v.plot(chart=stereoN, chart_domain=stereoN, max_value=4, nb_values=5, scale=0.5, aspect_ratio=1) + \ S.plot(stereoN, size=30, label_offset=0.2)

The vector field appears homogeneous because its components w.r.t. the frame (x,y)\left(\frac{\partial}{\partial x}, \frac{\partial}{\partial y}\right) are constant:

v.display(stereoN.frame())

On the contrary, once drawn in terms of the stereographic chart (V,(x,y))(V, (x',y')), vv does no longer appears homogeneous:

v.plot(chart=stereoS, chart_domain=stereoS, max_value=4, scale=0.02, aspect_ratio=1) + \ N.plot(chart=stereoS, size=30, label_offset=0.2)

Finally, a 3D view of the vector field vv is obtained via the embedding Φ\Phi:

graph_v = v.plot(chart=cart, mapping=Phi, chart_domain=spher, nb_values=11, scale=0.2) show(graph_v + graph_spher, aspect_ratio=1)
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/vectorfield.py", line 528, in plot **extra_options) File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/tangentspace.py", line 284, in plot eff_vector = mapping.differential(self._point)._call_(self) File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/tensor/modules/free_module_morphism.py", line 882, in _call_ "of {} by {}".format(element,self)) ValueError: no common basis found to evaluate the image of tangent vector v at point on 2-dimensional manifold 'S^2' by Generic morphism: From: tangent space at point on 2-dimensional manifold 'S^2' To: tangent space at point on 3-dimensional manifold 'R^3'

Similarly, let us draw the first vector field of the stereographic frame from the North pole, namely x\frac{\partial}{\partial x}:

ex = stereoN.frame()[1] ex
graph_ex = ex.plot(chart=cart, mapping=Phi, chart_domain=spher, nb_values=11, scale=0.4, width=1) show(graph_ex + graph_spher, aspect_ratio=1)
Error in lines 1-2 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'ex' is not defined

For the second vector field of the stereographic frame from the North pole, namely y\frac{\partial}{\partial y}, we get

ey = stereoN.frame()[2] ey
graph_ey = ey.plot(chart=cart, mapping=Phi, chart_domain=spher, nb_values=11, scale=0.4, width=1, color='red', label_axes=False) show(graph_ey + graph_spher, aspect_ratio=1)

We may superpose the two graphs, to get a 3D view of the frame associated with the stereographic coordinates from the North pole:

show(graph_ex + graph_ey + graph_spher + N.plot(cart, mapping=Phi, label_offset=0.05) + S.plot(cart, mapping=Phi, label_offset=0.05), aspect_ratio=1)
Error in lines 1-4 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 2, in <module> NameError: name 'graph_ex' is not defined

A Tachyon view of the same frame:

show(graph_ex + graph_ey + graph_spher + N.plot(cart, mapping=Phi, label_offset=0.05, size=5) + S.plot(cart, mapping=Phi, label_offset=0.05, size=5) + sphere(opacity=0.5), aspect_ratio=1, viewer='tachyon', figsize=10)

Vector fields acting on scalar fields

vv and ff are both fields defined on the whole sphere (respectively a vector field and a scalar field). By the very definition of a vector field, vv acts on ff:

vf = v(f) print vf vf.display()

Values of v(f)v(f) at the North pole, at the equator point EE and at the South pole:

vf(N)
vf(E)
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'vf' is not defined
vf(S)

1-forms

A 1-form on S2\mathbb{S}^2 is a field of linear forms on the tangent spaces. For instance it can the differential of a scalar field:

df = f.differential() ; print df
df.display()
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'df' is not defined
print df.parent()
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'df' is not defined
df.parent()
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'df' is not defined

The 1-form acting on a vector field:

print df(v) ; df(v).display()
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'df' is not defined

Let us check the identity df(v)=v(f)\mathrm{d}f(v) = v(f):

df(v) == v(f)
Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> NameError: name 'df' is not defined

Similarly, we have Lvf=v(f)\mathcal{L}_v f = v(f):

f.lie_der(v) == v(f)
True\mathrm{True}

Curves in S2\mathbb{S}^2

In order to define curves in S2\mathbb{S}^2, we first introduce the field of real numbers R\mathbb{R} as a 1-dimensional smooth manifold with a canonical coordinate chart:

R.<t> = RealLine() ; print R
field R of real numbers
isinstance(R, Manifold)
True\mathrm{True}
dim(R)
11
R.atlas()
[(R,(t))\left(\RR,(t)\right)]

Let us define a loxodrome of the sphere in terms of its parametric equation with respect to the chart spher = (A,(θ,ϕ))(A,(\theta,\phi))

c = S2.curve({spher: [2*atan(exp(-t/10)), t]}, (t, -oo, +oo), name='c')

Curves in S2\mathbb{S}^2 are considered as morphisms from the manifold R\mathbb{R} to the manifold S2\mathbb{S}^2:

c.parent()
Hom(R,S2)\mathrm{Hom}\left(\RR,\mathbb{S}^2\right)
c.display()
c:RS2t(x,y)=(cos(t)e(110t),e(110t)sin(t))t(θ,ϕ)=(2arctan(e(110t)),t)\begin{array}{llcl} c:& \RR & \longrightarrow & \mathbb{S}^2 \\ & t & \longmapsto & \left(x, y\right) = \left(\cos\left(t\right) e^{\left(\frac{1}{10} \, t\right)}, e^{\left(\frac{1}{10} \, t\right)} \sin\left(t\right)\right) \\ & t & \longmapsto & \left({\theta}, {\phi}\right) = \left(2 \, \arctan\left(e^{\left(-\frac{1}{10} \, t\right)}\right), t\right) \end{array}

The curve cc can be plotted in terms of stereographic coordinates (x,y)(x,y):

c.plot(chart=stereoN, aspect_ratio=1)

We recover the well-known fact that the graph of a loxodrome in terms of stereographic coordinates is a logarithmic spiral.

Thanks to the embedding Φ\Phi, we may also plot cc in terms of the Cartesian coordinates of R3\mathbb{R}^3:

graph_c = c.plot(mapping=Phi, max_value=40, plot_points=200, thickness=2) show(graph_spher + graph_c)
3D rendering not yet implemented

The tangent vector field (or velocity vector) to the curve cc is

vc = c.tangent_vector_field() vc
c{c'}

cc' is a vector field along R\mathbb{R} taking its values in tangent spaces to S2\mathbb{S}^2:

print vc
vector field 'c'' along the field R of real numbers with values on the 2-dimensional manifold 'S^2'

The set of vector fields along R\mathbb{R} taking their values on S2\mathbb{S}^2 via the differential mapping c:RS2c: \mathbb{R} \rightarrow \mathbb{S}^2 is denoted by X(R,c)\mathcal{X}(\mathbb{R},c); it is a module over the algebra C(R)C^\infty(\mathbb{R}):

vc.parent()
X(R,c)\mathcal{X}\left(\RR,c\right)
vc.parent().category()
ModulesC(R)\mathbf{Modules}_{C^\infty(\RR)}
vc.parent().base_ring()
C(R)C^\infty(\RR)

A coordinate view of cc':

vc.display()
c=(110cos(t)e(110t)e(110t)sin(t))x+(cos(t)e(110t)+110e(110t)sin(t))y{c'} = \left( \frac{1}{10} \, \cos\left(t\right) e^{\left(\frac{1}{10} \, t\right)} - e^{\left(\frac{1}{10} \, t\right)} \sin\left(t\right) \right) \frac{\partial}{\partial x } + \left( \cos\left(t\right) e^{\left(\frac{1}{10} \, t\right)} + \frac{1}{10} \, e^{\left(\frac{1}{10} \, t\right)} \sin\left(t\right) \right) \frac{\partial}{\partial y }

Let us plot the vector field cc' in terms of the stereographic chart (U,(x,y))(U,(x,y)):

show(vc.plot(chart=stereoN, nb_values=30, scale=0.5, color='red') + c.plot(chart=stereoN), aspect_ratio=1)

A 3D view of cc' is obtained via the embedding Φ\Phi:

graph_vc = vc.plot(chart=cart, mapping=Phi, ranges={t: (-20, 20)}, nb_values=30, scale=0.5, color='red', label_axes=False) show(graph_vc + graph_spher + graph_c, aspect_ratio=1)
Error in lines 1-2 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 2, in <module> File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/vectorfield.py", line 528, in plot **extra_options) File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/tangentspace.py", line 284, in plot eff_vector = mapping.differential(self._point)._call_(self) File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/tensor/modules/free_module_morphism.py", line 882, in _call_ "of {} by {}".format(element,self)) ValueError: no common basis found to evaluate the image of tangent vector c' at point on 2-dimensional manifold 'S^2' by Generic morphism: From: tangent space at point on 2-dimensional manifold 'S^2' To: tangent space at point on 3-dimensional manifold 'R^3' Error in lines 1-2 Traceback (most recent call last): File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 905, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 2, in <module> File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/vectorfield.py", line 528, in plot **extra_options) File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/geometry/manifolds/tangentspace.py", line 308, in plot vcomp = eff_vector.comp(basis=basis)[:] File "/projects/sage/sage-6.9/local/lib/python2.7/site-packages/sage/tensor/modules/free_module_tensor.py", line 1050, in components "the components in the {}".format(basis)) ValueError: no basis could be found for computing the components in the Basis (d/dX,d/dY,d/dZ) on the tangent space at point on 3-dimensional manifold 'R^3'

Riemannian metric on S2\mathbb{S}^2

The standard metric on S2\mathbb{S}^2 is that induced by the Euclidean metric of R3\mathbb{R}^3. Let us start by defining the latter:

h = R3.riemann_metric('h') h[1,1], h[2,2], h[3, 3] = 1, 1, 1 h.display()
h=dXdX+dYdY+dZdZh = \mathrm{d} X\otimes \mathrm{d} X+\mathrm{d} Y\otimes \mathrm{d} Y+\mathrm{d} Z\otimes \mathrm{d} Z
h=dXdX+dYdY+dZdZh = \mathrm{d} X\otimes \mathrm{d} X+\mathrm{d} Y\otimes \mathrm{d} Y+\mathrm{d} Z\otimes \mathrm{d} Z

The metric gg on S2\mathbb{S}^2 is the pullback of hh associated with the embedding Φ\Phi:

g = S2.riemann_metric('g') g.set( Phi.pullback(h) ) print g
Riemannian metric 'g' on the 2-dimensional manifold 'S^2'

Note that we could have defined gg intrinsically, i.e. by providing its components in the two frames stereoN and stereoS, as we did for the metric hh on R3\mathbb{R}^3. Instead, we have chosen to get it as the pullback of hh, as an example of pullback associated with some differential map. 

The metric is a symmetric tensor field of type (0,2):

print g.parent()
module T^(0,2)(S^2) of type-(0,2) tensors fields on the 2-dimensional manifold 'S^2'
g.tensor_type()
(00, 22)
g.symmetries()
symmetry: (0, 1); no antisymmetry

The expression of the metric in terms of the default frame on S2\mathbb{S}^2 (stereoN):

g.display()
g=(4x4+y4+2(x2+1)y2+2x2+1)dxdx+(4x4+y4+2(x2+1)y2+2x2+1)dydyg = \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \mathrm{d} x\otimes \mathrm{d} x + \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \mathrm{d} y\otimes \mathrm{d} y

We may factorize the metric components:

g[1,1].factor() ; g[2,2].factor()
4(x2+y2+1)2\frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}}
4(x2+y2+1)2\frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}}
g.display()
g=4(x2+y2+1)2dxdx+4(x2+y2+1)2dydyg = \frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}} \mathrm{d} x\otimes \mathrm{d} x + \frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}} \mathrm{d} y\otimes \mathrm{d} y

A matrix view of the components of gg in the manifold's default frame:

g[:]
(4(x2+y2+1)2004(x2+y2+1)2)\left(\begin{array}{rr} \frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}} & 0 \\ 0 & \frac{4}{{\left(x^{2} + y^{2} + 1\right)}^{2}} \end{array}\right)

Display in terms of the vector frame (V,(x,y))(V, (\partial_{x'}, \partial_{y'})):

g.display(stereoS.frame())
g=(4x4+y4+2(x2+1)y2+2x2+1)dxdx+(4x4+y4+2(x2+1)y2+2x2+1)dydyg = \left( \frac{4}{{x'}^{4} + {y'}^{4} + 2 \, {\left({x'}^{2} + 1\right)} {y'}^{2} + 2 \, {x'}^{2} + 1} \right) \mathrm{d} {x'}\otimes \mathrm{d} {x'} + \left( \frac{4}{{x'}^{4} + {y'}^{4} + 2 \, {\left({x'}^{2} + 1\right)} {y'}^{2} + 2 \, {x'}^{2} + 1} \right) \mathrm{d} {y'}\otimes \mathrm{d} {y'}
g.display(spher.frame(), chart=spher)
g=dθdθ+sin(θ)2dϕdϕg = \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}

The metric acts on vector field pairs, resulting in a scalar field:

print g(v,v)
scalar field 'g(v,v)' on the 2-dimensional manifold 'S^2'
g(v,v).parent()
C(S2)C^\infty(\mathbb{S}^2)
g(v,v).display()
g(v,v):S2Ron U:(x,y)20x4+y4+2(x2+1)y2+2x2+1on V:(x,y)20(x4+2x2y2+y4)x4+y4+2(x2+1)y2+2x2+1on A:(θ,ϕ)5(cos(θ)44cos(θ)3+6cos(θ)24cos(θ)+1)sin(θ)2+2cos(θ)2\begin{array}{llcl} g\left(v,v\right):& \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & \frac{20}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & \frac{20 \, {\left({x'}^{4} + 2 \, {x'}^{2} {y'}^{2} + {y'}^{4}\right)}}{{x'}^{4} + {y'}^{4} + 2 \, {\left({x'}^{2} + 1\right)} {y'}^{2} + 2 \, {x'}^{2} + 1} \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & -\frac{5 \, {\left(\cos\left({\theta}\right)^{4} - 4 \, \cos\left({\theta}\right)^{3} + 6 \, \cos\left({\theta}\right)^{2} - 4 \, \cos\left({\theta}\right) + 1\right)}}{\sin\left({\theta}\right)^{2} + 2 \, \cos\left({\theta}\right) - 2} \end{array}

The Levi-Civitation connection associated with the metric gg:

nab = g.connection() print nab nab
Levi-Civita connection 'nabla_g' associated with the Riemannian metric 'g' on the 2-dimensional manifold 'S^2'
g\nabla_{g}

As a test, we verify that g\nabla_g acting on gg results in zero:

nab(g).display()
gg=0\nabla_{g} g = 0

The nonzero Christoffel symbols of gg (skipping those that can be deduced by symmetry on the last two indices) w.r.t. two charts:

g.christoffel_symbols_display(chart=stereoN)
Γxxxxxx=2xx2+y2+1Γxxyxxy=2yx2+y2+1Γxyyxyy=2xx2+y2+1Γyxxyxx=2yx2+y2+1Γyxyyxy=2xx2+y2+1Γyyyyyy=2yx2+y2+1\begin{array}{lcl} \Gamma_{ \phantom{\, x } \, x \, x }^{ \, x \phantom{\, x } \phantom{\, x } } & = & -\frac{2 \, x}{x^{2} + y^{2} + 1} \\ \Gamma_{ \phantom{\, x } \, x \, y }^{ \, x \phantom{\, x } \phantom{\, y } } & = & -\frac{2 \, y}{x^{2} + y^{2} + 1} \\ \Gamma_{ \phantom{\, x } \, y \, y }^{ \, x \phantom{\, y } \phantom{\, y } } & = & \frac{2 \, x}{x^{2} + y^{2} + 1} \\ \Gamma_{ \phantom{\, y } \, x \, x }^{ \, y \phantom{\, x } \phantom{\, x } } & = & \frac{2 \, y}{x^{2} + y^{2} + 1} \\ \Gamma_{ \phantom{\, y } \, x \, y }^{ \, y \phantom{\, x } \phantom{\, y } } & = & -\frac{2 \, x}{x^{2} + y^{2} + 1} \\ \Gamma_{ \phantom{\, y } \, y \, y }^{ \, y \phantom{\, y } \phantom{\, y } } & = & -\frac{2 \, y}{x^{2} + y^{2} + 1} \end{array}
g.christoffel_symbols_display(chart=spher)
Γθϕϕθϕϕ=cos(θ)sin(θ)Γϕθϕϕθϕ=cos(θ)sin(θ)\begin{array}{lcl} \Gamma_{ \phantom{\, {\theta} } \, {\phi} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi} } \phantom{\, {\phi} } } & = & -\cos\left({\theta}\right) \sin\left({\theta}\right) \\ \Gamma_{ \phantom{\, {\phi} } \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta} } \phantom{\, {\phi} } } & = & \frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)} \end{array}

g\nabla_g acting on the vector field vv:

print nab(v)
tensor field 'nabla_g v' of type (1,1) on the 2-dimensional manifold 'S^2'
nab(v).display(stereoN.frame())
gv=(2(x2y)x2+y2+1)xdx+(2(2x+y)x2+y2+1)xdy+(2(2x+y)x2+y2+1)ydx+(2(x2y)x2+y2+1)ydy\nabla_{g} v = \left( -\frac{2 \, {\left(x - 2 \, y\right)}}{x^{2} + y^{2} + 1} \right) \frac{\partial}{\partial x }\otimes \mathrm{d} x + \left( -\frac{2 \, {\left(2 \, x + y\right)}}{x^{2} + y^{2} + 1} \right) \frac{\partial}{\partial x }\otimes \mathrm{d} y + \left( \frac{2 \, {\left(2 \, x + y\right)}}{x^{2} + y^{2} + 1} \right) \frac{\partial}{\partial y }\otimes \mathrm{d} x + \left( -\frac{2 \, {\left(x - 2 \, y\right)}}{x^{2} + y^{2} + 1} \right) \frac{\partial}{\partial y }\otimes \mathrm{d} y

Curvature

The Riemann tensor associated with the metric gg:

Riem = g.riemann() print Riem Riem.display()
tensor field 'Riem(g)' of type (1,3) on the 2-dimensional manifold 'S^2'
Riem(g)=(4x4+y4+2(x2+1)y2+2x2+1)xdydxdy+(4x4+y4+2(x2+1)y2+2x2+1)xdydydx+(4x4+y4+2(x2+1)y2+2x2+1)ydxdxdy+(4x4+y4+2(x2+1)y2+2x2+1)ydxdydx\mathrm{Riem}\left(g\right) = \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \frac{\partial}{\partial x }\otimes \mathrm{d} y\otimes \mathrm{d} x\otimes \mathrm{d} y + \left( -\frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \frac{\partial}{\partial x }\otimes \mathrm{d} y\otimes \mathrm{d} y\otimes \mathrm{d} x + \left( -\frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \frac{\partial}{\partial y }\otimes \mathrm{d} x\otimes \mathrm{d} x\otimes \mathrm{d} y + \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \frac{\partial}{\partial y }\otimes \mathrm{d} x\otimes \mathrm{d} y\otimes \mathrm{d} x

The components of the Riemann tensor in the default frame on S2\mathbb{S}^2:

Riem.display_comp()
Riem(g)xyxyxyxy=4x4+y4+2(x2+1)y2+2x2+1Riem(g)xyyxxyyx=4x4+y4+2(x2+1)y2+2x2+1Riem(g)yxxyyxxy=4x4+y4+2(x2+1)y2+2x2+1Riem(g)yxyxyxyx=4x4+y4+2(x2+1)y2+2x2+1\begin{array}{lcl} \mathrm{Riem}\left(g\right)_{ \phantom{\, x } \, y \, x \, y }^{ \, x \phantom{\, y } \phantom{\, x } \phantom{\, y } } & = & \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, x } \, y \, y \, x }^{ \, x \phantom{\, y } \phantom{\, y } \phantom{\, x } } & = & -\frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, y } \, x \, x \, y }^{ \, y \phantom{\, x } \phantom{\, x } \phantom{\, y } } & = & -\frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, y } \, x \, y \, x }^{ \, y \phantom{\, x } \phantom{\, y } \phantom{\, x } } & = & \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \end{array}

The components in the frame associated with spherical coordinates:

Riem.display_comp(spher.frame(), chart=spher)
Riem(g)θϕθϕθϕθϕ=sin(θ)2Riem(g)θϕϕθθϕϕθ=sin(θ)2Riem(g)ϕθθϕϕθθϕ=cos(θ)21sin(θ)2Riem(g)ϕθϕθϕθϕθ=1\begin{array}{lcl} \mathrm{Riem}\left(g\right)_{ \phantom{\, {\theta} } \, {\phi} \, {\theta} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi} } \phantom{\, {\theta} } \phantom{\, {\phi} } } & = & \sin\left({\theta}\right)^{2} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, {\theta} } \, {\phi} \, {\phi} \, {\theta} }^{ \, {\theta} \phantom{\, {\phi} } \phantom{\, {\phi} } \phantom{\, {\theta} } } & = & -\sin\left({\theta}\right)^{2} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, {\phi} } \, {\theta} \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta} } \phantom{\, {\theta} } \phantom{\, {\phi} } } & = & \frac{\cos\left({\theta}\right)^{2} - 1}{\sin\left({\theta}\right)^{2}} \\ \mathrm{Riem}\left(g\right)_{ \phantom{\, {\phi} } \, {\theta} \, {\phi} \, {\theta} }^{ \, {\phi} \phantom{\, {\theta} } \phantom{\, {\phi} } \phantom{\, {\theta} } } & = & 1 \end{array}
print Riem.parent()
module T^(1,3)(S^2) of type-(1,3) tensors fields on the 2-dimensional manifold 'S^2'
Riem.symmetries()
no symmetry; antisymmetry: (2, 3)

The Riemann tensor associated with the Euclidean metric hh on R3\mathbb{R}^3:

h.riemann().display()
Riem(h)=0\mathrm{Riem}\left(h\right) = 0

The Ricci tensor and the Ricci scalar:

Ric = g.ricci() Ric.display()
Ric(g)=(4x4+y4+2(x2+1)y2+2x2+1)dxdx+(4x4+y4+2(x2+1)y2+2x2+1)dydy\mathrm{Ric}\left(g\right) = \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \mathrm{d} x\otimes \mathrm{d} x + \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \mathrm{d} y\otimes \mathrm{d} y
R = g.ricci_scalar() R.display()
r(g):S2Ron U:(x,y)2on V:(x,y)2on A:(θ,ϕ)2\begin{array}{llcl} \mathrm{r}\left(g\right):& \mathbb{S}^2 & \longrightarrow & \mathbb{R} \\ \mbox{on}\ U : & \left(x, y\right) & \longmapsto & 2 \\ \mbox{on}\ V : & \left({x'}, {y'}\right) & \longmapsto & 2 \\ \mbox{on}\ A : & \left({\theta}, {\phi}\right) & \longmapsto & 2 \end{array}

Hence we recover the fact that (S2,g)(\mathbb{S}^2,g) is a Riemannian manifold of constant positive curvature.

In dimension 2, the Riemann curvature tensor is entirely determined by the Ricci scalar RR according to

R jlki=R2(δ kigjlδ ligjk)R^i_{\ \, jlk} = \frac{R}{2} \left( \delta^i_{\ \, k} g_{jl} - \delta^i_{\ \, l} g_{jk} \right)

Let us check this formula here, under the form R jlki=Rgj[kδ l]iR^i_{\ \, jlk} = -R g_{j[k} \delta^i_{\ \, l]}:

delta = S2.tangent_identity_field() Riem == - R*(g*delta).antisymmetrize(2,3)
False\mathrm{False}

Similarly the relation Ric=(R/2)  g\mathrm{Ric} = (R/2)\; g must hold:

Ric == (R/2)*g
True\mathrm{True}

The Levi-Civita tensor associated with gg:

eps = g.volume_form() print eps eps.display()
2-form 'eps_g' on the 2-dimensional manifold 'S^2'
ϵg=(4x4+y4+2(x2+1)y2+2x2+1)dxdy\epsilon_{g} = \left( \frac{4}{x^{4} + y^{4} + 2 \, {\left(x^{2} + 1\right)} y^{2} + 2 \, x^{2} + 1} \right) \mathrm{d} x\wedge \mathrm{d} y
eps.display(spher.frame(), chart=spher)
ϵg=sin(θ)dθdϕ\epsilon_{g} = \sin\left({\theta}\right) \mathrm{d} {\theta}\wedge \mathrm{d} {\phi}

The exterior derivative of the 2-form ϵg\epsilon_g:

print eps.exterior_der()
3-form 'deps_g' on the 2-dimensional manifold 'S^2'

Of course, since S2\mathbb{S}^2 has dimension 2, all 3-forms vanish identically:

eps.exterior_der().display()
dϵg=0\mathrm{d}\epsilon_{g} = 0

Non-holonomic frames

Up to know, all the vector frames introduced on S2\mathbb{S}^2 have been coordinate frames. Let us introduce a non-coordinate frame on the open subset AA. To ease the notations, we change first the default chart and default frame on AA to the spherical coordinate ones:

A.default_chart()
(A,(x,y))\left(A,(x, y)\right)
A.default_frame()
(A,(x,y))\left(A ,\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right)\right)
A.set_default_chart(spher) A.set_default_frame(spher.frame()) A.default_chart()
(A,(θ,ϕ))\left(A,({\theta}, {\phi})\right)
A.default_frame()
(A,(θ,ϕ))\left(A ,\left(\frac{\partial}{\partial {\theta} },\frac{\partial}{\partial {\phi} }\right)\right)

We define the new frame ee by relating it the coordinate frame (θ,ϕ)\left(\frac{\partial}{\partial\theta}, \frac{\partial}{\partial\phi}\right) via a field of tangent-space automorphisms:

a = A.automorphism_field() a[1,1], a[2,2] = 1, 1/sin(th) a.display()
θdθ+1sin(θ)ϕdϕ\frac{\partial}{\partial {\theta} }\otimes \mathrm{d} {\theta} + \frac{1}{\sin\left({\theta}\right)} \frac{\partial}{\partial {\phi} }\otimes \mathrm{d} {\phi}
a[:]
(1001sin(θ))\left(\begin{array}{rr} 1 & 0 \\ 0 & \frac{1}{\sin\left({\theta}\right)} \end{array}\right)
e = spher.frame().new_frame(a, 'e') print e ; e
vector frame (A, (e_1,e_2))
(A,(e1,e2))\left(A, \left(e_1,e_2\right)\right)
e[1].display()
e1=θe_1 = \frac{\partial}{\partial {\theta} }
e[2].display()
e2=1sin(θ)ϕe_2 = \frac{1}{\sin\left({\theta}\right)} \frac{\partial}{\partial {\phi} }
A.frames()
[(A,(x,y))\left(A ,\left(\frac{\partial}{\partial x },\frac{\partial}{\partial y }\right)\right), (A,(θ,ϕ))\left(A ,\left(\frac{\partial}{\partial {\theta} },\frac{\partial}{\partial {\phi} }\right)\right), (A,(e1,e2))\left(A, \left(e_1,e_2\right)\right)]

The new frame is an orthonormal frame for the metric gg:

g(e[1],e[1]).expr()
11
g(e[1],e[2]).expr()
00
g(e[2],e[2]).expr()
11
g[e,:]
(1001)\left(\begin{array}{rr} 1 & 0 \\ 0 & 1 \end{array}\right)
g.display(e)
g=e1e1+e2e2g = e^1\otimes e^1+e^2\otimes e^2
eps.display(e)
ϵg=e1e2\epsilon_{g} = e^1\wedge e^2

It is non-holonomic: its structure coefficients are not identically zero:

e.structure_coef()[:]
[[[00, 00], [00, 00]], [[00, cos(θ)sin(θ)-\frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)}], [cos(θ)sin(θ)\frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)}, 00]]]
e[2].lie_der(e[1]).display(e)
cos(θ)sin(θ)e2-\frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)} e_2

while we have of course

spher.frame().structure_coef()[:]
[[[00, 00], [00, 00]], [[00, 00], [00, 00]]]