Schwarzschild spacetime: basic computations
This notebook shows how to use SageMath to compute the Christoffel symbols of the metric with respect to 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 project.
A more advanced notebook about Schwarzschild spacetime, involving many coordinate charts, more tensor calculus and graphical outputs, is available here.
Click here 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:
First we set up the notebook to display mathematical objects via LaTeX rendering:
Spacetime manifold
We declare the spacetime manifold as a 4-dimensional Lorentzian manifold:
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.
Metric tensor
We introduce first the mass parameter as a symbolic variable, via the function var()
:
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
:
Viewing the metric components as a matrix:
Accessing to a specific component:
Christoffel symbols
The Christoffel symbols of 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.
Accessing to a Christoffel symbol specified by its indices:
Checking the symmetry on the last two indices:
Einstein equation
Let us check that is a solution of the vacuum Einstein equation, i.e. that its Ricci tensor vanishes identically:
Curvature tensor
The Riemann curvature tensor is obtained by the method riemann()
:
Contrary to the Ricci tensor, it is not identically zero:
The component of the Riemann tensor:
Kretschmann scalar
The Kretschmann scalar is the "square" of the Riemann tensor defined by To compute it, we must first form the tensor fields whose components are and . They are obtained by respectively lowering and raising the indices of the components of the Riemann tensor, via the metric . These two operations are performed by the methods down()
and up()
. The contraction is performed by summation on repeated indices, using LaTeX notations:
The symbolic expression representing the scalar field is returned by the method expr()
: