{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Contravariant & Covariant indices in Tensors (Symbolic)" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import sympy\n", "from einsteinpy.symbolic import ChristoffelSymbols, RiemannCurvatureTensor\n", "from einsteinpy.symbolic.predefined import Schwarzschild\n", "\n", "sympy.init_printing()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Analysing the schwarzschild metric along with performing various operations" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}1 - \\frac{r_{s}}{r} & 0 & 0 & 0\\\\0 & - \\frac{1}{c^{2} \\left(1 - \\frac{r_{s}}{r}\\right)} & 0 & 0\\\\0 & 0 & - \\frac{r^{2}}{c^{2}} & 0\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin^{2}{\\left(\\theta \\right)}}{c^{2}}\\end{matrix}\\right]$" ], "text/plain": [ "⎡ rₛ ⎤\n", "⎢1 - ── 0 0 0 ⎥\n", "⎢ r ⎥\n", "⎢ ⎥\n", "⎢ -1 ⎥\n", "⎢ 0 ─────────── 0 0 ⎥\n", "⎢ 2 ⎛ rₛ⎞ ⎥\n", "⎢ c ⋅⎜1 - ──⎟ ⎥\n", "⎢ ⎝ r ⎠ ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ -r ⎥\n", "⎢ 0 0 ──── 0 ⎥\n", "⎢ 2 ⎥\n", "⎢ c ⎥\n", "⎢ ⎥\n", "⎢ 2 2 ⎥\n", "⎢ -r ⋅sin (θ) ⎥\n", "⎢ 0 0 0 ────────────⎥\n", "⎢ 2 ⎥\n", "⎣ c ⎦" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sch = Schwarzschild()\n", "sch.tensor()" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\frac{r}{r - r_{s}} & 0 & 0 & 0\\\\0 & \\frac{c^{2} \\left(- r + r_{s}\\right)}{r} & 0 & 0\\\\0 & 0 & - \\frac{c^{2}}{r^{2}} & 0\\\\0 & 0 & 0 & - \\frac{c^{2}}{r^{2} \\sin^{2}{\\left(\\theta \\right)}}\\end{matrix}\\right]$" ], "text/plain": [ "⎡ r ⎤\n", "⎢────── 0 0 0 ⎥\n", "⎢r - rₛ ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ c ⋅(-r + rₛ) ⎥\n", "⎢ 0 ──────────── 0 0 ⎥\n", "⎢ r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ -c ⎥\n", "⎢ 0 0 ──── 0 ⎥\n", "⎢ 2 ⎥\n", "⎢ r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ -c ⎥\n", "⎢ 0 0 0 ──────────⎥\n", "⎢ 2 2 ⎥\n", "⎣ r ⋅sin (θ)⎦" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sch_inv = sch.inv()\n", "sch_inv.tensor()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAA0AAAASCAYAAACAa1QyAAAA9UlEQVR4nJ3SvyvFYRTH8dfl/gcGs90fcWWyGMiIgVFSBqXUN5NNMjAY7j8gg4iFxKSUQZIMsrhJymTwc/g+6vTt271fPvV0Tuc579P5PD21LMv8VV0h78E0dnCHN7ziDFOxtx6gMWzgEcd4QC9GsIWh1PMdoVsMYw9fob6Ic4ymAdtxvSPsFgBoYTPljaKndnpP8aMqVMdEyg+qQivoxz4Oq0CzmMcNxn+L7aAZrOEaA3jpBM1hHVcJaMXLMmgBq7hMwFOxoQgtyY1fYBDPZWvEHzGJZXziVP4IRd2jGaG+FLvlnsp0gmZcL0Otw2mUeaqkf0E/uGsxD4TY4q4AAAAASUVORK5CYII=\n", "text/latex": [ "$\\displaystyle 2$" ], "text/plain": [ "2" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sch.order" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'ll'" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sch.config" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Obtaining Christoffel Symbols from Metric Tensor" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{r_{s}}{2 r^{2} \\left(1 - \\frac{r_{s}}{r}\\right)} & 0 & 0\\\\\\frac{r_{s}}{2 r^{2} \\left(1 - \\frac{r_{s}}{r}\\right)} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{r_{s} \\left(- \\frac{c^{2}}{2} + \\frac{r_{s} c^{2}}{2 r}\\right)}{r^{2}} & 0 & 0 & 0\\\\0 & \\frac{r_{s} \\left(- \\frac{c^{2}}{2} + \\frac{r_{s} c^{2}}{2 r}\\right)}{r^{2} c^{2} \\left(1 - \\frac{r_{s}}{r}\\right)^{2}} & 0 & 0\\\\0 & 0 & \\frac{2 r \\left(- \\frac{c^{2}}{2} + \\frac{r_{s} c^{2}}{2 r}\\right)}{c^{2}} & 0\\\\0 & 0 & 0 & \\frac{2 r \\left(- \\frac{c^{2}}{2} + \\frac{r_{s} c^{2}}{2 r}\\right) \\sin^{2}{\\left(\\theta \\right)}}{c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & \\frac{1}{r} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\sin{\\left(\\theta \\right)} \\cos{\\left(\\theta \\right)}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\frac{1}{r}\\\\0 & 0 & 0 & \\frac{\\cos{\\left(\\theta \\right)}}{\\sin{\\left(\\theta \\right)}}\\\\0 & \\frac{1}{r} & \\frac{\\cos{\\left(\\theta \\right)}}{\\sin{\\left(\\theta \\right)}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$" ], "text/plain": [ "⎡ ⎡ ⎛ 2 2⎞ \n", "⎢ ⎢ ⎜ c rₛ⋅c ⎟ \n", "⎢ ⎢-rₛ⋅⎜- ── + ─────⎟ \n", "⎢ ⎢ ⎝ 2 2⋅r ⎠ \n", "⎢ ⎢─────────────────── 0 \n", "⎢ ⎢ 2 \n", "⎢ ⎢ r \n", "⎢ ⎢ \n", "⎢ ⎢ ⎛ 2 2⎞\n", "⎢⎡ rₛ ⎤ ⎢ ⎜ c rₛ⋅c ⎟\n", "⎢⎢ 0 ───────────── 0 0⎥ ⎢ rₛ⋅⎜- ── + ─────⎟\n", "⎢⎢ 2 ⎛ rₛ⎞ ⎥ ⎢ ⎝ 2 2⋅r ⎠\n", "⎢⎢ 2⋅r ⋅⎜1 - ──⎟ ⎥ ⎢ 0 ─────────────────\n", "⎢⎢ ⎝ r ⎠ ⎥ ⎢ 2 \n", "⎢⎢ ⎥ ⎢ 2 2 ⎛ rₛ⎞ \n", "⎢⎢ rₛ ⎥ ⎢ r ⋅c ⋅⎜1 - ──⎟ \n", "⎢⎢───────────── 0 0 0⎥ ⎢ ⎝ r ⎠ \n", "⎢⎢ 2 ⎛ rₛ⎞ ⎥ ⎢ \n", "⎢⎢2⋅r ⋅⎜1 - ──⎟ ⎥ ⎢ \n", "⎢⎢ ⎝ r ⎠ ⎥ ⎢ \n", "⎢⎢ ⎥ ⎢ \n", "⎢⎢ 0 0 0 0⎥ ⎢ \n", "⎢⎢ ⎥ ⎢ 0 0 \n", "⎢⎣ 0 0 0 0⎦ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ \n", "⎢ ⎢ 0 0 \n", "⎢ ⎢ \n", "⎣ ⎣ \n", "\n", " ⎤ \n", " ⎥ \n", " ⎥ \n", " ⎥ \n", " 0 0 ⎥ \n", " ⎥ \n", " ⎥ \n", " ⎥ \n", " ⎥ \n", " ⎥ \n", " ⎥ \n", " ⎥ ⎡0 0 0 0 ⎤ \n", " 0 0 ⎥ ⎢ ⎥ \n", " ⎥ ⎢ 1 ⎥ \n", " ⎥ ⎢0 0 ─ 0 ⎥ \n", " ⎥ ⎢ r ⎥ \n", " ⎥ ⎢ ⎥ \n", " ⎥ ⎢ 1 ⎥ \n", " ⎛ 2 2⎞ ⎥ ⎢0 ─ 0 0 ⎥ \n", " ⎜ c rₛ⋅c ⎟ ⎥ ⎢ r ⎥ \n", " 2⋅r⋅⎜- ── + ─────⎟ ⎥ ⎢ ⎥ \n", " ⎝ 2 2⋅r ⎠ ⎥ ⎣0 0 0 -sin(θ)⋅cos(θ)⎦ \n", " ────────────────── 0 ⎥ \n", " 2 ⎥ \n", " c ⎥ \n", " ⎥ \n", " ⎛ 2 2⎞ ⎥ \n", " ⎜ c rₛ⋅c ⎟ 2 ⎥ \n", " 2⋅r⋅⎜- ── + ─────⎟⋅sin (θ)⎥ \n", " ⎝ 2 2⋅r ⎠ ⎥ \n", " 0 ──────────────────────────⎥ \n", " 2 ⎥ \n", " c ⎦ \n", "\n", " ⎤\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", "⎡0 0 0 0 ⎤⎥\n", "⎢ ⎥⎥\n", "⎢ 1 ⎥⎥\n", "⎢0 0 0 ─ ⎥⎥\n", "⎢ r ⎥⎥\n", "⎢ ⎥⎥\n", "⎢ cos(θ)⎥⎥\n", "⎢0 0 0 ──────⎥⎥\n", "⎢ sin(θ)⎥⎥\n", "⎢ ⎥⎥\n", "⎢ 1 cos(θ) ⎥⎥\n", "⎢0 ─ ────── 0 ⎥⎥\n", "⎣ r sin(θ) ⎦⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎥\n", " ⎦" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chr = ChristoffelSymbols.from_metric(sch_inv) # can be initialized from sch also\n", "chr.tensor()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'ull'" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "chr.config" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Changing the first index to covariant" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{r_{s}}{2 r^{2}} & 0 & 0\\\\\\frac{r_{s}}{2 r^{2}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{r_{s}}{2 r^{2}} & 0 & 0 & 0\\\\0 & \\frac{r_{s}}{2 c^{2} \\left(r - r_{s}\\right)^{2}} & 0 & 0\\\\0 & 0 & \\frac{r}{c^{2}} & 0\\\\0 & 0 & 0 & \\frac{r \\sin^{2}{\\left(\\theta \\right)}}{c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & - \\frac{r}{c^{2}} & 0\\\\0 & - \\frac{r}{c^{2}} & 0 & 0\\\\0 & 0 & 0 & \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2 c^{2}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & - \\frac{r \\sin^{2}{\\left(\\theta \\right)}}{c^{2}}\\\\0 & 0 & 0 & - \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2 c^{2}}\\\\0 & - \\frac{r \\sin^{2}{\\left(\\theta \\right)}}{c^{2}} & - \\frac{r^{2} \\sin{\\left(2 \\theta \\right)}}{2 c^{2}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$" ], "text/plain": [ "⎡ ⎡-rₛ ⎤ \n", "⎢ ⎢──── 0 0 0 ⎥ \n", "⎢ ⎢ 2 ⎥ ⎡0 0 0 \n", "⎢ ⎢2⋅r ⎥ ⎢ \n", "⎢⎡ rₛ ⎤ ⎢ ⎥ ⎢ -r \n", "⎢⎢ 0 ──── 0 0⎥ ⎢ rₛ ⎥ ⎢0 0 ─── \n", "⎢⎢ 2 ⎥ ⎢ 0 ────────────── 0 0 ⎥ ⎢ 2 \n", "⎢⎢ 2⋅r ⎥ ⎢ 2 2 ⎥ ⎢ c \n", "⎢⎢ ⎥ ⎢ 2⋅c ⋅(r - rₛ) ⎥ ⎢ \n", "⎢⎢ rₛ ⎥ ⎢ ⎥ ⎢ -r \n", "⎢⎢──── 0 0 0⎥ ⎢ r ⎥ ⎢0 ─── 0 \n", "⎢⎢ 2 ⎥ ⎢ 0 0 ── 0 ⎥ ⎢ 2 \n", "⎢⎢2⋅r ⎥ ⎢ 2 ⎥ ⎢ c \n", "⎢⎢ ⎥ ⎢ c ⎥ ⎢ \n", "⎢⎢ 0 0 0 0⎥ ⎢ ⎥ ⎢ 2 \n", "⎢⎢ ⎥ ⎢ 2 ⎥ ⎢ r ⋅s\n", "⎢⎣ 0 0 0 0⎦ ⎢ r⋅sin (θ)⎥ ⎢0 0 0 ────\n", "⎢ ⎢ 0 0 0 ─────────⎥ ⎢ \n", "⎢ ⎢ 2 ⎥ ⎣ \n", "⎣ ⎣ c ⎦ \n", "\n", " ⎤\n", " ⎡0 0 0 0 ⎤⎥\n", " 0 ⎤ ⎢ ⎥⎥\n", " ⎥ ⎢ 2 ⎥⎥\n", " ⎥ ⎢ -r⋅sin (θ) ⎥⎥\n", " 0 ⎥ ⎢0 0 0 ─────────── ⎥⎥\n", " ⎥ ⎢ 2 ⎥⎥\n", " ⎥ ⎢ c ⎥⎥\n", " ⎥ ⎢ ⎥⎥\n", " ⎥ ⎢ 2 ⎥⎥\n", " 0 ⎥ ⎢ -r ⋅sin(2⋅θ) ⎥⎥\n", " ⎥ ⎢0 0 0 ─────────────⎥⎥\n", " ⎥ ⎢ 2 ⎥⎥\n", " ⎥ ⎢ 2⋅c ⎥⎥\n", " ⎥ ⎢ ⎥⎥\n", "in(2⋅θ)⎥ ⎢ 2 2 ⎥⎥\n", "───────⎥ ⎢ -r⋅sin (θ) -r ⋅sin(2⋅θ) ⎥⎥\n", " 2 ⎥ ⎢0 ─────────── ───────────── 0 ⎥⎥\n", "2⋅c ⎦ ⎢ 2 2 ⎥⎥\n", " ⎣ c 2⋅c ⎦⎦" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_chr = chr.change_config('lll') # changing the configuration to (covariant, covariant, covariant)\n", "new_chr.tensor()" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'lll'" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_chr.config" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Any arbitary index configuration would also work!" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}\\left[\\begin{matrix}0 & \\frac{r_{s}}{2 r \\left(r - r_{s}\\right)} & 0 & 0\\\\\\frac{r_{s} c^{2} \\left(- r + r_{s}\\right)}{2 r^{3}} & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\\\0 & 0 & 0 & 0\\end{matrix}\\right] & \\left[\\begin{matrix}- \\frac{r_{s}}{2 r \\left(r - r_{s}\\right)} & 0 & 0 & 0\\\\0 & - \\frac{r_{s}}{2 r \\left(r - r_{s}\\right)} & 0 & 0\\\\0 & 0 & - \\frac{1}{r} & 0\\\\0 & 0 & 0 & - \\frac{1}{r}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & r - r_{s} & 0\\\\0 & \\frac{1}{r} & 0 & 0\\\\0 & 0 & 0 & - \\frac{1}{\\tan{\\left(\\theta \\right)}}\\end{matrix}\\right] & \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & 0 & 0 & \\left(r - r_{s}\\right) \\sin^{2}{\\left(\\theta \\right)}\\\\0 & 0 & 0 & \\frac{\\sin{\\left(2 \\theta \\right)}}{2}\\\\0 & \\frac{1}{r} & \\frac{1}{\\tan{\\left(\\theta \\right)}} & 0\\end{matrix}\\right]\\end{matrix}\\right]$" ], "text/plain": [ "⎡ ⎡ -rₛ ⎤\n", "⎢⎡ rₛ ⎤ ⎢──────────── 0 0 0 ⎥\n", "⎢⎢ 0 ──────────── 0 0⎥ ⎢2⋅r⋅(r - rₛ) ⎥\n", "⎢⎢ 2⋅r⋅(r - rₛ) ⎥ ⎢ ⎥\n", "⎢⎢ ⎥ ⎢ -rₛ ⎥\n", "⎢⎢ 2 ⎥ ⎢ 0 ──────────── 0 0 ⎥\n", "⎢⎢rₛ⋅c ⋅(-r + rₛ) ⎥ ⎢ 2⋅r⋅(r - rₛ) ⎥\n", "⎢⎢─────────────── 0 0 0⎥ ⎢ ⎥\n", "⎢⎢ 3 ⎥ ⎢ -1 ⎥\n", "⎢⎢ 2⋅r ⎥ ⎢ 0 0 ─── 0 ⎥\n", "⎢⎢ ⎥ ⎢ r ⎥\n", "⎢⎢ 0 0 0 0⎥ ⎢ ⎥\n", "⎢⎢ ⎥ ⎢ -1 ⎥\n", "⎢⎣ 0 0 0 0⎦ ⎢ 0 0 0 ───⎥\n", "⎣ ⎣ r ⎦\n", "\n", " ⎤\n", " ⎡0 0 0 0 ⎤⎥\n", " ⎡0 0 0 0 ⎤ ⎢ ⎥⎥\n", " ⎢ ⎥ ⎢ 2 ⎥⎥\n", " ⎢0 0 r - rₛ 0 ⎥ ⎢0 0 0 (r - rₛ)⋅sin (θ)⎥⎥\n", " ⎢ ⎥ ⎢ ⎥⎥\n", " ⎢ 1 ⎥ ⎢ sin(2⋅θ) ⎥⎥\n", " ⎢0 ─ 0 0 ⎥ ⎢0 0 0 ──────── ⎥⎥\n", " ⎢ r ⎥ ⎢ 2 ⎥⎥\n", " ⎢ ⎥ ⎢ ⎥⎥\n", " ⎢ -1 ⎥ ⎢ 1 1 ⎥⎥\n", " ⎢0 0 0 ──────⎥ ⎢0 ─ ────── 0 ⎥⎥\n", " ⎣ tan(θ)⎦ ⎣ r tan(θ) ⎦⎥\n", " ⎥\n", " ⎦" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "new_chr2 = new_chr.change_config('lul')\n", "new_chr2.tensor()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Obtaining Riemann Tensor from Christoffel Symbols and manipulating it's indices" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & - \\frac{r_{s}}{r^{2} \\left(r - r_{s}\\right)} & 0 & 0\\\\0 & 0 & \\frac{r_{s}}{2 r} & 0\\\\0 & 0 & 0 & \\frac{r_{s} \\sin^{2}{\\left(\\theta \\right)}}{2 r}\\end{matrix}\\right]$" ], "text/plain": [ "⎡0 0 0 0 ⎤\n", "⎢ ⎥\n", "⎢ -rₛ ⎥\n", "⎢0 ─────────── 0 0 ⎥\n", "⎢ 2 ⎥\n", "⎢ r ⋅(r - rₛ) ⎥\n", "⎢ ⎥\n", "⎢ rₛ ⎥\n", "⎢0 0 ─── 0 ⎥\n", "⎢ 2⋅r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ rₛ⋅sin (θ)⎥\n", "⎢0 0 0 ──────────⎥\n", "⎣ 2⋅r ⎦" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rm = RiemannCurvatureTensor.from_christoffels(new_chr2)\n", "rm[0,0,:,:]" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'ulll'" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rm.config" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & - \\frac{r_{s} c^{4}}{r^{3}} & 0 & 0\\\\0 & 0 & \\frac{r_{s} c^{4}}{2 r^{4} \\left(r - r_{s}\\right)} & 0\\\\0 & 0 & 0 & \\frac{r_{s} c^{4}}{2 r^{4} \\left(r - r_{s}\\right) \\sin^{2}{\\left(\\theta \\right)}}\\end{matrix}\\right]$" ], "text/plain": [ "⎡0 0 0 0 ⎤\n", "⎢ ⎥\n", "⎢ 4 ⎥\n", "⎢ -rₛ⋅c ⎥\n", "⎢0 ─────── 0 0 ⎥\n", "⎢ 3 ⎥\n", "⎢ r ⎥\n", "⎢ ⎥\n", "⎢ 4 ⎥\n", "⎢ rₛ⋅c ⎥\n", "⎢0 0 ───────────── 0 ⎥\n", "⎢ 4 ⎥\n", "⎢ 2⋅r ⋅(r - rₛ) ⎥\n", "⎢ ⎥\n", "⎢ 4 ⎥\n", "⎢ rₛ⋅c ⎥\n", "⎢0 0 0 ─────────────────────⎥\n", "⎢ 4 2 ⎥\n", "⎣ 2⋅r ⋅(r - rₛ)⋅sin (θ)⎦" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rm2 = rm.change_config(\"uuuu\")\n", "rm2[0,0,:,:]" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & \\frac{r_{s} c^{2}}{r^{3}} & 0 & 0\\\\0 & 0 & - \\frac{r_{s} c^{2}}{2 r^{3}} & 0\\\\0 & 0 & 0 & - \\frac{r_{s} c^{2}}{2 r^{3}}\\end{matrix}\\right]$" ], "text/plain": [ "⎡0 0 0 0 ⎤\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ rₛ⋅c ⎥\n", "⎢0 ───── 0 0 ⎥\n", "⎢ 3 ⎥\n", "⎢ r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ -rₛ⋅c ⎥\n", "⎢0 0 ─────── 0 ⎥\n", "⎢ 3 ⎥\n", "⎢ 2⋅r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ -rₛ⋅c ⎥\n", "⎢0 0 0 ───────⎥\n", "⎢ 3 ⎥\n", "⎣ 2⋅r ⎦" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rm3 = rm2.change_config(\"lulu\")\n", "rm3[0,0,:,:]" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}0 & 0 & 0 & 0\\\\0 & - \\frac{r_{s}}{r^{2} \\left(r - r_{s}\\right)} & 0 & 0\\\\0 & 0 & \\frac{r_{s}}{2 r} & 0\\\\0 & 0 & 0 & \\frac{r_{s} \\sin^{2}{\\left(\\theta \\right)}}{2 r}\\end{matrix}\\right]$" ], "text/plain": [ "⎡0 0 0 0 ⎤\n", "⎢ ⎥\n", "⎢ -rₛ ⎥\n", "⎢0 ─────────── 0 0 ⎥\n", "⎢ 2 ⎥\n", "⎢ r ⋅(r - rₛ) ⎥\n", "⎢ ⎥\n", "⎢ rₛ ⎥\n", "⎢0 0 ─── 0 ⎥\n", "⎢ 2⋅r ⎥\n", "⎢ ⎥\n", "⎢ 2 ⎥\n", "⎢ rₛ⋅sin (θ)⎥\n", "⎢0 0 0 ──────────⎥\n", "⎣ 2⋅r ⎦" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "rm4 = rm3.change_config(\"ulll\")\n", "rm4.simplify()\n", "rm4[0,0,:,:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### It is seen that rm and rm4 are same as they have the same configuration" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 2 }