Predefined Metrics in Symbolic Module¶
Importing some of the predefined tensors. All the metrics are comprehensively listed in EinsteinPy documentation.¶
[1]:
import sympy
from sympy import simplify
from einsteinpy.symbolic import RicciScalar
from einsteinpy.symbolic.predefined import Schwarzschild, DeSitter, AntiDeSitter, Minkowski, find
sympy.init_printing() # for pretty printing
Printing the metrics for visualization¶
All the functions return instances of :py:class:~einsteinpy.symbolic.metric.MetricTensor
[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]:
Minkowski(c=1).tensor()
[3]:
$\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & 1.0 & 0 & 0\\0 & 0 & 1.0 & 0\\0 & 0 & 0 & 1.0\end{matrix}\right]$
[4]:
DeSitter().tensor()
[4]:
$\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & e^{\frac{2 x}{\alpha}} & 0 & 0\\0 & 0 & e^{\frac{2 x}{\alpha}} & 0\\0 & 0 & 0 & e^{\frac{2 x}{\alpha}}\end{matrix}\right]$
[5]:
AntiDeSitter().tensor()
[5]:
$\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & \cos^{2}{\left(t \right)} & 0 & 0\\0 & 0 & \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)} & 0\\0 & 0 & 0 & \sin^{2}{\left(\theta \right)} \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)}\end{matrix}\right]$
Calculating the scalar (Ricci) curavtures¶
They should be constant for De-Sitter and Anti-De-Sitter spacetimes.
[6]:
scalar_curvature_de_sitter = RicciScalar.from_metric(DeSitter())
scalar_curvature_anti_de_sitter = RicciScalar.from_metric(AntiDeSitter())
[7]:
scalar_curvature_de_sitter.expr
[7]:
$\displaystyle - \frac{2 e^{- \frac{2 x}{\alpha}}}{\alpha^{2}}$
[8]:
scalar_curvature_anti_de_sitter.expr
[8]:
$\displaystyle -12$
On simplifying the expression we got above, we indeed obtain a constant
[9]:
simplify(scalar_curvature_anti_de_sitter.expr)
[9]:
$\displaystyle -12$
Searching for a predefined metric¶
find function returns a list of available functions
[10]:
find("sitter")
[10]:
['AntiDeSitter', 'AntiDeSitterStatic', 'DeSitter']