### General Relativty describes the interaction between the geometry of spacetime and the energy-momentum of matter.

$G_{\mu\nu}$ + $\lambda g_{\mu\nu}$ = 8$\pi G T_{\mu\nu}$
 
Einstein's field equations are basically a set of coupled partial differential equations of components of the metric $g_{\mu\nu}$
. The metric defines the geometry of the space-time manifold.

On the left hand side we have the Einstein tensor $G_{\mu\nu}$ = $R_{\mu\nu}$ - 1/2 $g_{\mu\nu}$$R$ , where the Riemann tensor and Ricci scalar are complicated functions of the metric and its derivatives. Besides, we have $\lambda$ , which is a free constant parameter allowed by the theory, but which we now think is responsible for the accelerated expansion of the Universe.

The right hand side, with the tensor $T_{\mu\nu}$ 
 describes the energy and momentum of matter, a fluid, particles or the object in question (for example a star).

Youtube Video - https://www.youtube.com/watch?v=JRZgW1YjCKk (Stanford Lecture Series)




```python
import sympy as smp
import einsteinpy 
```

#### Let's calculate the behavior of the "scale factor" of the Universe, that the Einstein equations predict, for a homogeneous and isotropic Universe filled with a perfect fluid.


```python
G_00, T_00, G, rho = smp.symbols("G_{00} T_{00} G rho")
```


```python
rho
```




$\displaystyle \rho$




```python
einst_eq = smp.Eq( G_00, 8 * smp.pi * G * T_00 )
einst_eq
```




$\displaystyle G_{00} = 8 \pi G T_{00}$




```python
# The energy-momentum tensor of a perfect fluid:

energy_momentum = smp.Eq(T_00, rho)
energy_momentum
```




$\displaystyle T_{00} = \rho$




```python
syms = smp.symbols("t x y z")
t, x, y, z = syms
```


```python
a = smp.Function("a")  ##scale factor
```

__The line element of a homogeneous and isotropic Universe with no curvature. The metric elements are the coefficients in front of the coordinates.__
$ds^{2}$ = $g_{\mu\nu}$ $dx^{\mu}$ $dx^{\nu}$ = -$dt^{2}$ + $a^{2}(t)$($dx^{2}$+$dy^{2}$+$dz^{2}$)




```python
from einsteinpy.symbolic import EinsteinTensor, MetricTensor
m = smp.diag(-1, a(t)**2, a(t)**2, a(t)** 2).tolist()
metric = MetricTensor(m, syms)
```


```python
metric.tensor()
```




$\displaystyle \left[\begin{matrix}-1 & 0 & 0 & 0\\0 & a^{2}{\left(t \right)} & 0 & 0\\0 & 0 & a^{2}{\left(t \right)} & 0\\0 & 0 & 0 & a^{2}{\left(t \right)}\end{matrix}\right]$




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




$\displaystyle \left[\begin{matrix}\frac{3.0 \left(\frac{d}{d t} a{\left(t \right)}\right)^{2}}{a^{2}{\left(t \right)}} & 0 & 0 & 0\\0 & - 2.0 a{\left(t \right)} \frac{d^{2}}{d t^{2}} a{\left(t \right)} - 1.0 \left(\frac{d}{d t} a{\left(t \right)}\right)^{2} & 0 & 0\\0 & 0 & - 2.0 a{\left(t \right)} \frac{d^{2}}{d t^{2}} a{\left(t \right)} - 1.0 \left(\frac{d}{d t} a{\left(t \right)}\right)^{2} & 0\\0 & 0 & 0 & - 2.0 a{\left(t \right)} \frac{d^{2}}{d t^{2}} a{\left(t \right)} - 1.0 \left(\frac{d}{d t} a{\left(t \right)}\right)^{2}\end{matrix}\right]$




```python
H = smp.symbols("H")
```

Let's define a new function, that we will cull the Hubble function and it will be the relative "velocity" of expansion of $a(t)$:

$H(t)$ = $a^{o}$/$a$


```python
smp.Eq( H, smp.diff(a(t), t)/a(t))
```




$\displaystyle H = \frac{\frac{d}{d t} a{\left(t \right)}}{a{\left(t \right)}}$




```python
G_00s = einst[0,0]
G_00s = G_00s.subs(smp.diff(a(t), t)/a(t), H)
G_00s
```




$\displaystyle 3.0 H^{2}$




```python
einst_eq.subs(G_00, G_00s).subs(T_00, rho)
```




$\displaystyle 3.0 H^{2} = 8 \pi G \rho$




```python

```

7658aa239d4b3da4075f82b469627e7f66293567
ipynb
Jupyter Notebook
Relativity/General Relativity/General Relativity_with_Python-2.ipynb
DhruvKumarPHY/YOUTUBE-CODING_MY_UNIVERSE
b7f7cdf61c9a1fe856834ca6fee3a40f0d4381e4
MIT
Relativity/General Relativity/General Relativity_with_Python-2.ipynb
DhruvKumarPHY/YOUTUBE-CODING_MY_UNIVERSE
b7f7cdf61c9a1fe856834ca6fee3a40f0d4381e4
MIT
Relativity/General Relativity/General Relativity_with_Python-2.ipynb
DhruvKumarPHY/YOUTUBE-CODING_MY_UNIVERSE
b7f7cdf61c9a1fe856834ca6fee3a40f0d4381e4
MIT
Qwen/Qwen-72B
1. YES
2. YES