# Ricci Tensor and Scalar Curvature calculations using Symbolic module


```python
import sympy
from sympy import cos, sin, sinh
from einsteinpy.symbolic import MetricTensor, RicciTensor, RicciScalar

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 Ricci Tensor(with both indices covariant)


```python
Ric = RicciTensor.from_metric(metric)
Ric.tensor()
```




$$\left[\begin{matrix}3 & 0 & 0 & 0\\0 & - 3 \cos^{2}{\left (t \right )} & 0 & 0\\0 & 0 & \left(\sin^{2}{\left (t \right )} - 1\right) \sinh^{2}{\left (\chi \right )} - 2 \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 )} - 2 \sin^{2}{\left (\theta \right )} \cos^{2}{\left (t \right )} \sinh^{2}{\left (\chi \right )}\end{matrix}\right]$$



### Calculating the Ricci Scalar(Scalar Curvature) from the Ricci Tensor


```python
R = RicciScalar.from_riccitensor(Ric)
R.expr
```

The curavture is -12 which is in-line with the theoretical results

d30950eaf425c3f1c820906af9136adee034c0ff
ipynb
Jupyter Notebook
docs/source/examples/Ricci Tensor and Scalar Curvature symbolic calculation.ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
2019-03-08T16:13:56.000Z
2019-03-08T16:13:56.000Z
docs/source/examples/Ricci Tensor and Scalar Curvature symbolic calculation.ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
docs/source/examples/Ricci Tensor and Scalar Curvature symbolic calculation.ipynb
r0cketr1kky/einsteinpy
d86f412736a42e2cf688a1e21d7b553868a14bc4
MIT
2022-03-19T18:46:13.000Z
2022-03-19T18:46:13.000Z
Qwen/Qwen-72B
1. YES
2. YES