Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
sagemanifolds
GitHub Repository: sagemanifolds/IntroToManifolds
Path: blob/main/22Manifold_Riemann.ipynb
Views: 83
Kernel: SageMath 9.6

22. Riemannian and pseudo-Riemannian manifolds

This notebook is part of the Introduction to manifolds in SageMath by Andrzej Chrzeszczyk (Jan Kochanowski University of Kielce, Poland).

version()
'SageMath version 9.6, Release Date: 2022-05-15'

Let MM be a smooth manifold and gg a covariant tensor field of rank two: gT(0,2)M.g\in T^{(0,2)}M. We call gg symmetric if gp(Xp,Yp)=gp(Yp,Xp)for Xp,YpTpM, pM.g_p(X_p,Y_p)=g_p(Y_p,X_p)\quad \text{for } X_p,Y_p\in T_pM,\ p\in M.

We call gg positive definite if gp(Xp,Xp)0for all XpTpM, pMg_p(X_p,X_p)\geq 0\quad \text{for all}\ X_p\in T_pM,\ p\in M and gp(Xp,Xp)=0implies Xp=0pTpM.g_p(X_p,X_p)=0\quad \text{implies } X_p=0_p\in T_pM.

The tensor field gg is non-singular if for all pMp\in M

gp(Xp,Yp)=0for all YpTpMimplies Xp=0pTpM.g_p(X_p,Y_p)=0\quad \text{for all } Y_p\in T_pM\quad \text{implies } X_p=0_p\in T_pM.

Note that the positive-definiteness implies the non-singularity:
if gp(Xp,Yp)=0for all YpTpM, g_p(X_p,Y_p)=0\quad \text{for all } Y_p\in T_pM,\ then  gp(Xp,Xp)=0 \ g_p(X_p,X_p)=0\ and consequently Xp=0pX_p=0_p.

A pseudo-Riemannian manifold is a smooth manifold MM with a non-singular, symmetric, smooth tensor field gT(0,2)Mg\in T^{(0,2)}M, called metric of MM.

If the metric is positive definite we use the name Riemannian manifold.


Example 22.1

Metric method in SageMath:

# Riemannian manifold M M = Manifold(2, 'M', structure='Riemannian'); M
2-dimensional Riemannian manifold M
g = M.metric(); g # metric on M
Riemannian metric g on the 2-dimensional Riemannian manifold M

In a Riemannian manifold, MM, with a metric gg, the bilinear form gp(,)g_p(\cdot,\cdot) is an inner product on TpMT_pM. The norm or length of a tangent vector XpTpMX_p ∈ T_p M is defined by

Xp=gp(Xp,Xp),\begin{equation} \|X_p\| = \sqrt{g_p (X_p , X_p )}, \tag{22.1} \end{equation}

and the length of a curve γ:[a,b]M\gamma : [a, b] → M is defined by

Lγ=abγtdt.\begin{equation} L_\gamma=\int_a^b\|\gamma'_t\|dt. \tag{22.2} \end{equation}

If MM is a Riemannian manifold and (x1,,xn)(x^1,\ldots,x^n) are local coordinates, then the metric is given by

g=gijdxidxj,\begin{equation} g = g_{i j} dx^i ⊗ dx^j, \tag{22.3} \end{equation}

where gij=g(xi,xj)g_{ij}=g(\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}) (this is a special case of (13.7) ).

The standard metric on RnR^n with Cartesian coordinates is defined by

g=δijdxidxj=dx1dx1++dxndxn,\begin{equation} g = \delta_{ij}dx^i\otimes dx^j=dx^1 ⊗ dx^1 + · · · + dx^n ⊗ dx^n , \tag{22.4} \end{equation}



Example 22.2

Let us start from the standard metric in 2-dimensional Euclidean space

E.<x,y> = EuclideanSpace() # Euclidean space E^2 g = E.metric() # standard metric on E^2 g.disp()
g = dx⊗dx + dy⊗dy

and use (22.2) to compute the length of the curve c defined in Cartesian coordinates by

x(t)=sin(t),y(t)=sin(2t)/2,t(0,2π),x(t)=\sin(t),\quad y(t)=\sin(2t)/2,\quad t\in (0,2\pi),

(in simple cases the exact integral can be computed in SageMath, but not in the present case).

E.<x,y> = EuclideanSpace() # Euclidean space E^2 t = var('t') # symbolic variable for c c = E.curve({E.cartesian_coordinates():[sin(t), sin(2*t)/2]}, (t, 0, 2*pi), name='c') # define curve in Cart. coord. v=c.tangent_vector_field() # vector field of tangent vect. to c w=v.norm().expr() # norm of v numerical_integral(w,0,2*pi)[0] # numerical version of (22.2)
6.097223470104982

If the curve is simple, for example

x(t)=sin(2t),y(t)=cos(2t),t(0,2π),x(t)=\sin(2t),\quad y(t)=\cos(2t),\quad t\in (0,2\pi),

then we don't need numerical tools:

%display latex E.<x,y> = EuclideanSpace() # Euclidean space E^2 t = var('t') # symbolic variable for c c = E.curve({E.cartesian_coordinates():[sin(2*t), cos(2*t)]}, (t, 0, 2*pi), name='c') # define curve in Cart. coord. v=c.tangent_vector_field() # vector field of tangent vect. to c w=v.norm().expr() # norm of v w.integral(t,0,2*pi) # exact version of (22.2)

4π\displaystyle 4 \, \pi


Example 22.3

The standard metric in 4-dimensional Euclidean space is predefined.

%display latex E=EuclideanSpace(4) # Euclidean space E^4 E.metric().disp() # standard metric on E^4

g=dx1dx1+dx2dx2+dx3dx3+dx4dx4\displaystyle g = \mathrm{d} {x_{1}}\otimes \mathrm{d} {x_{1}}+\mathrm{d} {x_{2}}\otimes \mathrm{d} {x_{2}}+\mathrm{d} {x_{3}}\otimes \mathrm{d} {x_{3}}+\mathrm{d} {x_{4}}\otimes \mathrm{d} {x_{4}}

If we need upper indices and more general manifolds, then we can use the commands:

N = 3 # dimension of manifold # variables with superscripts: M = Manifold(N, 'M') # manifold M X = M.chart(' '.join(['x'+str(i)+':x^{'+str(i)+'}' for i in range(N)])) # chart on M g = M.metric('g') # metric g on M g[0,0], g[1,1], g[2,2] = 1, 1, 1 # components of g g.disp() # show g

g=dx0dx0+dx1dx1+dx2dx2\displaystyle g = \mathrm{d} {x^{0}}\otimes \mathrm{d} {x^{0}}+\mathrm{d} {x^{1}}\otimes \mathrm{d} {x^{1}}+\mathrm{d} {x^{2}}\otimes \mathrm{d} {x^{2}}


Determinant of of [gij][g_{ij}]


If in the implication gp(Xp,Yp)=0 for all YpXp=0,g_p(X_p,Y_p)=0\ \text{for all } Y_p\quad \Rightarrow X_p=0,

we put Xp=aixip,Yp=xjpX_p=a^i\frac{\partial}{\partial x^i}\big|_p, \quad Y_p=\frac{\partial}{\partial x^j}\big|_p, then we obtain

gij(p)ai=0,j=1,,nai=0, i=1,,n,g_{i j} ( p)\, a^i = 0,\quad j=1,\ldots,n\quad \Rightarrow a^i=0, \ i=1,\ldots,n,

which means that the homogeneous system of linear equations for the unknowns aia^i admits only the zero solutions i.e.,

det[gi,j](p)0,\det [g_{i,j}](p)\not=0,

for all pp in the the coordinate domain.


Pullback of a metric


If MM is a Riemannian manifold with a positive definite metric tensor gg and ψ:NMψ :N → M is a smooth map such that for all pN, dψpp ∈ N ,\ dψ_p has maximal rank, that is,

dψpXp=0ψ(p)implies  Xp=0p,dψ_p X_p = 0_{ψ( p)}\quad \text{implies}\ \ X_p = 0_p,

then the pullback ψgψ^∗ g is a positive definite metric tensor in NN.

In fact since (ψg)p(Xp,Yp)gψ(p)(dψpXp,dψpYp)(ψ^∗ g)_p (X_p , Y_p ) ≡ g_{ψ( p)} (dψ_p X_p , dψ_p Y_p ), and gg is symmetric then ψg\psi^*g is symmetric. Furthermore, if (ψg)p(Xp,Yp)=0(ψ^*g)_p (X_p , Y_p ) = 0 for all YpTpNY_p ∈ T_p N , from the definition of ψgψ^*g, we have gψ(p)(dψpXp,dψpYp)=0g_{ψ( p)} (dψ_p X_p , dψ_p Y_p ) = 0 for all YpTpNY_p ∈ T_p N, In particular taking Xp=YpX_p = Y_p and using the fact that gg is positive definite we see that dψpXp=0ψ(p)dψ_p X_p = 0_{\psi(p)}, and therefore Xp=0pX_p = 0_p .


Immersions and embeddings


A smooth mapping with maximal rank is called an immersion (in other words, ψ:NMψ : N → M is an immersion if for all pNp ∈ N, the rank of the linear mapping dψpdψ_p is equal to the dimension of NN ).
The smooth map  ψ:NM \ \psi: N\to M\ is an embedding if it is one-to one immersion and the image ψ(N)\psi(N) with the subspace topology is homeomorphic to NN under ψ\psi.



Example 22.4 The metric on the standard sphere S2S^2:

%display latex M = Manifold(3, 'R^3') # manifold M=R^3 c_xyz.<x,y,z> = M.chart() # Cartesian coordinates N = Manifold(2, 'N') # manifold N=S^2 # chart on N: c_sph.<theta,phi>=N.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') psi = N.diff_map(M, (sin(theta)*cos(phi), sin(theta)*sin(phi),cos(theta)),name='psi', latex_name=r'\psi') # embedding S^2 -> R^3 g=M.metric('g') # standard metric on R^3 g[0,0],g[1,1],g[2,2]=1,1,1 # components of g plb=psi.pullback(g) # pullback of g plb.display() # show metric on S^2

ψg=dθdθ+sin(θ)2dϕdϕ\displaystyle {\psi}^*g = \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}

It is easy to check that ψ\psi is of maximal rank:

psi.jacobian_matrix().rank()

2\displaystyle 2

Example 22.5

The metric on the paraboloid:

M = Manifold(3, 'R3') # manifold M=R^3 c_xyz.<x,y,z> = M.chart() # Cartesian coordinates N=Manifold(2,name='R2') # manifold N; paraboloid c_uv.<u,v>=N.chart() # coordinates on N g = M.metric('g'); # metric in R^3 g[:]=[[1,0,0],[0,1,0],[0,0,1]]; # components of g psi = N.diff_map(M, (u, v,u^2+v^2), name='psi',latex_name=r'\psi') # embedding N->R^3 plb=psi.pullback(g) # pullback of g plb.display() # show metric on paraboloid

ψg=(4u2+1)dudu+4uvdudv+4uvdvdu+(4v2+1)dvdv\displaystyle {\psi}^*g = \left( 4 \, u^{2} + 1 \right) \mathrm{d} u\otimes \mathrm{d} u + 4 \, u v \mathrm{d} u\otimes \mathrm{d} v + 4 \, u v \mathrm{d} v\otimes \mathrm{d} u + \left( 4 \, v^{2} + 1 \right) \mathrm{d} v\otimes \mathrm{d} v

# check if psi is of maximal rank J = psi.jacobian_matrix() J.rank()

2\displaystyle 2

Example 22.6

The metric on the hyperboloid:

M = Manifold(3, 'R3') # manifold M=R^3 c_xyz.<x,y,z> = M.chart() # Cartesian coordinates N=Manifold(2,name='R2') # manifold N; hyperboloid c_uv.<u,v>=N.chart() # coordinates on N g = M.metric('g'); # metric in R^3 g[:]=[[1,0,0],[0,1,0],[0,0,1]]; # components of g psi = N.diff_map(M, (u, v,u^2-v^2), name='psi',latex_name=r'\psi') # embedding N->R^3 plb=psi.pullback(g) # pullback of g plb.display() # show metric on hyperboloid

ψg=(4u2+1)dudu4uvdudv4uvdvdu+(4v2+1)dvdv\displaystyle {\psi}^*g = \left( 4 \, u^{2} + 1 \right) \mathrm{d} u\otimes \mathrm{d} u -4 \, u v \mathrm{d} u\otimes \mathrm{d} v -4 \, u v \mathrm{d} v\otimes \mathrm{d} u + \left( 4 \, v^{2} + 1 \right) \mathrm{d} v\otimes \mathrm{d} v

# check if psi is of maximal rank J=psi.jacobian_matrix() J.rank()

2\displaystyle 2


Levi-Civita connection


If MM is a Riemannian manifold, then there exists a unique connection with vanishing torsion and such that Xg=0∇_X g = 0 for all XX(M)X ∈ \mathfrak{X}(M). Connections with this properties are called Riemannian or Levi-Civita connections.

From the definition (21.13) of torsion (T(X,Y)=XYYX[X,Y]T (X, Y) = ∇_X Y − ∇_Y X − [X, Y]) it follows that the torsion vanishes iff [X,Y]=XYYX.\begin{equation} [X, Y] = ∇_X Y − ∇_Y X. \tag{22.5} \end{equation}

Recall that connections satisfying (22.5) are called torsion free or symmetric.

From the rule of covariant differentiation of covariant tensor fields (21.14) it follows that

(Xg)(Y,Z)=X(g(Y,Z))g(XY,Z)g(Y,XZ),(∇_X g)(Y,Z)=X (g (Y,Z))-g(∇_X Y,Z)-g(Y,∇_X Z),

so Xg∇_X g vanishes iff

X(g(Y,Z))=g(XY,Z)+g(Y,XZ).\begin{equation} X (g(Y, Z)) = g(∇_X Y, Z) + g(Y, ∇_X Z). \tag{22.6} \end{equation}

A connection   \ \nabla\ in a Riemannian manifold MM is said to be compatible with the metric if (22.6) is true for all X,Y,ZX(M)X,Y,Z\in \mathfrak{X}(M).


One can prove that:

On any Riemannian manifold MM there exists a unique connection for which (22.5),(22.6) hold for X,Y,ZX(M).X, Y, Z ∈ \mathfrak{X}(M).


Let us assume that (22.5),(22.6) hold true. We have

X(g(Y,Z))+Y(g(Z,X))Z(g(X,Y))=g(XY,Z)+g(Y,XZ)+g(YZ,X)+g(Z,YX)g(ZX,Y)g(X,ZY)=g(XY+YX,Z)+g(Y,XZZX)+g(X,YZZY)=g(XY+XY+(YXXY),Z)+g(Y,XZZX)+g(X,YZZY)=g(XY+XY+[Y,X],Z)+g(Y,[X,Z])+g(X,[Y,Z])=2g(XY,Z)+g(Z,[Y,X])+g(Y,[X,Z])+g(X,[Y,Z]).X( g(Y, Z)) +Y( g(Z, X)) − Z (g(X, Y))\\ = g(∇_X Y, Z) + g(Y, ∇_X Z) + g(∇_Y Z, X) + g(Z, ∇_Y X) − g(∇_Z X, Y) − g(X, ∇_Z Y)\\ = g(∇_X Y + ∇_Y X, Z) + g(Y, ∇_X Z − ∇_Z X) + g(X, ∇_Y Z − ∇_Z Y)\\ = g(∇_X Y + ∇_X Y+(\nabla_Y X-\nabla_X Y), Z) + g(Y, ∇_X Z − ∇_Z X) + g(X, ∇_Y Z − ∇_Z Y)\\ = g(∇_X Y + ∇_X Y + [Y, X], Z) + g(Y, [X, Z]) + g(X, [Y, Z])\\ = 2g(∇_X Y, Z) + g(Z, [Y, X]) + g(Y, [X, Z]) + g(X, [Y, Z]).

The obtained equality implies the following Koszul formula

2g(XY,Z)=X(g(Y,Z))+Y(g(Z,X))Z(g(X,Y))g(Z,[Y,X])g(Y,[X,Z])g(X,[Y,Z]).\begin{equation} 2g(∇_X Y, Z) = X (g(Y, Z)) + Y (g(Z, X)) − Z (g(X, Y))\\ − g (Z, [Y, X]) − g (Y, [X, Z]) − g( X, [Y, Z]). \tag{22.7} \end{equation}

Since gg is non-singular if such a gg exists, it defines the connection XY∇_X Y in an unique manner.

Now let us assume that XY\nabla_X Y is defined by (22.7). We have

2g(XY,Z)2g(YX,Z)=X(g(Y,Z))+Y(g(Z,X))Z(g(X,Y))g(Z,[Y,X])g(Y,[X,Z])g(X,[Y,Z])Y(g(X,Z))X(g(Z,Y))+Z(g(Y,X))+g(Z,[X,Y])+g(X,[Y,Z])+g(Y,[X,Z])=2g([X,Y],Z),2g(\nabla_XY,Z)-2g(\nabla_Y X,Z)=\\ X(g(Y,Z))+Y(g(Z,X))-Z(g(X,Y)) -g(Z,[Y,X])-g(Y,[X,Z])-g(X,[Y,Z])\\ -Y(g(X,Z))-X(g(Z,Y))+Z(g(Y,X)) +g(Z,[X,Y])+g(X,[Y,Z])+g(Y,[X,Z])\\ =2g([X,Y],Z),

thus (22.5) is fulfilled.

To check (22.6) let us note that

2g(XY,Z)+2g(Y,XZ)=2g(XY,Z)+2g(XZ,Y)=X(g(Y,Z))+Y(g(Z,X))Z(g(X,Y))g(Z,[Y,X])g(Y,[X,Z])g(X,[Y,Z])+X(g(Z,Y))+Z(g(Y,X))Y(g(X,Z))g(Y,[Z,X])g(Z,[X,Y])g(X,[Z,Y])=2X(g(Y,Z)).2g(\nabla_XY,Z)+2g(Y,\nabla_XZ)=2g(\nabla_XY,Z)+2g(\nabla_XZ,Y)\\ =X(g(Y,Z))+Y(g(Z,X))-Z(g(X,Y))-g(Z,[Y,X])-g(Y,[X,Z])-g(X,[Y,Z])\\ +X(g(Z,Y))+Z(g(Y,X))-Y(g(X,Z))-g(Y,[Z,X])-g(Z,[X,Y])-g(X,[Z,Y])\\ =2X(g(Y,Z)).

Levi-Civita connection in components


Let gij=g(xi,xj)g_{ij}=g\big(\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}\big). Recall from the notebook 12 that [xi,xj]=0.[\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}]=0.

If we put in (22.7) . X=xi,Y=xj,Z=xk,X=\frac{\partial}{\partial x^i},\quad Y=\frac{\partial}{\partial x^j},\quad Z=\frac{\partial}{\partial x^k}, then

2g(xixj,xk)=xi(g(xj,xk))+xj(g(xk,xi))xk(g(xi,xj))=gjkxi+gkixjgijxk.2g\Big(\nabla_{\frac{\partial}{\partial x^i}} \frac{\partial}{\partial x^j},\frac{\partial}{\partial x^k}\Big)\\ =\frac{\partial}{\partial x^i} \big(g(\frac{\partial}{\partial x^j},\frac{\partial}{\partial x^k}\big)\big) + \frac{\partial}{\partial x^j} \big(g(\frac{\partial}{\partial x^k},\frac{\partial}{\partial x^i}\big)\big) - \frac{\partial}{\partial x^k} \big(g(\frac{\partial}{\partial x^i},\frac{\partial}{\partial x^j}\big)\big)\\ =\frac{\partial g_{jk}}{\partial x^i}+ \frac{\partial g_{ki}}{\partial x^j}- \frac{\partial g_{ij}}{\partial x^k}.

Using the formula xixj=Γjimxm\nabla_{\frac{\partial}{\partial x^i}} \frac{\partial}{\partial x^j}=\Gamma^m_{ji}\frac{\partial}{\partial x^m} we obtain

2Γjimgmk=gjkxi+gkixjgijxk,2\Gamma^m_{ji}g_{mk}= \frac{\partial g_{jk}}{\partial x^i}+ \frac{\partial g_{ki}}{\partial x^j}- \frac{\partial g_{ij}}{\partial x^k},

and finally Γjim=12gkm(gjkxi+gkixjgijxk),\begin{equation} \Gamma^m_{ji}=\frac{1}{2}g^{km}\Big( \frac{\partial g_{jk}}{\partial x^i}+ \frac{\partial g_{ki}}{\partial x^j}- \frac{\partial g_{ij}}{\partial x^k} \Big), \tag{22.8} \end{equation}

where [gkm][g^{km}] is the matrix inverse to [gmk][g_{mk}].

Note that from (22.8) it follows that Γijk=Γjim\Gamma_{ij}^k=\Gamma_{ji}^m.

Note that a symmetric n×nn\times n matrix has n(n+1)/2n(n+1)/2 independent elements and Γijm\Gamma^m_{ij} defines nn such matrices, so the Riemannian manifolds have n2(n+1)/2n^2(n+1)/2 independent Christoffel symbols.


Geodesics in Riemannian manifolds


In the case of Riemannian connections SageMath offers integrated_geodesic, a numerical method of finding geodesics

Example 22.7

Use integrated_geodesic method to find the geodesics on Poincaré half-plane passing through the point with coordinates (0,1)(0,1).

Let us start from the geodesic with tangent vector at (0,1)(0,1) parallel to xx-axis.

M = Manifold(2,'M',structure='Riemannian') # Riemannian manifold M X.<x,y> = M.chart('x y:(0,+oo)') # Poincare half-plane g = M.metric() # metric on M g[0,0], g[1,1] = 1/y^2, 1/y^2 # nonzero components of the metric p = M((0,1), name='p') # point p t = var('t') # symbolic variable for geodesic v = M.tangent_space(p)((1,0), name='v') # tang. vect. at p, comp.: (1,0) v1 = M.tangent_space(p)((-1,0), name='v1') # tang. vect. at p, comp.: (-1,0) c = M.integrated_geodesic(g, (t, 0, 2), v, name='c') # geodesic with init.vect. v c1 = M.integrated_geodesic(g, (t, 0, 2), v1, name='c1') # geodesic with init.vect. v1 sol = c.solve() # find the geodesic facing right interp = c.interpolate() # interpolate the result p0=c.plot_integrated(thickness=2) # plot the geodesic c sol1=c1.solve() # find the geodesic facing left interp1 = c1.interpolate() # interpolate the result p1=c1.plot_integrated(thickness=2) # plot the geodesic c1 (p0+p1).show(aspect_ratio=1,figsize=[4,4]) # combine plots
Image in a Jupyter notebook

Now let us show how the other geodesics through the same point may look.

First we repeat the six commands defining the Poincaré half-plane.

M = Manifold(2, 'M', structure='Riemannian') X.<x,y> = M.chart('x y:(0,+oo)') g = M.metric() g[0,0], g[1,1] = 1/y^2, 1/y^2 p = M((0,1), name='p') t = var('t')

Next we plot 6 geodesics facing right, 6 geodesics facing left, one geodesic facing up and one geodesic pointing down.

Gr=[] # list of plots for y in range(-1,5): # 6 geodesics pointing facing *right* v = M.tangent_space(p)((1,y),name='v') # initial tangent vector c = M.integrated_geodesic(g,(t,0,2),v,name='c') # define geodesic sol = c.solve() # find the geodesic points interp = c.interpolate() # interpolate the result gr=c.plot_integrated(thickness=2) # plot the geodesic Gr=Gr+[gr] # add the plot to the list of plots for y in range(-1,5): # 6 geodesics pointing facing *left* v = M.tangent_space(p)((-1,y), name='v') c = M.integrated_geodesic(g,(t,0,2),v,name='c') # comments as above sol = c.solve() interp = c.interpolate() gr=c.plot_integrated(thickness=2) Gr=Gr+[gr] # vertical geodesic facing up v = M.tangent_space(p)((0,1), name='v') c = M.integrated_geodesic(g,(t,0,2),v,name='c') # comments as above sol = c.solve() interp = c.interpolate() gr=c.plot_integrated(thickness=3) Gr=Gr+[gr] # vertical geodesic pointing down v = M.tangent_space(p)((0,-1), name='v') c = M.integrated_geodesic(g,(t,0,2),v,name='c') # comments as above sol = c.solve() interp = c.interpolate() gr=c.plot_integrated(thickness=2) Gr=Gr+[gr] sum(Gr).show(aspect_ratio=1) # combine all plots
Image in a Jupyter notebook

As we can see (one can suspect that) geodesics in Poincare half-plane are semicircles or vertical half-lines.



Example 22.8

Show (numerically) that one of the geodesics on the sphere S2S^2 is the "equator".

N = Manifold(2, 'N') # manifold N=S^2 c_sph.<theta,phi>=N.chart() # spherical coordinates g=N.metric('g') # metric on S^2 g[0,0],g[1,1]=1,sin(theta)^2 # components of g p = N((pi/2,pi), name='p') # initial point on S^2 t = var('t') # symbolic variable for geodesic v = N.tangent_space(p)((0,1), name='v') # tang.vector at p # define geodesic c = N.integrated_geodesic(g, (t, 0, 2*pi), v, name='c') sol = c.solve() # find the geodesic points interp = c.interpolate() # interpolate the result

The geodesic is computed, but to show a 3-dimensional picture we need the embedding ψ:S2R3 \psi: S^2\to R^3.

M = Manifold(3, 'R^3') # manifold M=R^3 c_xyz.<x,y,z> = M.chart() # Cartesian coordinates psi = N.diff_map(M, (sin(theta)*cos(phi), sin(theta)*sin(phi),cos(theta)), name='psi',latex_name=r'\psi') # embedding s^2 -> R^3 # plot the geodesic: p1=c.plot_integrated(c_xyz,mapping=psi,thickness=3,color='red', plot_points=200, aspect_ratio=1,label_axes=False) p2=sphere(color='lightgrey',opacity=0.6) # plot sphere (p1+p2).show(frame=False) # combine plots

What's next?

Take a look at the notebook Curvature.