# Homework 3

## Imports


```python
import nbtools
nbtools.setup_nb()
```


```python
from astropy import units
import itertools
import sympy
from sympy.diffgeom import Manifold, Patch

from pystein import coords, metric, curvature
from pystein.utilities import tensor_pow as tpow
```

## Exercises

### B7


```python
M = Manifold('M', dim=4)
P = Patch('origin', M)

t, x, y, z = sympy.symbols('t, x y z')
phi = sympy.Function('phi')(x, y, z)
cs = coords.CoordSystem('cartesian', P, [t, x, y, z])

dt, dx, dy, dz = cs.base_oneforms()
ds2 = -(1 + 2 * phi) * tpow(dt, 2) + (1 - 2 * phi) * (tpow(dx, 2) + tpow(dy, 2) + tpow(dz, 2))
g = metric.Metric(twoform=ds2)
g
```




$\displaystyle \left(1 - 2 \phi{\left(x,y,z \right)}\right) \left(\operatorname{d}x \otimes \operatorname{d}x + \operatorname{d}y \otimes \operatorname{d}y + \operatorname{d}z \otimes \operatorname{d}z\right) + \left(- 2 \phi{\left(x,y,z \right)} - 1\right) \operatorname{d}t \otimes \operatorname{d}t$




```python
g.matrix
```




$\displaystyle \left[\begin{matrix}- 2 \phi{\left(x,y,z \right)} - 1 & 0 & 0 & 0\\0 & 1 - 2 \phi{\left(x,y,z \right)} & 0 & 0\\0 & 0 & 1 - 2 \phi{\left(x,y,z \right)} & 0\\0 & 0 & 0 & 1 - 2 \phi{\left(x,y,z \right)}\end{matrix}\right]$




```python
g.inverse.matrix
```




$\displaystyle \left[\begin{matrix}\frac{1}{- 2 \phi{\left(x,y,z \right)} - 1} & 0 & 0 & 0\\0 & \frac{1}{1 - 2 \phi{\left(x,y,z \right)}} & 0 & 0\\0 & 0 & \frac{1}{1 - 2 \phi{\left(x,y,z \right)}} & 0\\0 & 0 & 0 & \frac{1}{1 - 2 \phi{\left(x,y,z \right)}}\end{matrix}\right]$




```python
_phi = sympy.symbols('phi')
_subs = [
    (phi, _phi)
]
```


```python
sympy.simplify(curvature.christoffel_symbol_component(1, 0, 0, g).doit()).subs(_subs)
```




$\displaystyle - \frac{\frac{d}{d x} \phi}{2 \phi - 1}$




```python
sympy.simplify(curvature.einstein_tensor_component(1, 2, g).doit()).subs(_subs)
```




$\displaystyle \frac{2 \left(- 8 \phi^{3} \frac{d^{2}}{d yd x} \phi + 12 \phi^{2} \frac{d}{d x} \phi \frac{d}{d y} \phi + 4 \phi \frac{d}{d x} \phi \frac{d}{d y} \phi + 2 \phi \frac{d^{2}}{d yd x} \phi + \frac{d}{d x} \phi \frac{d}{d y} \phi\right)}{16 \phi^{4} - 8 \phi^{2} + 1}$




```python
sympy.simplify(sum([curvature.ricci_tensor_component(mu, mu, g).doit() for mu in range(4)])).subs(_subs)
```




$\displaystyle \frac{- \left(2 \phi - 1\right)^{2} \left(2 \phi + 1\right) \left(\frac{d^{2}}{d x^{2}} \phi + \frac{d^{2}}{d y^{2}} \phi + \frac{d^{2}}{d z^{2}} \phi\right) + \left(2 \phi - 1\right)^{2} \left(\left(\frac{d}{d x} \phi\right)^{2} + \left(\frac{d}{d y} \phi\right)^{2} + \left(\frac{d}{d z} \phi\right)^{2}\right) - 5 \left(2 \phi - 1\right) \left(2 \phi + 1\right)^{2} \left(\frac{d^{2}}{d x^{2}} \phi + \frac{d^{2}}{d y^{2}} \phi + \frac{d^{2}}{d z^{2}} \phi\right) + 5 \left(2 \phi + 1\right)^{2} \left(\left(\frac{d}{d x} \phi\right)^{2} + \left(\frac{d}{d y} \phi\right)^{2} + \left(\frac{d}{d z} \phi\right)^{2}\right)}{\left(2 \phi - 1\right)^{2} \left(2 \phi + 1\right)^{2}}$




```python
riccis = [((mu, nu), sympy.simplify(curvature.ricci_tensor_component(mu, nu, g).doit())) 
          for mu, nu in itertools.product(range(4), range(4))]
```


```python
sympy.simplify(curvature.ricci_scalar(g).doit()).subs(_subs)
```




$\displaystyle \frac{2 \left(24 \phi^{3} \frac{d^{2}}{d x^{2}} \phi + 24 \phi^{3} \frac{d^{2}}{d y^{2}} \phi + 24 \phi^{3} \frac{d^{2}}{d z^{2}} \phi - 12 \phi^{2} \left(\frac{d}{d x} \phi\right)^{2} + 4 \phi^{2} \frac{d^{2}}{d x^{2}} \phi - 12 \phi^{2} \left(\frac{d}{d y} \phi\right)^{2} + 4 \phi^{2} \frac{d^{2}}{d y^{2}} \phi - 12 \phi^{2} \left(\frac{d}{d z} \phi\right)^{2} + 4 \phi^{2} \frac{d^{2}}{d z^{2}} \phi - 8 \phi \left(\frac{d}{d x} \phi\right)^{2} - 6 \phi \frac{d^{2}}{d x^{2}} \phi - 8 \phi \left(\frac{d}{d y} \phi\right)^{2} - 6 \phi \frac{d^{2}}{d y^{2}} \phi - 8 \phi \left(\frac{d}{d z} \phi\right)^{2} - 6 \phi \frac{d^{2}}{d z^{2}} \phi - 5 \left(\frac{d}{d x} \phi\right)^{2} - \frac{d^{2}}{d x^{2}} \phi - 5 \left(\frac{d}{d y} \phi\right)^{2} - \frac{d^{2}}{d y^{2}} \phi - 5 \left(\frac{d}{d z} \phi\right)^{2} - \frac{d^{2}}{d z^{2}} \phi\right)}{32 \phi^{5} - 16 \phi^{4} - 16 \phi^{3} + 8 \phi^{2} + 2 \phi - 1}$




```python
sympy.simplify(curvature.einstein_tensor_component(0, 0, g).doit()).subs(_subs)
```




$\displaystyle \frac{8 \phi^{2} \frac{d^{2}}{d x^{2}} \phi + 8 \phi^{2} \frac{d^{2}}{d y^{2}} \phi + 8 \phi^{2} \frac{d^{2}}{d z^{2}} \phi - 6 \phi \left(\frac{d}{d x} \phi\right)^{2} - 6 \phi \left(\frac{d}{d y} \phi\right)^{2} - 6 \phi \left(\frac{d}{d z} \phi\right)^{2} - 3 \left(\frac{d}{d x} \phi\right)^{2} - 2 \frac{d^{2}}{d x^{2}} \phi - 3 \left(\frac{d}{d y} \phi\right)^{2} - 2 \frac{d^{2}}{d y^{2}} \phi - 3 \left(\frac{d}{d z} \phi\right)^{2} - 2 \frac{d^{2}}{d z^{2}} \phi}{8 \phi^{3} - 12 \phi^{2} + 6 \phi - 1}$




```python

```


```python
sympy.simplify(g.inverse.matrix[0,0] * curvature.ricci_tensor_component(0, 0, g).doit()).subs(_subs)
```




$\displaystyle \frac{4 \phi^{2} \frac{d^{2}}{d x^{2}} \phi + 4 \phi^{2} \frac{d^{2}}{d y^{2}} \phi + 4 \phi^{2} \frac{d^{2}}{d z^{2}} \phi + 2 \left(\frac{d}{d x} \phi\right)^{2} - \frac{d^{2}}{d x^{2}} \phi + 2 \left(\frac{d}{d y} \phi\right)^{2} - \frac{d^{2}}{d y^{2}} \phi + 2 \left(\frac{d}{d z} \phi\right)^{2} - \frac{d^{2}}{d z^{2}} \phi}{16 \phi^{4} - 8 \phi^{2} + 1}$




```python
curvature.ricci_tensor_component(0, 0, g).doit()
```




$\displaystyle \frac{\frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)}}{1 - 2 \phi{\left(x,y,z \right)}} + \frac{\frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)}}{1 - 2 \phi{\left(x,y,z \right)}} + \frac{\frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)}}{1 - 2 \phi{\left(x,y,z \right)}} + \frac{\left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right) \left(- 2 \phi{\left(x,y,z \right)} - 1\right)} + \frac{\left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right) \left(- 2 \phi{\left(x,y,z \right)} - 1\right)} + \frac{\left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right) \left(- 2 \phi{\left(x,y,z \right)} - 1\right)} - \frac{\left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right)^{2}} - \frac{\left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right)^{2}} - \frac{\left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2}}{\left(1 - 2 \phi{\left(x,y,z \right)}\right)^{2}}$




```python
curvature.display_components(riccis)
```


$\begin{split} (\mu=0, \nu=0) &: \frac{- 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} - 2 \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 2 \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 2 \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)}}{8 \phi^{3}{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} - 2 \phi{\left(x,y,z \right)} + 1} \\ (\mu=0, \nu=1) &: 0 \\ (\mu=0, \nu=2) &: 0 \\ (\mu=0, \nu=3) &: 0 \\ (\mu=1, \nu=0) &: 0 \\ (\mu=1, \nu=1) &: \frac{- 24 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 24 \phi^{2}{\left(x,y,z \right)} \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 12 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + 6 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 4 \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)}}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=1, \nu=2) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y\partial x} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y\partial x} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=1, \nu=3) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial x} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial x} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=2, \nu=0) &: 0 \\ (\mu=2, \nu=1) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y\partial x} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y\partial x} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=2, \nu=2) &: \frac{- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 24 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 24 \phi^{2}{\left(x,y,z \right)} \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 12 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + 6 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 4 \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)}}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=2, \nu=3) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial y} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial y} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=3, \nu=0) &: 0 \\ (\mu=3, \nu=1) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial x} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial x} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial x} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=3, \nu=2) &: \frac{2 \left(- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial y} \phi{\left(x,y,z \right)} + 12 \phi^{2}{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z\partial y} \phi{\left(x,y,z \right)} + \frac{\partial}{\partial y} \phi{\left(x,y,z \right)} \frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \\ (\mu=3, \nu=3) &: \frac{- 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 8 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} - 24 \phi^{3}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 24 \phi^{2}{\left(x,y,z \right)} \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} - 4 \phi^{2}{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 4 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + 2 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 12 \phi{\left(x,y,z \right)} \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + 6 \phi{\left(x,y,z \right)} \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial x} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial x^{2}} \phi{\left(x,y,z \right)} + 2 \left(\frac{\partial}{\partial y} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial y^{2}} \phi{\left(x,y,z \right)} + 4 \left(\frac{\partial}{\partial z} \phi{\left(x,y,z \right)}\right)^{2} + \frac{\partial^{2}}{\partial z^{2}} \phi{\left(x,y,z \right)}}{16 \phi^{4}{\left(x,y,z \right)} - 8 \phi^{2}{\left(x,y,z \right)} + 1} \end{split}$



```python

```

## Problem

### C4


```python
x, y, z = sympy.symbols('x y z')
G, M, c = sympy.symbols('G M c')
```


```python
r = sympy.sqrt(x**2 + y**2 + z**2)
phi = - G * M / (c**2 * r)
phi
```




$\displaystyle - \frac{G M}{c^{2} \sqrt{x^{2} + y^{2} + z^{2}}}$




```python
sympy.Derivative(phi, x).doit()
```




$\displaystyle \frac{G M x}{c^{2} \left(x^{2} + y^{2} + z^{2}\right)^{\frac{3}{2}}}$




```python
sympy.simplify(sympy.Derivative(x / (r ** 2), x).doit())
```




$\displaystyle \frac{- x^{2} + y^{2} + z^{2}}{\left(x^{2} + y^{2} + z^{2}\right)^{2}}$




```python
sympy.simplify(sympy.Derivative(sympy.Derivative(phi, x), x).doit() / phi)
```




$\displaystyle \frac{2 x^{2} - y^{2} - z^{2}}{\left(x^{2} + y^{2} + z^{2}\right)^{2}}$




```python
dx = sympy.Derivative(phi, x).doit()
dy = sympy.Derivative(phi, y).doit()
dz = sympy.Derivative(phi, z).doit()

dxx = sympy.simplify(sympy.Derivative(dx, x).doit())
dxy = sympy.simplify(sympy.Derivative(dy, x).doit())
dxz = sympy.simplify(sympy.Derivative(dz, x).doit())

A_x = sympy.simplify((dxx * dx + dxy * dy + dxz * dz) / (phi ** 2))
A_x
```




$\displaystyle - \frac{2 x}{\left(x^{2} + y^{2} + z^{2}\right)^{2}}$




```python

```

#### Plugin Numbers


```python
G = 6.7e-11
M = 6e24 # kg
R_E = 6.4e6 # m
Alt_Orb = 400e3 # m
R = R_E + Alt_Orb
c = 3e8
```


```python
A_norm = 2 * G**2 * M**2 / (c**4 * R**5)
A_norm
```




    2.7444322835953827e-39




```python
V = 1 / A_norm
V
```




    3.643740842058365e+38




```python
(V * units.meter**3).to(units.AU**3).value #/ (45 ** 3)
```




    108835.66731507442




```python

```


```python
tau = (c * R ** 5 / (2 * G ** 2 * M ** 2)) ** (1/3)
tau
```




    23808.273641190328




```python
tau / (60 * 60)
```




    6.613409344775091




```python

```

847c07e673c880e1fb3ce2bd63f9cf8eb3d205af
ipynb
Jupyter Notebook
notebooks/homework-3.ipynb
JWKennington/CourseGR1
ba81a1bf0427210c14d4e97c8f2cf8a345297812
MIT
notebooks/homework-3.ipynb
JWKennington/CourseGR1
ba81a1bf0427210c14d4e97c8f2cf8a345297812
MIT
notebooks/homework-3.ipynb
JWKennington/CourseGR1
ba81a1bf0427210c14d4e97c8f2cf8a345297812
MIT
Qwen/Qwen-72B
1. YES
2. YES