```python
import numpy as np
import pytest
import sympy
from sympy import cos, simplify, sin, sinh, tensorcontraction
from einsteinpy.symbolic import EinsteinTensor, MetricTensor, RicciScalar
from einsteinpy.symbolic.predefined import Schwarzschild, DeSitter, AntiDeSitter, Minkowski, find

sympy.init_printing()
```


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


```python
einst_AdS = EinsteinTensor.from_metric(metric) # Compute the Einstein Tensor from AdS metric
einst_AdS.tensor()
```




$\displaystyle \left[\begin{matrix}-3.0 & 0 & 0 & 0\\0 & 3.0 \cos^{2}{\left(t \right)} & 0 & 0\\0 & 0 & \left(\sin^{2}{\left(t \right)} - 1\right) \sinh^{2}{\left(\chi \right)} + 4.0 \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)} & 0\\0 & 0 & 0 & \left(\sin^{2}{\left(t \right)} - 1\right) \sin^{2}{\left(\theta \right)} \sinh^{2}{\left(\chi \right)} + 4.0 \sin^{2}{\left(\theta \right)} \cos^{2}{\left(t \right)} \sinh^{2}{\left(\chi \right)}\end{matrix}\right]$




```python
sch = Schwarzschild() # Define Schwarzschild metric
sch.tensor()
```




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




```python
einst_Sch = EinsteinTensor.from_metric(sch)  # Compute Einstein Tensor for Schwarzschild spacetime
einst_Sch.tensor()
```




$\displaystyle \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right]$




```python
dS = DeSitter()  # Define de Sitter metric
dS.tensor()
```




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




```python
einst_dS = EinsteinTensor.from_metric(dS) # Compute Einstein Tensor for de Sitter space from metric
einst_dS.tensor()
```




$\displaystyle \left[\begin{matrix}- \frac{1.0 e^{- \frac{2 x}{\alpha}}}{\alpha^{2}} & 0 & 0 & 0\\0 & \frac{1.0}{\alpha^{2}} & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right]$




```python

```

c3281cad1eaa33fc2713ff90854669d88f4f1097
ipynb
Jupyter Notebook
Einstein Tensor.ipynb
SheepWaitForWolf/General-Relativity
e9eb0f8cc65be9368c6648c8afaa1f8e631516a8
MIT
2021-06-04T11:01:54.000Z
2021-06-04T11:01:54.000Z
Einstein Tensor.ipynb
SheepWaitForWolf/General-Relativity
e9eb0f8cc65be9368c6648c8afaa1f8e631516a8
MIT
Einstein Tensor.ipynb
SheepWaitForWolf/General-Relativity
e9eb0f8cc65be9368c6648c8afaa1f8e631516a8
MIT
Qwen/Qwen-72B
1. YES
2. YES