Einstein Tensor calculations using Symbolic module

In [1]:
import sympy

from sympy import symbols, sin, cos, sinh

from einsteinpy.symbolic import EinsteinTensor, MetricTensor



sympy.init_printing()

Defining the Anti-de Sitter spacetime Metric

In [2]:
syms = sympy.symbols("t chi theta phi")

t, ch, th, ph = syms

m = sympy.diag(-1, cos(t) ** 2, cos(t) ** 2 * sinh(ch) ** 2, cos(t) ** 2 * sinh(ch) ** 2 * sin(th) ** 2).tolist()

metric = MetricTensor(m, syms)

Calculating the Einstein Tensor (with both indices covariant)

In [3]:
einst = EinsteinTensor.from_metric(metric)

einst.tensor()
Out[3]:
$\displaystyle \left[\begin{matrix}-3.0 & 0 & 0 & 0\\0 & 3.0 \cos^{2}{\left(t \right)} & 0 & 0\\0 & 0 & 3.0 \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)} & 0\\0 & 0 & 0 & 3.0 \sin^{2}{\left(\theta \right)} \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)}\end{matrix}\right]$