#!/usr/bin/env python # coding: utf-8 # # Einstein Tensor calculations using Symbolic module # In[1]: import numpy as np import pytest import sympy from sympy import cos, simplify, sin, sinh, tensorcontraction from einsteinpy.symbolic import EinsteinTensor, MetricTensor, RicciScalar 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()