In [1]:
from spacetimeengine import *

In [2]:
from galgebra.printer import Format, GaLatexPrinter

Format()
from galgebra.ga import Ga
from galgebra.mv import ONE, ZERO, HALF

In [3]:
from IPython.display import display, Math

def show(x):
    if isinstance(x, list):
         for item in x:
            display(Math(GaLatexPrinter.latex(item)))
    else:
        display(Math(GaLatexPrinter.latex(x)))

In [4]:
def build_ga_from_solution(solution, norm=False):
    [metric, coordinate_set, _index_config, cosmological_constant] = solution
    return Ga('', g=metric, coords=coordinate_set, norm=norm)

In [5]:
def dot_basis_r_basis(ga):
    return [ga.dot(ga.basis[i], ga.r_basis[i]) for i in ga.n_range]

In [6]:
def gg(ga):
    return simplify(ga.g * ga.g_inv)

In [7]:
def conv_christoffel_symbols(cf):
    return permutedims(Array(cf), (2, 0, 1))

In [8]:
def show_christoffel_symbols(ga):
    if ga.connect_flg:
        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=1)))
        display(conv_christoffel_symbols(ga.Christoffel_symbols(mode=2)))

Minkowski Spacetime Metric


In [9]:
minkowski = build_ga_from_solution(Solution().minkowski())

In [10]:
show(minkowski.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_x}$
$\displaystyle \boldsymbol{_y}$
$\displaystyle \boldsymbol{_z}$

In [11]:
minkowski.g


' \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\ 0 & -1 & 0 & 0  \\\\ 0 & 0 & -1 & 0  \\\\ 0 & 0 & 0 & -1  \\end{array}\\right ] '
Out[11]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & -1 & 0 & 0\\0 & 0 & -1 & 0\\0 & 0 & 0 & -1\end{matrix}\right]$$

In [12]:
minkowski.e_sq


Out[12]:
$$-1$$

In [13]:
dot_basis_r_basis(minkowski)


Out[13]:
$$\left [ 1, \quad 1, \quad 1, \quad 1\right ]$$

In [14]:
gg(minkowski)


Out[14]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

Kerr-Debney Metric

$$ g=\left[ \begin{array}{cccc}{0} & {0} & {-e^{-z}} & {0} \\ {0} & {\frac{u^{2} e^{4 z}}{2}} & {0} & {0} \\ {-e^{-z}} & {0} & {12 e^{-2 z}} & {u e^{-z}} \\ {0} & {0} & {u e^{-z}} & {\frac{u^{2}}{2}}\end{array}\right] $$

In [15]:
g4coords = (u, x, y, z) = symbols("u x y z")
g = [
    [0, 0, -exp(-z), 0],
    [0, HALF * u ** 2 * exp(4 * z), 0, 0],
    [-exp(-z), 0, 12 * exp(-2 * z), u * exp(-z)],
    [0, 0, u * exp(-z), HALF * u ** 2],
]
g4 = build_ga_from_solution([g, g4coords, None, 0])

In [16]:
show(g4.mv())


$\displaystyle \boldsymbol{_u}$
$\displaystyle \boldsymbol{_x}$
$\displaystyle \boldsymbol{_y}$
$\displaystyle \boldsymbol{_z}$

In [17]:
g4.g


' \\left [ \\begin{array}{cccc} 0 & 0 & - e^{- z} & 0  \\\\ 0 & \\frac{u^{2} e^{4 z}}{2} & 0 & 0  \\\\ - e^{- z} & 0 & 12 e^{- 2 z} & u e^{- z}  \\\\ 0 & 0 & u e^{- z} & \\frac{u^{2}}{2}  \\end{array}\\right ] '
Out[17]:
$$\left[\begin{matrix}0 & 0 & - e^{- z} & 0\\0 & \frac{u^{2} e^{4 z}}{2} & 0 & 0\\- e^{- z} & 0 & 12 e^{- 2 z} & u e^{- z}\\0 & 0 & u e^{- z} & \frac{u^{2}}{2}\end{matrix}\right]$$

In [18]:
g4.e_sq


Out[18]:
$$- \frac{u^{4} e^{2 z}}{4}$$

In [19]:
dot_basis_r_basis(g4)


Out[19]:
$$\left [ - \frac{u^{4} e^{2 z}}{4}, \quad - \frac{u^{4} e^{2 z}}{4}, \quad - \frac{u^{4} e^{2 z}}{4}, \quad - \frac{u^{4} e^{2 z}}{4}\right ]$$

In [20]:
gg(g4)


Out[20]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

In [21]:
show_christoffel_symbols(g4)


$$\left[\begin{matrix}\left[\begin{matrix}0 & 0 & 0 & 0\\0 & - \frac{u e^{4 z}}{2} & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & - \frac{u}{2}\end{matrix}\right] & \left[\begin{matrix}0 & \frac{u e^{4 z}}{2} & 0 & 0\\\frac{u e^{4 z}}{2} & 0 & 0 & u^{2} e^{4 z}\\0 & 0 & 0 & 0\\0 & u^{2} e^{4 z} & 0 & 0\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & e^{- z}\\0 & 0 & 0 & 0\\0 & 0 & 0 & - 12 e^{- 2 z}\\e^{- z} & 0 & - 12 e^{- 2 z} & - u e^{- z}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & \frac{u}{2}\\0 & - u^{2} e^{4 z} & 0 & 0\\0 & 0 & 12 e^{- 2 z} & 0\\\frac{u}{2} & 0 & 0 & 0\end{matrix}\right]\end{matrix}\right]$$
$$\left[\begin{matrix}\left[\begin{matrix}0 & 0 & 0 & 0\\0 & 3 u e^{4 z} & 0 & 0\\0 & 0 & \frac{24 e^{- 2 z}}{u} & 12 e^{- z}\\0 & 0 & 12 e^{- z} & 6 u\end{matrix}\right] & \left[\begin{matrix}0 & \frac{1}{u} & 0 & 0\\\frac{1}{u} & 0 & 0 & 2\\0 & 0 & 0 & 0\\0 & 2 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & \frac{u e^{5 z}}{2} & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & \frac{u e^{z}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & \frac{1}{u}\\0 & - 3 e^{4 z} & 0 & 0\\0 & 0 & \frac{24 e^{- 2 z}}{u^{2}} & 0\\\frac{1}{u} & 0 & 0 & -1\end{matrix}\right]\end{matrix}\right]$$

Schwarzschild Metric

The classic black hole solution. Uncharged and rotationally stationary.


In [22]:
schwarzschild = build_ga_from_solution(Solution().schwarzschild())

In [23]:
show(schwarzschild.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_r}$
$\displaystyle \boldsymbol{_\theta }$
$\displaystyle \boldsymbol{_\phi }$

In [24]:
schwarzschild.g


' \\left [ \\begin{array}{cccc} - \\frac{2 G M}{c^{2} r} + 1 & 0 & 0 & 0  \\\\ 0 & - \\frac{1}{- \\frac{2 G M}{c^{2} r} + 1} & 0 & 0  \\\\ 0 & 0 & - r^{2} & 0  \\\\ 0 & 0 & 0 & - r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}  \\end{array}\\right ] '
Out[24]:
$$\left[\begin{matrix}- \frac{2 G M}{c^{2} r} + 1 & 0 & 0 & 0\\0 & - \frac{1}{- \frac{2 G M}{c^{2} r} + 1} & 0 & 0\\0 & 0 & - r^{2} & 0\\0 & 0 & 0 & - r^{2} \sin^{2}{\left (\theta \right )}\end{matrix}\right]$$

In [25]:
schwarzschild.e_sq


Out[25]:
$$- r^{4} \sin^{2}{\left (\theta \right )}$$

In [26]:
dot_basis_r_basis(schwarzschild)


Out[26]:
$$\left [ 1, \quad - \frac{\frac{2 G M}{c^{2} r} - 1}{- \frac{2 G M}{c^{2} r} + 1}, \quad 1, \quad 1\right ]$$

In [27]:
gg(schwarzschild)


Out[27]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

In [28]:
show_christoffel_symbols(schwarzschild)


$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{G M}{c^{2} r^{2}} & 0 & 0\\\frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}- \frac{G M}{c^{2} r^{2}} & 0 & 0 & 0\\0 & \frac{G M c^{2}}{4 G^{2} M^{2} + c^{2} r \left(- 4 G M + c^{2} r\right)} & 0 & 0\\0 & 0 & r & 0\\0 & 0 & 0 & r \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & - r & 0\\0 & - r & 0 & 0\\0 & 0 & 0 & \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & - r \sin^{2}{\left (\theta \right )}\\0 & 0 & 0 & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\\0 & - r \sin^{2}{\left (\theta \right )} & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2} & 0\end{matrix}\right]\end{matrix}\right]$$
$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{G M}{r \left(- 2 G M + c^{2} r\right)} & 0 & 0\\\frac{G M}{r \left(- 2 G M + c^{2} r\right)} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}\frac{G M \left(- 2 G M + c^{2} r\right)}{c^{4} r^{3}} & 0 & 0 & 0\\0 & \frac{G M}{r \left(2 G M - c^{2} r\right)} & 0 & 0\\0 & 0 & \frac{2 G M}{c^{2}} - r & 0\\0 & 0 & 0 & \frac{\left(2 G M - c^{2} r\right) \sin^{2}{\left (\theta \right )}}{c^{2}}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & \frac{1}{r} & 0\\0 & \frac{1}{r} & 0 & 0\\0 & 0 & 0 & - \frac{\sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & \frac{1}{r}\\0 & 0 & 0 & \frac{1}{\tan{\left (\theta \right )}}\\0 & \frac{1}{r} & \frac{1}{\tan{\left (\theta \right )}} & 0\end{matrix}\right]\end{matrix}\right]$$

Einstein-Rosen Bridge Metric

The most famous wormhole solution.


In [29]:
einstein_rosen_bridge = build_ga_from_solution(Solution().einstein_rosen_bridge())

In [30]:
show(einstein_rosen_bridge.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_r}$
$\displaystyle \boldsymbol{_\theta }$
$\displaystyle \boldsymbol{_\phi }$

In [31]:
einstein_rosen_bridge.g


' \\left [ \\begin{array}{cccc} \\frac{- 2 m + r}{r} & 0 & 0 & 0  \\\\ 0 & - \\frac{4 r}{- 4 m + 2 r} & 0 & 0  \\\\ 0 & 0 & - r^{2} & 0  \\\\ 0 & 0 & 0 & - r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}  \\end{array}\\right ] '
Out[31]:
$$\left[\begin{matrix}\frac{- 2 m + r}{r} & 0 & 0 & 0\\0 & - \frac{4 r}{- 4 m + 2 r} & 0 & 0\\0 & 0 & - r^{2} & 0\\0 & 0 & 0 & - r^{2} \sin^{2}{\left (\theta \right )}\end{matrix}\right]$$

In [32]:
einstein_rosen_bridge.e_sq


Out[32]:
$$- 2 r^{4} \sin^{2}{\left (\theta \right )}$$

In [33]:
dot_basis_r_basis(einstein_rosen_bridge)


Out[33]:
$$\left [ 1, \quad - \frac{4 r \left(\frac{m}{r} - \frac{1}{2}\right)}{- 4 m + 2 r}, \quad 1, \quad 1\right ]$$

In [34]:
gg(einstein_rosen_bridge)


Out[34]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

In [35]:
show_christoffel_symbols(einstein_rosen_bridge)


$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{m}{r^{2}} & 0 & 0\\\frac{m}{r^{2}} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}- \frac{m}{r^{2}} & 0 & 0 & 0\\0 & \frac{2 m}{4 m^{2} - 4 m r + r^{2}} & 0 & 0\\0 & 0 & r & 0\\0 & 0 & 0 & r \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & - r & 0\\0 & - r & 0 & 0\\0 & 0 & 0 & \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & - r \sin^{2}{\left (\theta \right )}\\0 & 0 & 0 & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\\0 & - r \sin^{2}{\left (\theta \right )} & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2} & 0\end{matrix}\right]\end{matrix}\right]$$
$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{m}{r \left(- 2 m + r\right)} & 0 & 0\\\frac{m}{r \left(- 2 m + r\right)} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}\frac{m \left(- 2 m + r\right)}{2 r^{3}} & 0 & 0 & 0\\0 & \frac{m}{r \left(2 m - r\right)} & 0 & 0\\0 & 0 & m - \frac{r}{2} & 0\\0 & 0 & 0 & \left(m - \frac{r}{2}\right) \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & \frac{1}{r} & 0\\0 & \frac{1}{r} & 0 & 0\\0 & 0 & 0 & - \frac{\sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & \frac{1}{r}\\0 & 0 & 0 & \frac{1}{\tan{\left (\theta \right )}}\\0 & \frac{1}{r} & \frac{1}{\tan{\left (\theta \right )}} & 0\end{matrix}\right]\end{matrix}\right]$$

Weak Field Approximation


In [36]:
wfa = build_ga_from_solution(Solution().weak_field_approximation())

In [37]:
show(wfa.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_r}$
$\displaystyle \boldsymbol{_\theta }$
$\displaystyle \boldsymbol{_\phi }$

In [38]:
wfa.g


' \\left [ \\begin{array}{cccc} c^{2} \\left(- \\frac{2 G M}{c^{2} r} + 1\\right) & 0 & 0 & 0  \\\\ 0 & - \\frac{1}{- \\frac{2 G M}{c^{2} r} + 1} & 0 & 0  \\\\ 0 & 0 & - r^{2} & 0  \\\\ 0 & 0 & 0 & - r^{2} {\\sin{\\left (\\theta  \\right )}}^{2}  \\end{array}\\right ] '
Out[38]:
$$\left[\begin{matrix}c^{2} \left(- \frac{2 G M}{c^{2} r} + 1\right) & 0 & 0 & 0\\0 & - \frac{1}{- \frac{2 G M}{c^{2} r} + 1} & 0 & 0\\0 & 0 & - r^{2} & 0\\0 & 0 & 0 & - r^{2} \sin^{2}{\left (\theta \right )}\end{matrix}\right]$$

In [39]:
show(wfa.mvr())


$\displaystyle \left ( \frac{r}{- 2 G M + c^{2} r} \boldsymbol{_t}, \quad \left ( \frac{2 G M}{c^{2} r} - 1\right ) \boldsymbol{_r}, \quad - \frac{1}{r^{2}} \boldsymbol{_\theta }, \quad - \frac{1}{r^{2} {\sin{\left (\theta \right )}}^{2}} \boldsymbol{_\phi }\right )$

In [40]:
wfa.e_sq


Out[40]:
$$- c^{2} r^{4} \sin^{2}{\left (\theta \right )}$$

In [41]:
dot_basis_r_basis(wfa)


Out[41]:
$$\left [ \frac{c^{2} \left(- \frac{2 G M}{c^{2} r} + 1\right)}{- \frac{2 G M}{r} + c^{2}}, \quad - \frac{\frac{2 G M}{c^{2} r} - 1}{- \frac{2 G M}{c^{2} r} + 1}, \quad 1, \quad 1\right ]$$

In [42]:
gg(wfa)


Out[42]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

In [43]:
wfa.connect_flg


Out[43]:
True

In [44]:
show_christoffel_symbols(wfa)


$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{G M}{r^{2}} & 0 & 0\\\frac{G M}{r^{2}} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}- \frac{G M}{r^{2}} & 0 & 0 & 0\\0 & \frac{G M c^{2}}{4 G^{2} M^{2} + c^{2} r \left(- 4 G M + c^{2} r\right)} & 0 & 0\\0 & 0 & r & 0\\0 & 0 & 0 & r \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & - r & 0\\0 & - r & 0 & 0\\0 & 0 & 0 & \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & - r \sin^{2}{\left (\theta \right )}\\0 & 0 & 0 & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2}\\0 & - r \sin^{2}{\left (\theta \right )} & - \frac{r^{2} \sin{\left (2 \theta \right )}}{2} & 0\end{matrix}\right]\end{matrix}\right]$$
$$\left[\begin{matrix}\left[\begin{matrix}0 & \frac{G M}{r \left(- 2 G M + c^{2} r\right)} & 0 & 0\\\frac{G M}{r \left(- 2 G M + c^{2} r\right)} & 0 & 0 & 0\\0 & 0 & 0 & 0\\0 & 0 & 0 & 0\end{matrix}\right] & \left[\begin{matrix}\frac{G M \left(- 2 G M + c^{2} r\right)}{c^{2} r^{3}} & 0 & 0 & 0\\0 & \frac{G M}{r \left(2 G M - c^{2} r\right)} & 0 & 0\\0 & 0 & \frac{2 G M}{c^{2}} - r & 0\\0 & 0 & 0 & \frac{\left(2 G M - c^{2} r\right) \sin^{2}{\left (\theta \right )}}{c^{2}}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & \frac{1}{r} & 0\\0 & \frac{1}{r} & 0 & 0\\0 & 0 & 0 & - \frac{\sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & 0\\0 & 0 & 0 & \frac{1}{r}\\0 & 0 & 0 & \frac{1}{\tan{\left (\theta \right )}}\\0 & \frac{1}{r} & \frac{1}{\tan{\left (\theta \right )}} & 0\end{matrix}\right]\end{matrix}\right]$$

Friedmann Lemaitre Robertson Walker metric

The spacetime for an expanding universe.


In [45]:
flrw = build_ga_from_solution(Solution().friedmann_lemaitre_robertson_walker())

In [46]:
show(flrw.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_r}$
$\displaystyle \boldsymbol{_\theta }$
$\displaystyle \boldsymbol{_\phi }$

In [47]:
flrw.g


' \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\ 0 & - \\frac{{a }^{2}}{- k r^{2} + 1} & 0 & 0  \\\\ 0 & 0 & - r^{2} {a }^{2} & 0  \\\\ 0 & 0 & 0 & - r^{2} {a }^{2} {\\sin{\\left (\\theta  \\right )}}^{2}  \\end{array}\\right ] '
Out[47]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & - \frac{a^{2}{\left (t \right )}}{- k r^{2} + 1} & 0 & 0\\0 & 0 & - r^{2} a^{2}{\left (t \right )} & 0\\0 & 0 & 0 & - r^{2} a^{2}{\left (t \right )} \sin^{2}{\left (\theta \right )}\end{matrix}\right]$$

In [48]:
flrw.e_sq


Out[48]:
$$\frac{r^{4} a^{6}{\left (t \right )} \sin^{2}{\left (\theta \right )}}{k r^{2} - 1}$$

In [49]:
dot_basis_r_basis(flrw)


Out[49]:
$$\left [ 1, \quad - \frac{\left(\frac{k r^{2}}{a^{2}{\left (t \right )}} - \frac{1}{a^{2}{\left (t \right )}}\right) a^{2}{\left (t \right )}}{- k r^{2} + 1}, \quad 1, \quad 1\right ]$$

In [50]:
gg(flrw)


Out[50]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

Hypersphere Metric

A metric which describes a spacetime where the cosmic time is assigned to the meaning of a 4D hypersphere radius. The essential idea behind this spacetime is that the "3+1" dimensionality commonly referenced in physics can be meaningfully mapped to the "3+1" dimensionality associated with a hypersphere; by the "3" angular coordinates and the "1" radial coordinate.


In [51]:
hypersphere = build_ga_from_solution(Solution().hypersphere())

In [52]:
show(hypersphere.mv())


$\displaystyle \boldsymbol{_t}$
$\displaystyle \boldsymbol{_\psi }$
$\displaystyle \boldsymbol{_\theta }$
$\displaystyle \boldsymbol{_\phi }$

In [53]:
hypersphere.g


' \\left [ \\begin{array}{cccc} 1 & 0 & 0 & 0  \\\\ 0 & - t^{2} & 0 & 0  \\\\ 0 & 0 & - t^{2} {\\sin{\\left (\\psi  \\right )}}^{2} & 0  \\\\ 0 & 0 & 0 & - t^{2} {\\sin{\\left (\\psi  \\right )}}^{2} {\\sin{\\left (\\theta  \\right )}}^{2}  \\end{array}\\right ] '
Out[53]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & - t^{2} & 0 & 0\\0 & 0 & - t^{2} \sin^{2}{\left (\psi \right )} & 0\\0 & 0 & 0 & - t^{2} \sin^{2}{\left (\psi \right )} \sin^{2}{\left (\theta \right )}\end{matrix}\right]$$

In [54]:
hypersphere.e_sq


Out[54]:
$$- t^{6} \sin^{4}{\left (\psi \right )} \sin^{2}{\left (\theta \right )}$$

In [55]:
dot_basis_r_basis(hypersphere)


Out[55]:
$$\left [ 1, \quad 1, \quad 1, \quad 1\right ]$$

In [56]:
gg(hypersphere)


Out[56]:
$$\left[\begin{matrix}1 & 0 & 0 & 0\\0 & 1 & 0 & 0\\0 & 0 & 1 & 0\\0 & 0 & 0 & 1\end{matrix}\right]$$

In [57]:
show_christoffel_symbols(hypersphere)


$$\left[\begin{matrix}\left[\begin{matrix}0 & 0 & 0 & 0\\0 & t & 0 & 0\\0 & 0 & t \sin^{2}{\left (\psi \right )} & 0\\0 & 0 & 0 & t \sin^{2}{\left (\psi \right )} \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & - t & 0 & 0\\- t & 0 & 0 & 0\\0 & 0 & \frac{t^{2} \sin{\left (2 \psi \right )}}{2} & 0\\0 & 0 & 0 & t^{2} \sin{\left (\psi \right )} \sin^{2}{\left (\theta \right )} \cos{\left (\psi \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & - t \sin^{2}{\left (\psi \right )} & 0\\0 & 0 & - \frac{t^{2} \sin{\left (2 \psi \right )}}{2} & 0\\- t \sin^{2}{\left (\psi \right )} & - \frac{t^{2} \sin{\left (2 \psi \right )}}{2} & 0 & 0\\0 & 0 & 0 & t^{2} \sin^{2}{\left (\psi \right )} \sin{\left (\theta \right )} \cos{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & - t \sin^{2}{\left (\psi \right )} \sin^{2}{\left (\theta \right )}\\0 & 0 & 0 & - t^{2} \sin{\left (\psi \right )} \sin^{2}{\left (\theta \right )} \cos{\left (\psi \right )}\\0 & 0 & 0 & - t^{2} \sin^{2}{\left (\psi \right )} \sin{\left (\theta \right )} \cos{\left (\theta \right )}\\- t \sin^{2}{\left (\psi \right )} \sin^{2}{\left (\theta \right )} & - t^{2} \sin{\left (\psi \right )} \sin^{2}{\left (\theta \right )} \cos{\left (\psi \right )} & - t^{2} \sin^{2}{\left (\psi \right )} \sin{\left (\theta \right )} \cos{\left (\theta \right )} & 0\end{matrix}\right]\end{matrix}\right]$$
$$\left[\begin{matrix}\left[\begin{matrix}0 & 0 & 0 & 0\\0 & t & 0 & 0\\0 & 0 & t \sin^{2}{\left (\psi \right )} & 0\\0 & 0 & 0 & t \sin^{2}{\left (\psi \right )} \sin^{2}{\left (\theta \right )}\end{matrix}\right] & \left[\begin{matrix}0 & \frac{1}{t} & 0 & 0\\\frac{1}{t} & 0 & 0 & 0\\0 & 0 & - \frac{\sin{\left (2 \psi \right )}}{2} & 0\\0 & 0 & 0 & - \sin{\left (\psi \right )} \sin^{2}{\left (\theta \right )} \cos{\left (\psi \right )}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & \frac{1}{t} & 0\\0 & 0 & \frac{1}{\tan{\left (\psi \right )}} & 0\\\frac{1}{t} & \frac{1}{\tan{\left (\psi \right )}} & 0 & 0\\0 & 0 & 0 & - \frac{\sin{\left (2 \theta \right )}}{2}\end{matrix}\right] & \left[\begin{matrix}0 & 0 & 0 & \frac{1}{t}\\0 & 0 & 0 & \frac{1}{\tan{\left (\psi \right )}}\\0 & 0 & 0 & \frac{1}{\tan{\left (\theta \right )}}\\\frac{1}{t} & \frac{1}{\tan{\left (\psi \right )}} & \frac{1}{\tan{\left (\theta \right )}} & 0\end{matrix}\right]\end{matrix}\right]$$

Kerr Metric


In [58]:
# Modified from https://github.com/spacetimeengineer/spacetimeengine/blob/master/spacetimeengine/src/solutions.py
def kerr_metric():
    """
    Description
    ===========
    Returns Kerr metric.
    """

    # Index configuration for the metric
    index_config = "dd"
    x0, x1, x2, x3 = symbols('x0 x1 x2 x3')
    # Reference to the coordiante system.
    coordinate_set = [x0, x1, x2, x3]
    # Cosmological constant.
    cosmological_constant = 0
    a, J, M, c, G, r, delt, sigm = symbols('a J M c G r Delta Sigma')
    a = (J/(M*c))
    rs = (2*G*M/(c**2))
    sigm = (x1**2 + (J/(M*c))**2 * cos(x2)**2)
    delt = (r**2 - x0 * (2*G*M/(c**2)) + (J/(M*c))**2)
    # Metric solution.
    metric = Matrix([
                                [ (1 - rs * x1 / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ), 0, 0, (2*G*M/(c**2))*x1*(J/(M*c))*sin(x2)**2 / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ], 
                                [ 0, -1 * ( (r**2 - x0 * (2*G*M/(c**2)) + (J/(M*c))**2) / (x1**2 + (J/(M*c))**2 * cos(x2)**2) ), 0, 0 ], 
                                [ 0, 0, -1 * (x1**2 + (J/(M*c))**2 * cos(x2)**2), 0 ],
                                [ (2*G*M/(c**2))*x1*(J/(M*c))*sin(x2)**2 / (x1**2 + (J/(M*c))**2 * cos(x2)**2), 0, 0, -1 * (x1**2 + (J/(M*c))**2 + (rs*x1*(J/(M*c))**2/(x1**2 + (J/(M*c))**2 * cos(x2)**2))*sin(x2))*sin(x2) ]
                            ])

    # An array detailing the solution.
    solution_array = [ metric, coordinate_set, index_config, cosmological_constant ]
    return solution_array

In [59]:
# kerr = build_ga_from_solution(kerr_metric())
# FIXME takes too long

In [ ]: