Contravariant & Covariant indices in Tensors (Symbolic)¶

[1]:

from einsteinpy.symbolic import ChristoffelSymbols, RiemannCurvatureTensor
from einsteinpy.symbolic.predefined import Schwarzschild
import sympy
sympy.init_printing()


Analysing the schwarzschild metric along with performing various operations¶

[2]:

sch = Schwarzschild()
sch.tensor()

[2]:

$\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]$
[3]:

sch_inv = sch.inv()
sch_inv.tensor()

[3]:

$\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]$
[4]:

sch.order

[4]:

$\displaystyle 2$
[5]:

sch.config

[5]:

'll'


Obtaining Christoffel Symbols from Metric Tensor¶

[6]:

chr = ChristoffelSymbols.from_metric(sch_inv) # can be initialized from sch also
chr.tensor()

[6]:

$\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} c^{2} \left(1 - \frac{r_{s}}{r}\right)}{2 r^{2}} & 0 & 0 & 0\\0 & - \frac{r_{s}}{2 r^{2} \left(1 - \frac{r_{s}}{r}\right)} & 0 & 0\\0 & 0 & - r \left(1 - \frac{r_{s}}{r}\right) & 0\\0 & 0 & 0 & - r \left(1 - \frac{r_{s}}{r}\right) \sin^{2}{\left(\theta \right)}\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]$
[7]:

chr.config

[7]:

'ull'


Changing the first index to covariant¶

[8]:

new_chr = chr.change_config('lll') # changing the configuration to (covariant, covariant, covariant)
new_chr.tensor()

[8]:

$\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 r^{2} c^{2} \left(1 - \frac{r_{s}}{r}\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(\theta \right)} \cos{\left(\theta \right)}}{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(\theta \right)} \cos{\left(\theta \right)}}{c^{2}}\\0 & - \frac{r \sin^{2}{\left(\theta \right)}}{c^{2}} & - \frac{r^{2} \sin{\left(\theta \right)} \cos{\left(\theta \right)}}{c^{2}} & 0\end{matrix}\right]\end{matrix}\right]$
[9]:

new_chr.config

[9]:

'lll'


Any arbitary index configuration would also work!¶

[10]:

new_chr2 = new_chr.change_config('lul')
new_chr2.tensor()

[10]:

$\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} \left(- r + r_{s}\right)}{2 r^{3} \left(1 - \frac{r_{s}}{r}\right)^{2}} & 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{\cos{\left(\theta \right)}}{\sin{\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 & \sin{\left(\theta \right)} \cos{\left(\theta \right)}\\0 & \frac{1}{r} & \frac{\cos{\left(\theta \right)}}{\sin{\left(\theta \right)}} & 0\end{matrix}\right]\end{matrix}\right]$

Obtaining Riemann Tensor from Christoffel Symbols and manipulating it’s indices¶

[11]:

rm = RiemannCurvatureTensor.from_christoffels(new_chr2)
rm[0,0,:,:]

[11]:

$\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]$
[12]:

rm.config

[12]:

'ulll'

[13]:

rm2 = rm.change_config("uuuu")
rm2[0,0,:,:]

[13]:

$\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & - \frac{r_{s} c^{4} \left(- r + r_{s}\right)^{2}}{r^{3} \left(r - r_{s}\right)^{2}} & 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]$
[14]:

rm3 = rm2.change_config("lulu")
rm3[0,0,:,:]

[14]:

$\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & \frac{r_{s} c^{2} \left(- r + r_{s}\right)^{2}}{r^{3} \left(r - r_{s}\right)^{2}} & 0 & 0\\0 & 0 & - \frac{r_{s} c^{2} \left(1 - \frac{r_{s}}{r}\right)}{2 r^{2} \left(r - r_{s}\right)} & 0\\0 & 0 & 0 & - \frac{r_{s} c^{2} \left(1 - \frac{r_{s}}{r}\right)}{2 r^{2} \left(r - r_{s}\right)}\end{matrix}\right]$
[15]:

rm4 = rm3.change_config("ulll")
rm4.simplify()
rm4[0,0,:,:]

[15]:

$\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]$