{ "cells": [ { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "# Solving Einstein equation to get Kottler solution\n", "\n", "This Jupyter/SageMath worksheet is relative to the lectures\n", "[Geometry and physics of black holes](http://luth.obspm.fr/~luthier/gourgoulhon/bh16/)\n", " \n", "These computations are based on [SageManifolds](http://sagemanifolds.obspm.fr) (version 1.0, as included in SageMath 7.5 and higher versions)\n", "\n", "Click [here](https://raw.githubusercontent.com/egourgoulhon/BHLectures/master/sage/Kottler_solution.ipynb) to download the worksheet file (ipynb format). To run it, you must start SageMath with the Jupyter notebook, with the command `sage -n jupyter`\n", "\n", "*NB:* a version of SageMath at least equal to 7.5 is required to run this worksheet: " ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "'SageMath version 8.0.beta6, Release Date: 2017-05-12'" ] }, "execution_count": 1, "metadata": { }, "output_type": "execute_result" } ], "source": [ "version()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "First we set up the notebook to display mathematical objects using LaTeX formatting:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "deletable": true, "editable": true }, "outputs": [ ], "source": [ "%display latex" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "## Spacetime\n", "\n", "We declare the spacetime manifold $M$:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "4-dimensional differentiable manifold M\n" ] } ], "source": [ "M = Manifold(4, 'M')\n", "print(M)" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "We declare the chart of spherical coordinates $(t,r,\\theta,\\phi)$:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 4, "metadata": { }, "output_type": "execute_result" } ], "source": [ "X. = M.chart(r't r:(0,+oo) th:(0,pi):\\theta ph:(0,2*pi):\\phi')\n", "X" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The static and spherically symmetric metric ansatz, with the unknown functions $A(r)$ and $B(r)$:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 5, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g = M.lorentzian_metric('g')\n", "A = function('A')\n", "B = function('B')\n", "g[0,0] = -A(r)\n", "g[1,1] = B(r)\n", "g[2,2] = r^2\n", "g[3,3] = (r*sin(th))^2\n", "g.display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The Christoffel symbols of $g$, with respect to the default chart:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 6, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g.christoffel_symbols_display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "## Einstein equation" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The cosmological constant:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 7, "metadata": { }, "output_type": "execute_result" } ], "source": [ "var('Lamb', latex_name='\\Lambda')" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The Einstein equation:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Field of symmetric bilinear forms E on the 4-dimensional differentiable manifold M\n" ] } ], "source": [ "EE = g.ricci() - 1/2*g.ricci_scalar()*g + Lamb*g\n", "EE.set_name('E')\n", "print(EE)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 9, "metadata": { }, "output_type": "execute_result" } ], "source": [ "EE.display_comp()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "### Simplifying and rearranging the equations" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 10, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq0 = EE[0,0]*r^2*B(r)^2/A(r); eq0" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 11, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq1 = EE[1,1]*r^2*A(r); eq1" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 12, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq2 = EE[2,2]*4*A(r)^2*B(r)^2; eq2" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 13, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq3 = EE[3,3]*4*A(r)^2*B(r)^2/sin(th)^2; eq3" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 14, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq3 == eq2" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "## Solving Einstein equation\n", "\n", "The following combination of eq0 and eq1 is particularly simple:" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 15, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq4 = (eq0*A(r) + eq1*B(r))/r; eq4" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The solution is $A(r)B(r)=C$, where $C$ is a constant:" ] }, { "cell_type": "code", "execution_count": 16, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 16, "metadata": { }, "output_type": "execute_result" } ], "source": [ "s = desolve(eq4.expr() == 0, B(r), ivar=r)\n", "s" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "Let us rename the constant to $\\alpha$:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 17, "metadata": { }, "output_type": "execute_result" } ], "source": [ "var('alpha', latex_name=r'\\alpha')\n", "B_sol(r) = s.subs(_C=alpha); B_sol" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "We replace $B(r)$ by the above value in the remaining equations:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 18, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq5 = X.function(eq1.expr().substitute_function(B, B_sol)); eq5" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 19, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq6 = X.function(eq2.expr().substitute_function(B, B_sol)); eq6" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "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. " ] }, { "cell_type": "code", "execution_count": 20, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 20, "metadata": { }, "output_type": "execute_result" } ], "source": [ "s = desolve(eq5.expr() == 0, A(r), ivar=r)\n", "s.expand()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "We rename the constant $C$ to $-2m$ and set the value of constant $\\alpha$ to $1$:" ] }, { "cell_type": "code", "execution_count": 21, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 21, "metadata": { }, "output_type": "execute_result" } ], "source": [ "var('m')\n", "A_sol(r) = s.subs(_C=-2*m, alpha=1).expand()\n", "A_sol" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "Let us check that `eq6` is fulfilled by the found value of $A(r)$:" ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 22, "metadata": { }, "output_type": "execute_result" } ], "source": [ "eq6.expr().substitute_function(A, A_sol).subs(alpha=1).simplify_full()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "### Final expression of the metric\n", "\n", "We have got the Kottler metric:" ] }, { "cell_type": "code", "execution_count": 23, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 23, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g[0,0] = -A_sol(r)\n", "g[1,1] = 1/A_sol(r)\n", "g.display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "which reduces to Schwarzschild metric as soons as the cosmological constant vanishes." ] }, { "cell_type": "code", "execution_count": 24, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 24, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g.christoffel_symbols_display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "Let us check that Einstein equation is satisfied by the above metric:" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 25, "metadata": { }, "output_type": "execute_result" } ], "source": [ "EE = g.ricci() - 1/2*g.ricci_scalar()*g + Lamb*g\n", "EE.set_name('E')\n", "EE.display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The Ricci scalar is constant for this solution:" ] }, { "cell_type": "code", "execution_count": 26, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 26, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g.ricci_scalar().display()" ] }, { "cell_type": "markdown", "metadata": { "deletable": true, "editable": true }, "source": [ "The Ricci tensor is proportional to the metric tensor:" ] }, { "cell_type": "code", "execution_count": 27, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 27, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g.ricci().display()" ] }, { "cell_type": "code", "execution_count": 28, "metadata": { "deletable": true, "editable": true }, "outputs": [ { "data": { "text/html": [ "" ] }, "execution_count": 28, "metadata": { }, "output_type": "execute_result" } ], "source": [ "g.ricci() == Lamb * g" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath (latest)", "language": "", "name": "sagemath" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 0 }