Predefined Metrics in Symbolic Module

Importing some of the predefined tensors. All the metrics are comprehensively listed in EinsteinPy documentation.

In [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

In [2]:
sch = Schwarzschild()

sch.tensor()
Out[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]$
In [3]:
Minkowski(c=1).tensor()
Out[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]$
In [4]:
DeSitter().tensor()
Out[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]$
In [5]:
AntiDeSitter().tensor()
Out[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.

In [6]:
scalar_curvature_de_sitter = RicciScalar.from_metric(DeSitter())

scalar_curvature_anti_de_sitter = RicciScalar.from_metric(AntiDeSitter())
In [7]:
scalar_curvature_de_sitter.expr
Out[7]:
$\displaystyle - \frac{2 e^{- \frac{2 x}{\alpha}}}{\alpha^{2}}$
In [8]:
scalar_curvature_anti_de_sitter.expr
Out[8]:
$\displaystyle -12$

On simplifying the expression we got above, we indeed obtain a constant

In [9]:
simplify(scalar_curvature_anti_de_sitter.expr)
Out[9]:
$\displaystyle -12$

Searching for a predefined metric

find function returns a list of available functions

In [10]:
find("sitter")
Out[10]:
['AntiDeSitter', 'AntiDeSitterStatic', 'DeSitter']