Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: test
Views: 148

Sphere S2\mathbb{S}^2

This worksheet illustrates the use of SageManifolds v0.9 in SageMathCloud.

This is a simplified version of this Sage notebook worksheet.

%typeset_mode True
S2 = Manifold(2, 'S^2', latex_name=r'\mathbb{S}^2', start_index=1) print S2
2-dimensional differentiable manifold S^2
S2
S2\displaystyle \mathbb{S}^2
U = S2.open_subset('U') ; print U
Open subset U of the 2-dimensional differentiable manifold S^2
V = S2.open_subset('V') ; print V
Open subset V of the 2-dimensional differentiable manifold S^2
S2.declare_union(U, V)

Stereographic coordinates from the North pole:

stereoN.<x,y> = U.chart() ; stereoN
(U,(x,y))\displaystyle \left(U,(x, y)\right)

Stereographic coordinates from the South pole:

stereoS.<xp,yp> = V.chart(r"xp:x' yp:y'") ; stereoS
(V,(x,y))\displaystyle \left(V,({x'}, {y'})\right)
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\displaystyle \left\{\begin{array}{lcl} {x'} & = & \frac{x}{x^{2} + y^{2}} \\ {y'} & = & \frac{y}{x^{2} + y^{2}} \end{array}\right.
stereoS_to_N = stereoN_to_S.inverse() stereoS_to_N.display()
{x=xx2+y2y=yx2+y2\displaystyle \left\{\begin{array}{lcl} x & = & \frac{{x'}}{{x'}^{2} + {y'}^{2}} \\ y & = & \frac{{y'}}{{x'}^{2} + {y'}^{2}} \end{array}\right.
W = U.intersection(V) stereoN_W = stereoN.restrict(W) stereoS_W = stereoS.restrict(W)

The domain of spherical coordinates:

A = W.open_subset('A', coord_def={stereoN_W: (y!=0, x<0), stereoS_W: (yp!=0, xp<0)}) print A
Open subset A of the 2-dimensional differentiable manifold S^2
stereoN_A = stereoN_W.restrict(A) stereoN_A
(A,(x,y))\displaystyle \left(A,(x, y)\right)
spher.<th,ph> = A.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') spher
(A,(θ,ϕ))\displaystyle \left(A,({\theta}, {\phi})\right)
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\displaystyle \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.
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
stereoN_to_S_A = stereoN_to_S.restrict(A) spher_to_stereoS = stereoN_to_S_A * spher_to_stereoN spher_to_stereoS.display()
{x=cos(ϕ)cos(θ)cos(ϕ)sin(θ)y=cos(θ)sin(ϕ)sin(ϕ)sin(θ)\displaystyle \left\{\begin{array}{lcl} {x'} & = & -\frac{\cos\left({\phi}\right) \cos\left({\theta}\right) - \cos\left({\phi}\right)}{\sin\left({\theta}\right)} \\ {y'} & = & -\frac{\cos\left({\theta}\right) \sin\left({\phi}\right) - \sin\left({\phi}\right)}{\sin\left({\theta}\right)} \end{array}\right.
stereoS_to_N_A = stereoN_to_S.inverse().restrict(A) stereoS_to_spher = spher_to_stereoN.inverse() * stereoS_to_N_A stereoS_to_spher.display()
{θ=2arctan(x2+y2)ϕ=πarctan(yx2+y2,xx2+y2)\displaystyle \left\{\begin{array}{lcl} {\theta} & = & 2 \, \arctan\left(\sqrt{{x'}^{2} + {y'}^{2}}\right) \\ {\phi} & = & \pi - \arctan\left(\frac{{y'}}{{x'}^{2} + {y'}^{2}}, -\frac{{x'}}{{x'}^{2} + {y'}^{2}}\right) \end{array}\right.
S2.atlas()
[(U,(x,y))\displaystyle \left(U,(x, y)\right), (V,(x,y))\displaystyle \left(V,({x'}, {y'})\right), (W,(x,y))\displaystyle \left(W,(x, y)\right), (W,(x,y))\displaystyle \left(W,({x'}, {y'})\right), (A,(x,y))\displaystyle \left(A,(x, y)\right), (A,(x,y))\displaystyle \left(A,({x'}, {y'})\right), (A,(θ,ϕ))\displaystyle \left(A,({\theta}, {\phi})\right)]
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 the 2-dimensional differentiable manifold S^2 Point S on the 2-dimensional differentiable manifold S^2
R3 = Manifold(3, 'R^3', r'\mathbb{R}^3', start_index=1) cart.<X,Y,Z> = R3.chart() cart
(R3,(X,Y,Z))\displaystyle \left(\mathbb{R}^3,(X, Y, Z)\right)

The standard embedding of S2\mathbb{S}^2 into R3\mathbb{R}^3:

Phi = S2.diff_map(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)\displaystyle \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.expr(stereoN_A, cart)
(2xx2+y2+1\displaystyle \frac{2 \, x}{x^{2} + y^{2} + 1}, 2yx2+y2+1\displaystyle \frac{2 \, y}{x^{2} + y^{2} + 1}, x2+y21x2+y2+1\displaystyle \frac{x^{2} + y^{2} - 1}{x^{2} + y^{2} + 1})
Phi.display(spher, cart)
Φ:S2R3on A:(θ,ϕ)(X,Y,Z)=(cos(ϕ)sin(θ),sin(ϕ)sin(θ),cos(θ))\displaystyle \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}

Grid of spherical coordinates:

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

Grids of stereographic coordinates:

graph_stereoN = stereoN.plot(chart=cart, mapping=Phi, nb_values=25) graph_stereoS = stereoS.plot(chart=cart, mapping=Phi, nb_values=25, color='green') 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
ex = stereoN.frame()[1] ex
x\displaystyle \frac{\partial}{\partial x }
ex.display(stereoS_W.frame(), stereoS_W)
x=(x2+y2)x2xyy\displaystyle \frac{\partial}{\partial x } = \left( -{x'}^{2} + {y'}^{2} \right) \frac{\partial}{\partial {x'} } -2 \, {x'} {y'} \frac{\partial}{\partial {y'} }
ex.restrict(W).display(stereoS_W.frame(), stereoS_W)
x=(x2+y2)x2xyy\displaystyle \frac{\partial}{\partial x } = \left( -{x'}^{2} + {y'}^{2} \right) \frac{\partial}{\partial {x'} } -2 \, {x'} {y'} \frac{\partial}{\partial {y'} }
ex.restrict(A).display(spher.frame(), spher)
x=(cos(θ)+1cos(ϕ)sin(θ)cos(θ)+1)θ+(cos(θ)sin(ϕ)sin(ϕ)sin(θ))ϕ\displaystyle \frac{\partial}{\partial x } = \left( -\frac{\sqrt{-\cos\left({\theta}\right) + 1} \cos\left({\phi}\right) \sin\left({\theta}\right)}{\sqrt{\cos\left({\theta}\right) + 1}} \right) \frac{\partial}{\partial {\theta} } + \left( \frac{\cos\left({\theta}\right) \sin\left({\phi}\right) - \sin\left({\phi}\right)}{\sin\left({\theta}\right)} \right) \frac{\partial}{\partial {\phi} }
ey = stereoN.frame()[2] ey
y\displaystyle \frac{\partial}{\partial y }
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)
3D rendering not yet implemented
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_ex + graph_ey + graph_spher, aspect_ratio=1)
3D rendering not yet implemented

Riemannian metric on S2\mathbb{S}^2

Let us define the metric gg on S2\mathbb{S}^2 as the pullback, via the embedding Φ\Phi, of the Euclidean metric of R3\mathbb{R}^3:

h = R3.riemannian_metric('h') h[1,1], h[2,2], h[3, 3] = 1, 1, 1 h.display()
h=dXdX+dYdY+dZdZ\displaystyle h = \mathrm{d} X\otimes \mathrm{d} X+\mathrm{d} Y\otimes \mathrm{d} Y+\mathrm{d} Z\otimes \mathrm{d} Z
g = S2.riemannian_metric('g') g.set( Phi.pullback(h) ) g.display()
g=(4x4+y4+2(x2+1)y2+2x2+1)dxdx+(4x4+y4+2(x2+1)y2+2x2+1)dydy\displaystyle g = \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(stereoS.frame())
g=(4x4+y4+2(x2+1)y2+2x2+1)dxdx+(4x4+y4+2(x2+1)y2+2x2+1)dydy\displaystyle g = \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ϕ\displaystyle g = \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}

x\frac{\partial}{\partial x} is not a Killing vector field: the Lie derivative of gg along it does not vanish:

g.restrict(U).lie_der(ex).display()
(16xx6+y6+3(x2+1)y4+3x4+3(x4+2x2+1)y2+3x2+1)dxdx+(16xx6+y6+3(x2+1)y4+3x4+3(x4+2x2+1)y2+3x2+1)dydy\displaystyle \left( -\frac{16 \, x}{x^{6} + y^{6} + 3 \, {\left(x^{2} + 1\right)} y^{4} + 3 \, x^{4} + 3 \, {\left(x^{4} + 2 \, x^{2} + 1\right)} y^{2} + 3 \, x^{2} + 1} \right) \mathrm{d} x\otimes \mathrm{d} x + \left( -\frac{16 \, x}{x^{6} + y^{6} + 3 \, {\left(x^{2} + 1\right)} y^{4} + 3 \, x^{4} + 3 \, {\left(x^{4} + 2 \, x^{2} + 1\right)} y^{2} + 3 \, x^{2} + 1} \right) \mathrm{d} y\otimes \mathrm{d} y

while ϕ\frac{\partial}{\partial\phi} is a Killing vector field:

ep = spher.frame()[2] ep
ϕ\displaystyle \frac{\partial}{\partial {\phi} }
g.restrict(A).lie_der(ep).display()
0\displaystyle 0

The nonzero Christoffel symbols of gg w.r.t. stereographic coordinates and spherical ones (taking into account the symmetry on the last two indices):

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\displaystyle \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(θ)\displaystyle \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}

The Riemann curvature tensor:

Riem = g.riemann() print Riem Riem.display()
Tensor field Riem(g) of type (1,3) on the 2-dimensional differentiable 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\displaystyle \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
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\displaystyle \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}
Riem.display_comp(spher.frame(), chart=spher)
Riem(g)θϕθϕθϕθϕ=sin(θ)2Riem(g)θϕϕθθϕϕθ=sin(θ)2Riem(g)ϕθθϕϕθθϕ=cos(θ)21sin(θ)2Riem(g)ϕθϕθϕθϕθ=1\displaystyle \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}

(S2,g)(\mathbb{S}^2, g) is a Riemannian manifold of constant curvature:

R = g.ricci_scalar() R.display()
r(g):S2Ron U:(x,y)2on V:(x,y)2on A:(θ,ϕ)2\displaystyle \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}