# Einstein Tensor calculations using Symbolic module


```python
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


```python
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)


```python
einst = EinsteinTensor.from_metric(metric)
einst.tensor()
```




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



166f5299543d27b4679f0f4bab6388d67697ec2e
ipynb
Jupyter Notebook
docs/source/examples/Symbolic Module - Einstein Tensor.ipynb
QMrpy/einsteinpy
f95ff6840e0648dd96ec11006fad958f67a18520
MIT
2021-04-24T22:38:38.000Z
2021-10-17T18:27:13.000Z
docs/source/examples/Symbolic Module - Einstein Tensor.ipynb
prakashaditya369/einsteinpy
acfba21eecb5a5805042592d8e9ac5c96979f8af
MIT
docs/source/examples/Symbolic Module - Einstein Tensor.ipynb
prakashaditya369/einsteinpy
acfba21eecb5a5805042592d8e9ac5c96979f8af
MIT
Qwen/Qwen-72B
1. YES
2. YES