This Jupyter/SageMath notebook is relative to the lectures Geometry and physics of black holes. It involves computations based on differential geometry tools developed through the SageManifolds project.
version()
'SageMath version 9.5.beta5, Release Date: 2021-10-28'
First we set up the notebook to display mathematical objects using LaTeX formatting:
%display latex
We declare the spacetime manifold $M$:
M = Manifold(4, 'M')
print(M)
4-dimensional differentiable manifold M
We declare the chart of spherical coordinates $(t,r,\theta,\phi)$:
X.<t,r,th,ph> = M.chart(r't r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
X
The static and spherically symmetric metric ansatz, with the unknown functions $A(r)$ and $B(r)$:
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()
The Christoffel symbols of $g$, with respect to the default chart:
g.christoffel_symbols_display()
The cosmological constant:
Lamb = var('Lamb', latex_name=r'\Lambda')
Lamb
The Einstein equation:
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
EE.display_comp()
eq0 = EE[0,0]*r^2*B(r)^2/A(r); eq0
eq1 = EE[1,1]*r^2*A(r); eq1
eq2 = EE[2,2]*4*A(r)^2*B(r)^2; eq2
eq3 = EE[3,3]*4*A(r)^2*B(r)^2/sin(th)^2; eq3
eq3 == eq2
The following combination of eq0 and eq1 is particularly simple:
eq4 = (eq0*A(r) + eq1*B(r))/r; eq4
The solution is $A(r)B(r)=C$, where $C$ is a constant:
s = desolve(eq4.expr() == 0, B(r), ivar=r)
s
Let us rename the constant to $\alpha$:
var('alpha', latex_name=r'\alpha')
B_sol(r) = s.subs(_C=alpha); B_sol
We replace $B(r)$ by the above value in the remaining equations:
eq5 = X.function(eq1.expr().substitute_function(B, B_sol)); eq5
eq6 = X.function(eq2.expr().substitute_function(B, B_sol)); eq6
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.
s = desolve(eq5.expr() == 0, A(r), ivar=r)
s.expand()
We rename the constant $C$ to $-2m$ and set the value of constant $\alpha$ to $1$:
var('m')
A_sol(r) = s.subs(_C=-2*m, alpha=1).expand()
A_sol
Let us check that eq6
is fulfilled by the found value of $A(r)$:
eq6.expr().substitute_function(A, A_sol).subs(alpha=1).simplify_full()
We have got the Kottler metric:
g[0,0] = -A_sol(r)
g[1,1] = 1/A_sol(r)
g.display()
which reduces to Schwarzschild metric as soon as the cosmological constant vanishes.
g.christoffel_symbols_display()
Let us check that the vacuum Einstein equation is satisfied by the above metric:
EE = g.ricci() - 1/2*g.ricci_scalar()*g + Lamb*g
EE.set_name('E')
EE.display()
The Ricci scalar is constant for this solution:
g.ricci_scalar().display()
The Ricci tensor is proportional to the metric tensor:
g.ricci().display()
g.ricci() == Lamb * g