CoCalc Shared FilesBHLectures / sage / Kottler_solution.ipynb
Author: Eric Gourgoulhon
Views : 13

# Solving Einstein equation to get Kottler solution

This Jupyter/SageMath worksheet is relative to the lectures Geometry and physics of black holes

These computations are based on SageManifolds (version 1.0, as included in SageMath 7.5 and higher versions)

Click here to download the worksheet file (ipynb format). To run it, you must start SageMath with the Jupyter notebook, with the command sage -n jupyter

NB: a version of SageMath at least equal to 7.5 is required to run this worksheet:

In [1]:
version()

'SageMath version 8.0.beta6, Release Date: 2017-05-12'

First we set up the notebook to display mathematical objects using LaTeX formatting:

In [2]:
%display latex


## Spacetime

We declare the spacetime manifold $M$:

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

4-dimensional differentiable manifold M

We declare the chart of spherical coordinates $(t,r,\theta,\phi)$:

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

$\left(M,(t, r, {\theta}, {\phi})\right)$

The static and spherically symmetric metric ansatz, with the unknown functions $A(r)$ and $B(r)$:

In [5]:
g = M.lorentzian_metric('g')
A = function('A')
B = function('B')
g[0,0] = -A(r)
g[1,1] = B(r)
g[2,2] = r^2
g[3,3] = (r*sin(th))^2
g.display()

$g = -A\left(r\right) \mathrm{d} t\otimes \mathrm{d} t + B\left(r\right) \mathrm{d} r\otimes \mathrm{d} r + r^{2} \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + r^{2} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$

The Christoffel symbols of $g$, with respect to the default chart:

In [6]:
g.christoffel_symbols_display()

$\begin{array}{lcl} \Gamma_{ \phantom{\, t} \, t \, r }^{ \, t \phantom{\, t} \phantom{\, r} } & = & \frac{\frac{\partial\,A}{\partial r}}{2 \, A\left(r\right)} \\ \Gamma_{ \phantom{\, r} \, t \, t }^{ \, r \phantom{\, t} \phantom{\, t} } & = & \frac{\frac{\partial\,A}{\partial r}}{2 \, B\left(r\right)} \\ \Gamma_{ \phantom{\, r} \, r \, r }^{ \, r \phantom{\, r} \phantom{\, r} } & = & \frac{\frac{\partial\,B}{\partial r}}{2 \, B\left(r\right)} \\ \Gamma_{ \phantom{\, r} \, {\theta} \, {\theta} }^{ \, r \phantom{\, {\theta}} \phantom{\, {\theta}} } & = & -\frac{r}{B\left(r\right)} \\ \Gamma_{ \phantom{\, r} \, {\phi} \, {\phi} }^{ \, r \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & -\frac{r \sin\left({\theta}\right)^{2}}{B\left(r\right)} \\ \Gamma_{ \phantom{\, {\theta}} \, r \, {\theta} }^{ \, {\theta} \phantom{\, r} \phantom{\, {\theta}} } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\theta}} \, {\phi} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & -\cos\left({\theta}\right) \sin\left({\theta}\right) \\ \Gamma_{ \phantom{\, {\phi}} \, r \, {\phi} }^{ \, {\phi} \phantom{\, r} \phantom{\, {\phi}} } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\phi}} \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta}} \phantom{\, {\phi}} } & = & \frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)} \end{array}$

## Einstein equation

The cosmological constant:

In [7]:
var('Lamb', latex_name='\Lambda')

${\Lambda}$

The Einstein equation:

In [8]:
EE = g.ricci() - 1/2*g.ricci_scalar()*g + Lamb*g
EE.set_name('E')
print(EE)

Field of symmetric bilinear forms E on the 4-dimensional differentiable manifold M
In [9]:
EE.display_comp()

$\begin{array}{lcl} E_{ \, t \, t }^{ \phantom{\, t}\phantom{\, t} } & = & -\frac{{\left({\Lambda} r^{2} - 1\right)} A\left(r\right) B\left(r\right)^{2} - r A\left(r\right) \frac{\partial\,B}{\partial r} + A\left(r\right) B\left(r\right)}{r^{2} B\left(r\right)^{2}} \\ E_{ \, r \, r }^{ \phantom{\, r}\phantom{\, r} } & = & \frac{{\left({\Lambda} r^{2} - 1\right)} A\left(r\right) B\left(r\right) + r \frac{\partial\,A}{\partial r} + A\left(r\right)}{r^{2} A\left(r\right)} \\ E_{ \, {\theta} \, {\theta} }^{ \phantom{\, {\theta}}\phantom{\, {\theta}} } & = & \frac{4 \, {\Lambda} r^{2} A\left(r\right)^{2} B\left(r\right)^{2} - r^{2} B\left(r\right) \left(\frac{\partial\,A}{\partial r}\right)^{2} + 2 \, r^{2} A\left(r\right) B\left(r\right) \frac{\partial^2\,A}{\partial r ^ 2} + 2 \, r A\left(r\right) B\left(r\right) \frac{\partial\,A}{\partial r} - {\left(r^{2} A\left(r\right) \frac{\partial\,A}{\partial r} + 2 \, r A\left(r\right)^{2}\right)} \frac{\partial\,B}{\partial r}}{4 \, A\left(r\right)^{2} B\left(r\right)^{2}} \\ E_{ \, {\phi} \, {\phi} }^{ \phantom{\, {\phi}}\phantom{\, {\phi}} } & = & \frac{{\left(4 \, {\Lambda} r^{2} A\left(r\right)^{2} B\left(r\right)^{2} - r^{2} B\left(r\right) \left(\frac{\partial\,A}{\partial r}\right)^{2} + 2 \, r^{2} A\left(r\right) B\left(r\right) \frac{\partial^2\,A}{\partial r ^ 2} + 2 \, r A\left(r\right) B\left(r\right) \frac{\partial\,A}{\partial r} - {\left(r^{2} A\left(r\right) \frac{\partial\,A}{\partial r} + 2 \, r A\left(r\right)^{2}\right)} \frac{\partial\,B}{\partial r}\right)} \sin\left({\theta}\right)^{2}}{4 \, A\left(r\right)^{2} B\left(r\right)^{2}} \end{array}$

### Simplifying and rearranging the equations

In [10]:
eq0 = EE[0,0]*r^2*B(r)^2/A(r); eq0

$-\frac{{\left({\Lambda} r^{2} - 1\right)} A\left(r\right) B\left(r\right)^{2} - r A\left(r\right) \frac{\partial\,B}{\partial r} + A\left(r\right) B\left(r\right)}{A\left(r\right)}$
In [11]:
eq1 = EE[1,1]*r^2*A(r); eq1

${\left({\Lambda} r^{2} - 1\right)} A\left(r\right) B\left(r\right) + r \frac{\partial\,A}{\partial r} + A\left(r\right)$
In [12]:
eq2 = EE[2,2]*4*A(r)^2*B(r)^2; eq2

$4 \, {\Lambda} r^{2} A\left(r\right)^{2} B\left(r\right)^{2} - r^{2} B\left(r\right) \left(\frac{\partial\,A}{\partial r}\right)^{2} + 2 \, r^{2} A\left(r\right) B\left(r\right) \frac{\partial^2\,A}{\partial r ^ 2} + 2 \, r A\left(r\right) B\left(r\right) \frac{\partial\,A}{\partial r} - {\left(r^{2} A\left(r\right) \frac{\partial\,A}{\partial r} + 2 \, r A\left(r\right)^{2}\right)} \frac{\partial\,B}{\partial r}$
In [13]:
eq3 = EE[3,3]*4*A(r)^2*B(r)^2/sin(th)^2; eq3

$4 \, {\Lambda} r^{2} A\left(r\right)^{2} B\left(r\right)^{2} - r^{2} B\left(r\right) \left(\frac{\partial\,A}{\partial r}\right)^{2} + 2 \, r^{2} A\left(r\right) B\left(r\right) \frac{\partial^2\,A}{\partial r ^ 2} + 2 \, r A\left(r\right) B\left(r\right) \frac{\partial\,A}{\partial r} - {\left(r^{2} A\left(r\right) \frac{\partial\,A}{\partial r} + 2 \, r A\left(r\right)^{2}\right)} \frac{\partial\,B}{\partial r}$
In [14]:
eq3 == eq2

$\mathrm{True}$

## Solving Einstein equation

The following combination of eq0 and eq1 is particularly simple:

In [15]:
eq4 = (eq0*A(r) + eq1*B(r))/r; eq4

$\frac{r B\left(r\right) \frac{\partial\,A}{\partial r} + r A\left(r\right) \frac{\partial\,B}{\partial r}}{r}$

The solution is $A(r)B(r)=C$, where $C$ is a constant:

In [16]:
s = desolve(eq4.expr() == 0, B(r), ivar=r)
s

$\frac{C}{A\left(r\right)}$

Let us rename the constant to $\alpha$:

In [17]:
var('alpha', latex_name=r'\alpha')
B_sol(r) = s.subs(_C=alpha); B_sol

$r \ {\mapsto}\ \frac{{\alpha}}{A\left(r\right)}$

We replace $B(r)$ by the above value in the remaining equations:

In [18]:
eq5 = X.function(eq1.expr().substitute_function(B, B_sol)); eq5

${\left({\Lambda} r^{2} - 1\right)} {\alpha} + r \frac{\partial\,A}{\partial r} + A\left(r\right)$
In [19]:
eq6 = X.function(eq2.expr().substitute_function(B, B_sol)); eq6

$4 \, {\Lambda} {\alpha}^{2} r^{2} - \frac{{\alpha} r^{2} \left(\frac{\partial\,A}{\partial r}\right)^{2}}{A\left(r\right)} + 2 \, {\alpha} r^{2} \frac{\partial^2\,A}{\partial r ^ 2} + 2 \, {\alpha} r \frac{\partial\,A}{\partial r} + \frac{{\left(r^{2} A\left(r\right) \frac{\partial\,A}{\partial r} + 2 \, r A\left(r\right)^{2}\right)} {\alpha} \frac{\partial\,A}{\partial r}}{A\left(r\right)^{2}}$

Let us solve eq5 for $A(r)$. Note that we are using eq5.expr() to get a symbolic expression, as expected by the function desolve, while eq5 is a coordinate function.

In [20]:
s = desolve(eq5.expr() == 0, A(r), ivar=r)
s.expand()

$-\frac{1}{3} \, {\Lambda} {\alpha} r^{2} + {\alpha} + \frac{C}{r}$

We rename the constant $C$ to $-2m$ and set the value of constant $\alpha$ to $1$:

In [21]:
var('m')
A_sol(r) = s.subs(_C=-2*m, alpha=1).expand()
A_sol

$r \ {\mapsto}\ -\frac{1}{3} \, {\Lambda} r^{2} - \frac{2 \, m}{r} + 1$

Let us check that eq6 is fulfilled by the found value of $A(r)$:

In [22]:
eq6.expr().substitute_function(A, A_sol).subs(alpha=1).simplify_full()

$0$

### Final expression of the metric

We have got the Kottler metric:

In [23]:
g[0,0] = -A_sol(r)
g[1,1] = 1/A_sol(r)
g.display()

$g = \left( \frac{1}{3} \, {\Lambda} r^{2} + \frac{2 \, m}{r} - 1 \right) \mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{3}{{\Lambda} r^{2} + \frac{6 \, m}{r} - 3} \right) \mathrm{d} r\otimes \mathrm{d} r + r^{2} \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + r^{2} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$

which reduces to Schwarzschild metric as soons as the cosmological constant vanishes.

In [24]:
g.christoffel_symbols_display()

$\begin{array}{lcl} \Gamma_{ \phantom{\, t} \, t \, r }^{ \, t \phantom{\, t} \phantom{\, r} } & = & \frac{{\Lambda} r^{3} - 3 \, m}{{\Lambda} r^{4} + 6 \, m r - 3 \, r^{2}} \\ \Gamma_{ \phantom{\, r} \, t \, t }^{ \, r \phantom{\, t} \phantom{\, t} } & = & \frac{{\Lambda}^{2} r^{6} + 3 \, {\Lambda} m r^{3} - 3 \, {\Lambda} r^{4} - 18 \, m^{2} + 9 \, m r}{9 \, r^{3}} \\ \Gamma_{ \phantom{\, r} \, r \, r }^{ \, r \phantom{\, r} \phantom{\, r} } & = & -\frac{{\Lambda} r^{3} - 3 \, m}{{\Lambda} r^{4} + 6 \, m r - 3 \, r^{2}} \\ \Gamma_{ \phantom{\, r} \, {\theta} \, {\theta} }^{ \, r \phantom{\, {\theta}} \phantom{\, {\theta}} } & = & \frac{1}{3} \, {\Lambda} r^{3} + 2 \, m - r \\ \Gamma_{ \phantom{\, r} \, {\phi} \, {\phi} }^{ \, r \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & \frac{1}{3} \, {\left({\Lambda} r^{3} + 6 \, m - 3 \, r\right)} \sin\left({\theta}\right)^{2} \\ \Gamma_{ \phantom{\, {\theta}} \, r \, {\theta} }^{ \, {\theta} \phantom{\, r} \phantom{\, {\theta}} } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\theta}} \, {\phi} \, {\phi} }^{ \, {\theta} \phantom{\, {\phi}} \phantom{\, {\phi}} } & = & -\cos\left({\theta}\right) \sin\left({\theta}\right) \\ \Gamma_{ \phantom{\, {\phi}} \, r \, {\phi} }^{ \, {\phi} \phantom{\, r} \phantom{\, {\phi}} } & = & \frac{1}{r} \\ \Gamma_{ \phantom{\, {\phi}} \, {\theta} \, {\phi} }^{ \, {\phi} \phantom{\, {\theta}} \phantom{\, {\phi}} } & = & \frac{\cos\left({\theta}\right)}{\sin\left({\theta}\right)} \end{array}$

Let us check that Einstein equation is satisfied by the above metric:

In [25]:
EE = g.ricci() - 1/2*g.ricci_scalar()*g + Lamb*g
EE.set_name('E')
EE.display()

$E = 0$

The Ricci scalar is constant for this solution:

In [26]:
g.ricci_scalar().display()

$\begin{array}{llcl} \mathrm{r}\left(g\right):& M & \longrightarrow & \mathbb{R} \\ & \left(t, r, {\theta}, {\phi}\right) & \longmapsto & 4 \, {\Lambda} \end{array}$

The Ricci tensor is proportional to the metric tensor:

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

$\mathrm{Ric}\left(g\right) = \left( \frac{{\Lambda}^{2} r^{3} + 6 \, {\Lambda} m - 3 \, {\Lambda} r}{3 \, r} \right) \mathrm{d} t\otimes \mathrm{d} t + \left( -\frac{3 \, {\Lambda} r}{{\Lambda} r^{3} + 6 \, m - 3 \, r} \right) \mathrm{d} r\otimes \mathrm{d} r + {\Lambda} r^{2} \mathrm{d} {\theta}\otimes \mathrm{d} {\theta} + {\Lambda} r^{2} \sin\left({\theta}\right)^{2} \mathrm{d} {\phi}\otimes \mathrm{d} {\phi}$
In [28]:
g.ricci() == Lamb * g

$\mathrm{True}$