The Schwarzschild spacetime

This notebook shows how you can do component computations in Cadabra. It is a translation of the Cadabra notebook https://cadabra.science/notebooks/schwarzschild.html to Jupyter.

The first thing we always need to do is to declare the coordinates used, and the names of the indices.


In [1]:
{r,t,\phi,\theta}::Coordinate;
{\mu,\nu,\rho,\sigma,\lambda,\kappa,\chi,\gamma}::Indices(values={t,r,\phi,\theta}, position=fixed);
\partial{#}::PartialDerivative;
g_{\mu\nu}::Metric.
g^{\mu\nu}::InverseMetric.


Out[1]:

${}\text{Attached property Coordinate to~}\left[r,~ t,~ \phi,~ \theta\right].$

Out[1]:

${}\text{Attached property Indices(position=fixed) to~}\left[\mu,~ \nu,~ \rho,~ \sigma,~ \lambda,~ \kappa,~ \chi,~ \gamma\right].$

Out[1]:

${}\text{Attached property PartialDerivative to~}\partial{\#}.$

Below is the Schwarzschild metric in standard coordinates. Note how the components are given in terms of substitution rules, and how the inverse metric is computed. The \algo{complete} algorithm adds the rules for the inverse metric to the rules for the metric.


In [2]:
ss:= { g_{t t} = -(1-2 M/r),   
       g_{r r} = 1/(1-2 M/r), 
       g_{\theta\theta} = r**2, 
       g_{\phi\phi}=r**2 \sin(\theta)**2
     }.

complete(ss, $g^{\mu\nu}$);


Out[2]:

${}\left[g_{t t} = -1+2M {r}^{-1},~ g_{r r} = {\left(1-2M {r}^{-1}\right)}^{-1},~ g_{\theta \theta} = {r}^{2},~ g_{\phi \phi} = {r}^{2} {\left(\sin{\theta}\right)}^{2},~ g^{t t} = {\left(2M {r}^{-1}-1\right)}^{-1},~ g^{r r} = -2M {r}^{-1}+1,~ g^{\phi \phi} = {\left({r}^{2} {\left(\sin{\theta}\right)}^{2}\right)}^{-1},~ g^{\theta \theta} = {r}^{-2}\right]$

We can now compute the Christoffel symbols. We give Cadabra the expression for the Christoffel symbols in terms of the metric, and then evaluate the components of the metric using the evaluate algorithm.


In [3]:
ch:= \Gamma^{\mu}_{\nu\rho} = 1/2 g^{\mu\sigma} ( 
                                   \partial_{\rho}{g_{\nu\sigma}} 
                                  +\partial_{\nu}{g_{\rho\sigma}}
                                  -\partial_{\sigma}{g_{\nu\rho}} ):
                          
evaluate(ch, ss, rhsonly=True);


Out[3]:

${}\Gamma^{\mu}\,_{\nu \rho} = \frac{1}{2}g^{\mu \sigma} \left(\partial_{\rho}{g_{\nu \sigma}}+\partial_{\nu}{g_{\rho \sigma}}-\partial_{\sigma}{g_{\nu \rho}}\right)$

Out[3]:

${}\Gamma^{\mu}\,_{\nu \rho} = \square{}_{\nu}{}_{\rho}{}^{\mu}\left\{\begin{aligned}\square{}_{\phi}{}_{r}{}^{\phi}= & {r}^{-1}\\[-.5ex] \square{}_{\phi}{}_{\theta}{}^{\phi}= & {\left(\tan{\theta}\right)}^{-1}\\[-.5ex] \square{}_{\theta}{}_{r}{}^{\theta}= & {r}^{-1}\\[-.5ex] \square{}_{r}{}_{r}{}^{r}= & M {\left(r \left(2M-r\right)\right)}^{-1}\\[-.5ex] \square{}_{t}{}_{r}{}^{t}= & M {\left(r \left(-2M+r\right)\right)}^{-1}\\[-.5ex] \square{}_{r}{}_{\phi}{}^{\phi}= & {r}^{-1}\\[-.5ex] \square{}_{\theta}{}_{\phi}{}^{\phi}= & {\left(\tan{\theta}\right)}^{-1}\\[-.5ex] \square{}_{r}{}_{\theta}{}^{\theta}= & {r}^{-1}\\[-.5ex] \square{}_{r}{}_{t}{}^{t}= & M {\left(r \left(-2M+r\right)\right)}^{-1}\\[-.5ex] \square{}_{\phi}{}_{\phi}{}^{r}= & \left(2M-r\right) {\left(\sin{\theta}\right)}^{2}\\[-.5ex] \square{}_{\phi}{}_{\phi}{}^{\theta}= & - \frac{1}{2}\sin\left(2\theta\right)\\[-.5ex] \square{}_{\theta}{}_{\theta}{}^{r}= & 2M-r\\[-.5ex] \square{}_{t}{}_{t}{}^{r}= & M \left(-2M+r\right) {r}^{-3}\\[-.5ex] \end{aligned}\right. $

Continuing from here we can compute the Riemann tensor components. Again, we start by giving this tensor in terms of the Christoffel symbols. We then subsitute the Christoffel symbols just found, and work out any remaining component substitions using evaluate (the computation takes a few seconds, essentially because of the round trips through Sympy).


In [4]:
rm:= R^{\rho}_{\sigma\mu\nu} = \partial_{\mu}{\Gamma^{\rho}_{\nu\sigma}}
                                  -\partial_{\nu}{\Gamma^{\rho}_{\mu\sigma}}
                                  +\Gamma^{\rho}_{\mu\lambda} \Gamma^{\lambda}_{\nu\sigma}
                                  -\Gamma^{\rho}_{\nu\lambda} \Gamma^{\lambda}_{\mu\sigma};


Out[4]:

${}R^{\rho}\,_{\sigma \mu \nu} = \partial_{\mu}{\Gamma^{\rho}\,_{\nu \sigma}}-\partial_{\nu}{\Gamma^{\rho}\,_{\mu \sigma}}+\Gamma^{\rho}\,_{\mu \lambda} \Gamma^{\lambda}\,_{\nu \sigma}-\Gamma^{\rho}\,_{\nu \lambda} \Gamma^{\lambda}\,_{\mu \sigma}$


In [5]:
substitute(rm, ch)
evaluate(rm, ss, rhsonly=True);


Out[5]:

${}R^{\rho}\,_{\sigma \mu \nu} = \square{}_{\nu}{}_{\sigma}{}^{\rho}{}_{\mu}\left\{\begin{aligned}\square{}_{t}{}_{t}{}^{r}{}_{r}= & 2M \left(2M-r\right) {r}^{-4}\\[-.5ex] \square{}_{\theta}{}_{\theta}{}^{r}{}_{r}= & -M {r}^{-1}\\[-.5ex] \square{}_{\phi}{}_{\phi}{}^{\theta}{}_{\theta}= & 2M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{\phi}{}_{\phi}{}^{r}{}_{r}= & -M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{t}{}_{r}{}^{t}{}_{r}= & 2M {\left({r}^{2} \left(2M-r\right)\right)}^{-1}\\[-.5ex] \square{}_{\phi}{}_{\theta}{}^{\phi}{}_{\theta}= & -2M {r}^{-1}\\[-.5ex] \square{}_{r}{}_{t}{}^{r}{}_{t}= & 2M \left(-2M+r\right) {r}^{-4}\\[-.5ex] \square{}_{r}{}_{\theta}{}^{r}{}_{\theta}= & M {r}^{-1}\\[-.5ex] \square{}_{\theta}{}_{\phi}{}^{\theta}{}_{\phi}= & -2M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{r}{}_{\phi}{}^{r}{}_{\phi}= & M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{r}{}_{r}{}^{t}{}_{t}= & 2M {\left({r}^{2} \left(-2M+r\right)\right)}^{-1}\\[-.5ex] \square{}_{r}{}_{r}{}^{\theta}{}_{\theta}= & M {\left({r}^{2} \left(2M-r\right)\right)}^{-1}\\[-.5ex] \square{}_{\theta}{}_{\theta}{}^{\phi}{}_{\phi}= & 2M {r}^{-1}\\[-.5ex] \square{}_{r}{}_{r}{}^{\phi}{}_{\phi}= & M {\left({r}^{2} \left(2M-r\right)\right)}^{-1}\\[-.5ex] \square{}_{t}{}_{t}{}^{\phi}{}_{\phi}= & M \left(-2M+r\right) {r}^{-4}\\[-.5ex] \square{}_{t}{}_{t}{}^{\theta}{}_{\theta}= & M \left(-2M+r\right) {r}^{-4}\\[-.5ex] \square{}_{\phi}{}_{\phi}{}^{t}{}_{t}= & -M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{\theta}{}_{\theta}{}^{t}{}_{t}= & -M {r}^{-1}\\[-.5ex] \square{}_{\phi}{}_{r}{}^{\phi}{}_{r}= & M {\left({r}^{2} \left(-2M+r\right)\right)}^{-1}\\[-.5ex] \square{}_{\phi}{}_{t}{}^{\phi}{}_{t}= & M \left(2M-r\right) {r}^{-4}\\[-.5ex] \square{}_{\theta}{}_{r}{}^{\theta}{}_{r}= & M {\left({r}^{2} \left(-2M+r\right)\right)}^{-1}\\[-.5ex] \square{}_{\theta}{}_{t}{}^{\theta}{}_{t}= & M \left(2M-r\right) {r}^{-4}\\[-.5ex] \square{}_{t}{}_{\phi}{}^{t}{}_{\phi}= & M {\left(\sin{\theta}\right)}^{2} {r}^{-1}\\[-.5ex] \square{}_{t}{}_{\theta}{}^{t}{}_{\theta}= & M {r}^{-1}\\[-.5ex] \end{aligned}\right. $

The Ricci tensor should of course vanish as the Schwarzschild solution is a vacuum solution. Following the same logic as above, this is easily verified:


In [6]:
rc:= R_{\sigma\nu} = R^{\rho}_{\sigma\rho\nu};
substitute(rc, rm)
evaluate(rc, ss, rhsonly=True);


Out[6]:

${}R_{\sigma \nu} = R^{\rho}\,_{\sigma \rho \nu}$

Out[6]:

${}R_{\sigma \nu} = 0$

More interesting is the Kretschmann scalar.


In [7]:
K:= K = R^{\mu}_{\nu\rho\sigma} R^{\lambda}_{\kappa\gamma\chi} 
           g_{\mu\lambda} g^{\nu\kappa} g^{\rho\gamma} g^{\sigma\chi};


Out[7]:

${}K = R^{\mu}\,_{\nu \rho \sigma} R^{\lambda}\,_{\kappa \gamma \chi} g_{\mu \lambda} g^{\nu \kappa} g^{\rho \gamma} g^{\sigma \chi}$


In [8]:
substitute(K, rm)
evaluate(K, ss, rhsonly=True);


Out[8]:

${}K = 48{M}^{2} {r}^{-6}$

This shows that $r=0$ is a true singularity.


In [ ]: