Sunteți pe pagina 1din 6

10/12/2018 Jupyter Notebook Viewer

SageManifolds (/github/sagemanifolds/SageManifolds/tree/master)
/ Worksheets (/github/sagemanifolds/SageManifolds/tree/master/Worksheets)
/ v1.3 (/github/sagemanifolds/SageManifolds/tree/master/Worksheets/v1.3)

Schwarzschild spacetime: basic


computations
This notebook shows how to use SageMath to compute the Christoffel symbols of standard
coordinates in Schwarzschild spacetime, as well as the Riemann curvature tensor and the
Kretschmann scalar. The corresponding tools have been developed within the SageManifolds
(https://sagemanifolds.obspm.fr) project (version 1.3, as included in SageMath 8.3).

A more advanced notebook about Schwarzschild spacetime, involving many coordinate charts,
more tensor calculus and graphical outputs, is available here
(http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM

Click here
(https://raw.githubusercontent.com/sagemanifolds/SageManifolds/master/Worksheets/v1.3/SM_S
to download the notebook file (ipynb format). To run it, you must start SageMath with the
Jupyter interface, via the command sage -n jupyter

NB: a version of SageMath at least equal to 8.2 is required to run this notebook:

In [1]: version()

Out[1]: 'SageMath version 8.3, Release Date: 2018-08-03'

First we set up the notebook to display mathematical objects via LaTeX rendering:

In [2]: %display latex

Spacetime manifold ¶
We declare the spacetime manifold as a 4-dimensional Lorentzian manifold:

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 1/6
10/12/2018 Jupyter Notebook Viewer

In [3]: M = Manifold(4, 'M', structure='Lorentzian')


print(M)

4-dimensional Lorentzian manifold M

Standard coordinates
The standard Schwarzschild-Droste coordinates are introduced via the method chart()
applied to the manifold object M . Note that the argument of chart() is a raw string (hence
the prefix r in front of it), which defines the range of each coordinate, if different from
(−∞, +∞), as well as its LaTeX symbol, if different from the Python symbol to denote the

coordinate. The Python variables for each coordinate are declared within the <...> operator
on the left-hand side, X denoting the Python variable chosen for the coordinate chart.

In [4]: X.<t,r,th,ph> = M.chart(r"t r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi")


X

Out[4]: (M , (t, r, θ, ϕ))

In [5]: X[:]

Out[5]: (t, r, θ, ϕ)

In [6]: X[0], X[3]

Out[6]: (t, ϕ)

Metric tensor
We introduce first the mass parameter m as a symbolic variable, via the function var() :

In [7]: m = var('m')
assume(m>=0)

The metric tensor of the Lorentzian manifold M is returned by the method metric() ; we
initialize its components in the chart X , which is the default (unique) chart on M :

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 2/6
10/12/2018 Jupyter Notebook Viewer

In [8]: g = M.metric()
g[0,0] = -(1-2*m/r)
g[1,1] = 1/(1-2*m/r)
g[2,2] = r^2
g[3,3] = (r*sin(th))^2
g.display()

Out[8]: 2m 1 2 2 2
g = ( − 1) dt ⊗ dt + (− ) dr ⊗ dr + r dθ ⊗ dθ + r sin (θ) dϕ ⊗ dϕ
2 m
r − 1
r

Viewing the metric components as a matrix:

In [9]: g[:]

Out[9]: 2 m
− 1 0 0 0⎞
⎛ r

1
⎜ 0 − 0 0⎟
⎜ 2 m ⎟
−1
⎜ r ⎟
⎜ 2

⎜ 0 0 r 0⎟

⎝ 2 2 ⎠
0 0 0 r sin (θ)

Accessing to a specific component:

In [10]: g[0,0]

Out[10]: 2m
− 1
r

Christoffel symbols
The Christoffel symbols of g with respect to the Schwarzschild-Droste coordinates are printed
by the method christoffel_symbols_display() applied to the metric object g . By
default, only the nonzero symbols and the nonredundant ones (taking into account the
symmetry of the last two indices) are displayed. Type g.christoffel_symbols_display? to
see all possible options.

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 3/6
10/12/2018 Jupyter Notebook Viewer

In [11]: g.christoffel_symbols_display()

Out[11]: Γ
t
t r
= −
m

2
2 mr−r

2
r 2 m −mr
Γ = −
t t 3
r

r m
Γ r r =
2
2 mr−r

r
Γ = 2m − r
θ θ

r 2
Γ = (2 m − r) sin (θ)
ϕ ϕ

θ 1
Γ =
r θ r

θ
Γ = − cos(θ) sin(θ)
ϕ ϕ

ϕ 1
Γ =
r ϕ r

ϕ cos(θ)
Γ =
θ ϕ sin(θ)

Accessing to a Christoffel symbol specified by its indices:

In [12]: g.christoffel_symbols()[0,0,1]

Out[12]: m

2
2 mr − r

Checking the symmetry on the last two indices:

In [13]: g.christoffel_symbols()[0,0,1] == g.christoffel_symbols()[0,1,0]

Out[13]: True

Einstein equation
Let us check that g is a solution of the vacuum Einstein equation, i.e. that its Ricci tensor
vanishes identically:

In [14]: g.ricci()

Out[14]: Ric (g)

In [15]: g.ricci().display()

Out[15]: Ric (g) = 0

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 4/6
10/12/2018 Jupyter Notebook Viewer

In [16]: g.ricci()[:]

Out[16]: 0 0 0 0
⎛ ⎞

⎜0 0 0 0⎟
⎜ ⎟
⎜0 0 0 0⎟
⎝ ⎠
0 0 0 0

Curvature tensor
The Riemann curvature tensor is obtained by the method riemann() :

In [17]: R = g.riemann()
print(R)

Tensor field Riem(g) of type (1,3) on the 4-dimensional Lorentzian manifold M

Contrary to the Ricci tensor, it is not identically zero:

In [18]: R.display()

Out[18]: 2m ∂ 2m ∂
Riem (g) = (− ) ⊗ dr ⊗ dt ⊗ dr + ( ) ⊗ dr ⊗ dr ⊗
2 3 2 3
2 mr − r ∂t 2 mr − r ∂t

2 2
m ∂ m sin (θ) ∂ m sin (θ)
⊗ dθ + ⊗ dθ ⊗ dθ ⊗ dt − ⊗ dϕ ⊗ dt ⊗ dϕ +
r ∂t r ∂t r ∂
2 2
2 (2 m − mr) ∂ 2 (2 m − mr) ∂ m ∂
− ⊗ dt ⊗ dt ⊗ dr + ⊗ dt ⊗ dr ⊗ dt −
4 4
r ∂r r ∂r r ∂r

2 2
m sin (θ) ∂ m sin (θ) ∂
⊗ dθ ⊗ dθ ⊗ dr − ⊗ dϕ ⊗ dr ⊗ dϕ + ⊗ dϕ ⊗ dϕ ⊗ d
r ∂r r ∂r

2
2m − mr ∂ m ∂
⊗ dt ⊗ dt ⊗ dθ + (− ) ⊗ dt ⊗ dθ ⊗ dt + (− )
4 2 3
r ∂θ 2 mr − r ∂

2
m ∂ 2 m sin (θ) ∂ 2 m sin
+ ( ) ⊗ dr ⊗ dθ ⊗ dr + ⊗ dϕ ⊗ dθ ⊗ dϕ −
2 3
2 mr − r ∂θ r ∂θ r

2 2
2m − mr ∂ 2m − mr ∂
+ ( ) ⊗ dt ⊗ dt ⊗ dϕ + (− ) ⊗ dt ⊗ dϕ ⊗ dt + (−
4 4
r ∂ϕ r ∂ϕ

m ∂ 2m ∂ 2
⊗ dr ⊗ dϕ + ( ) ⊗ dr ⊗ dϕ ⊗ dr − ⊗ dθ ⊗ dθ ⊗ dϕ +
2 3
2 mr − r ∂ϕ r ∂ϕ

The component R0 101 = R


t
  trt
of the Riemann tensor:

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 5/6
10/12/2018 Jupyter Notebook Viewer

In [19]: R[0,1,0,1]

Out[19]: 2m

2 3
2 mr − r

Kretschmann scalar
The Kretschmann scalar is the "square" of the Riemann tensor defined by
abcd
K = R abcd R

To compute it, we must form first the tensor fields whose components are Rabcd and Rabcd .
They are obtained by respectively lowering and raising the indices of the components Ra  bcd of
the Riemann tensor, via the metric g. These two operations are performed by the methods
down() and up() . The contraction is performed by summation on repeated indices, using
LaTeX notations:

In [20]: K = R.down(g)['_{abcd}'] * R.up(g)['^{abcd}']


K

Out[20]: Scalar field on the 4-dimensional Lorentzian manifold M

In [21]: K.display()

Out[21]: M ⟶ R
2
48 m
(t, r, θ, ϕ) ⟼
6
r

The symbolic expression representing the scalar field K is returned by the method expr() :

In [22]: K.expr()

Out[22]: 48 m
2

6
r

http://nbviewer.jupyter.org/github/sagemanifolds/SageManifolds/blob/master/Worksheets/v1.3/SM_basic_Schwarzschild.ipynb 6/6

S-ar putea să vă placă și