spacetimeengine
pypi i spacetimeengine

# spacetimeengine

## A Python utility for analyzing a given solution to the Einstein's field equations. Built on Sympy.

### by Michael.C Ryan

0.1.11 (see all)
pypi i spacetimeengine

Beta

A Python utility built on Sympy (A symbolic mathematics library) which will analyze any given metric solution to the Einstein field equations.

$\dpi{100} \huge G_{\mu\nu} + \Lambda g_{\mu\nu} = \frac{8\pi G}{c^4}T_{\mu\nu}$

# Prerequisites

1.) Install Python3

$sudo apt install python3 2.) Install pip3$ sudo apt install python3-pip

$pip3 install sympy spacetimeengine # Installation with git 3.) Clone repository$ git clone https://github.com/spacetimeengineer/spacetimeengine

4.) Enter directory

# Metric Tensor

Generally speaking, any metric solution to the Einstein field equations will be packaged into a geometric object known as the metric tensor. The metric tensor is often represented in matrix form and SpacetimeEngine adopts this representation.

$\dpi{100} \huge \begin{pmatrix} \left ( 1- \frac{2GM}{rc^2} \right ) & 0 & 0& 0\\ 0& -\left ( 1- \frac{2GM}{rc^2} \right )^{-1}& 0& 0\\ 0& 0& -r^{2} & 0\\ 0& 0& 0& -r^{2}\sin^{2}\theta \end{pmatrix}$

SpacetimeEngine employs the Sympy 'Matrix' object for packaging the metric tensor and it serves as the essential parameter for constructing a 'SpaceTime' object. The Solutions module currently stores some well known metrics for study but these can be used for understanding how to construct a new solution for study.

# Constructing a solution (In development)

Currently, metric solutions are packaged by specifying four key parameters and storing them in an array. These paramaters include the index configuration for the given metric solution, the coordinates to define the metric in terms of, the metric and the cosmological constant. Below represents a valid definition of the Schwarzschild stationary black hole solution.

def schwarzschild(self):

# Assigns meaning to the coordinates.
x0, x1, x2, x3 = symbols('t r theta phi')
# Groups the coordinates in an array.
coordinate_set = [x0, x1, x2, x3]

# Constants required to describe the metric.
G, M, c = symbols('G M c')

# Metric.
metric = Matrix([
[ (1-(2*G*M)/(x1*c**2)), 0, 0, 0 ],
[ 0, - (1-(2*G*M)/(x1*c**2))**(-1), 0, 0 ],
[ 0, 0, - x1**2, 0 ],
[ 0, 0, 0, - x1**2*sin(x2)**2 ]
])

# Describes the index configuration which which the metric represents.
index_config = "dd"

# Cosmological constant.
cosmological_constant = 0

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

# Returns solution
return solution_array

To construct a 'SpaceTime' object just execute the below command and consider the solution given since high complexity solutions can take exponentially longer to process.

>>> spacetime = SpaceTime(Solution().schwarzschild())

The index configuration in this case is "dd" which represents down-down which represents a double covariant index configuration. These can be "uu", "dd", "ud", "du" but this library currently only supports

# Stress-Energy-Momentum Tensor

The Einstein field equations describe the equivilence of space-time curvature and mass-energy. The mass-energy is represented by the coefficents encompassed within the stress-energy-momentum tensor denoted by T_{\mu\nu}. The cosmological constant denoted by Lambda is treated as an input parameter and represents the dark energy thought to be responsble for the accellerated expansion of the cosmos.

$\dpi{100} \huge T_{\mu \nu }={\frac {c^{4}}{8\pi G}}\left ( G_{\mu \nu }+\Lambda g_{\mu \nu } \right )$

>>> cosmological_constant = 0
>>> mu = 0 # (dt)
>>> nu = 1 # (dr)
>>> index_config = "dd"
>>> spacetime.print_stress_energy_coefficient(index_config, mu, nu, cosmological_constant)

0

Since the Schwarzschild solution is a vacuum solution, any stress energy coefficient will yield a zero.

# The Einstein Tensor

The Einstein tensor denoted by $G_{\my\nu}$ desribes the curvature of spacetime and allows the Einstein field equations to be written in concise form.

$\inline \dpi{100} \huge G_{\mu \nu }=R_{\mu \nu }-{\tfrac {1}{2}}Rg_{\mu \nu }$

>>> mu = 0 # (dt)
>>> nu = 1 # (dr)
>>> index_config = "dd"
>>> spacetime.print_einstein_coefficient(index_config, mu, nu)

G₀₁ = 0

# Ricci Tensor

In differential geometry, the Ricci curvature tensor represents the amount by which the volume of a narrow conical piece of a small geodesic ball in a curved Riemannian manifold deviates from that of the standard ball in Euclidean space. As such, it provides one way of measuring the degree to which the geometry determined by a given Riemannian metric might differ from that of ordinary Euclidean n-space.

$\inline \dpi{100} \huge R_{ij} = {R^k}_{ikj}$

>>> mu = 0 # (dt)
>>> nu = 1 # (dr)
>>> index_config = "dd"
>>> spacetime.print_ricci_coefficient(index_config, 3, 2)

R₃₂ = 0

# Riemann Tensor

In the mathematical field of differential geometry, the Riemann curvature tensor is the most common method used to express the curvature of Riemannian manifolds. It assigns a tensor to each point of a Riemannian manifold (i.e., it is a tensor field), that measures the extent to which the metric tensor is not locally isometric to that of Euclidean space.

$\inline \dpi{100} \huge R^\rho{}_{\sigma\mu\nu} = \partial_\mu\Gamma^\rho{}_{\nu\sigma} - \partial_\nu\Gamma^\rho{}_{\mu\sigma} + \Gamma^\rho{}_{\mu\lambda}\Gamma^\lambda{}_{\nu\sigma} - \Gamma^\rho{}_{\nu\lambda}\Gamma^\lambda{}_{\mu\sigma}$

>>> index_config = "uddd"
>>> spacetime.print_reimann_coefficient(index_config, 3, 2, 2, 3)

-2⋅G⋅M
R³₂₂₃ = ───────
2
c ⋅x₁

$\inline \dpi{100} \huge {\displaystyle R_{ik\ell m}={\frac {1}{2}}\left({\frac {\partial ^{2}g_{im}}{\partial x^{k}\partial x^{\ell }}}+{\frac {\partial ^{2}g_{k\ell }}{\partial x^{i}\partial x^{m}}}-{\frac {\partial ^{2}g_{i\ell }}{\partial x^{k}\partial x^{m}}}-{\frac {\partial ^{2}g_{km}}{\partial x^{i}\partial x^{\ell }}}\right)+g_{np}\left(\Gamma ^{n}{}_{k\ell }\Gamma ^{p}{}_{im}-\Gamma ^{n}{}_{km}\Gamma ^{p}{}_{i\ell }\right)}$

>>> spacetime.print_riemann_coefficient("dddd", 2, 0, 2, 0)

⎛         2GM⋅⎝2GM - crR₂₀₂₀ = ──────────────────
4  2
cr

# Christoffel symbols of the First Kind

The connection coefficients or 'Christoffel symbol' are an array of numbers which represent the metric connection. The metric connection can be used to measure distances along curved manifolds. In General Relativity, the metric connection actually identifies the meaning of the gravitational field and can be used to track trajectories through spacetime.

$\inline \dpi{100} \huge \Gamma _{cab}={\tfrac {1}{2}}\left({\frac {\partial g_{ca}}{\partial x^{b}}}+{\frac {\partial g_{cb}}{\partial x^{a}}}-{\frac {\partial g_{ab}}{\partial x^{c}}}\right)$

>>> spacetime.print_connection_coefficient("ddd", 1, 0, 0)

-GM
Γ₁₀₀ = ─────
2  2
cr

# Christoffel symbols of the Second Kind

$\inline \dpi{100} \huge \Gamma ^{i}{}_{kl}={\tfrac {1}{2}}g^{im}\left({\frac {\partial g_{mk}}{\partial x^{l}}}+{\frac {\partial g_{ml}}{\partial x^{k}}}-{\frac {\partial g_{kl}}{\partial x^{m}}}\right)$

>>> index_config = "udd"
>>> spacetime.print_connection_coefficient(index_config, 1, 3, 3)

⎛         2   ⎞    2
⎝2⋅G⋅M - c ⋅x₁⎠⋅sin (x₂)
Γ¹₃₃ = ────────────────────────
2
c

# Weyl Tensor

In differential geometry, the Weyl curvature tensor, named after Hermann Weyl, is a measure of the curvature of spacetime or, more generally, a pseudo-Riemannian manifold. Like the Riemann curvature tensor, the Weyl tensor expresses the tidal force that a body feels when moving along a geodesic. The Weyl tensor differs from the Riemann curvature tensor in that it does not convey information on how the volume of the body changes, but rather only how the shape of the body is distorted by the tidal force.

$\dpi{100} \huge {\displaystyle C_{ik\ell m}=R_{ik\ell m}+{\frac {1}{n-2}}\left(R_{im}g_{k\ell }-R_{i\ell }g_{km}+R_{k\ell }g_{im}-R_{km}g_{i\ell }\right)+{\frac {1}{(n-1)(n-2)}}R\left(g_{i\ell }g_{km}-g_{im}g_{k\ell }\right),}$

>>> index_config = "dddd"
>>> spacetime.print_weyl_coefficient(index_config, 3, 2, 2, 3)

2
2⋅G⋅M⋅r⋅sin (θ)
C₃₂₂₃ = ───────────────
2
c

# Schouten Tensor (Experimental)

$\dpi{100} \huge P_{ij} = \frac{1}{n-2}\left ( R_{ij} - \frac{R}{2d-2}\: g_{ij} \right )$

>>> spacetime.get_schouten_coefficient("dd",0,0)

22  ⎞ ⎛dGM⋅⎝2GM - cr⎠⋅⎜──(t)⎟
⎝dtP₀₀ = ───────────────────────────
4  3
cr

# Geodesics parametrized by proper time (Experimental)

This is a measure of the local acceleration; that which could be measured by an accelerometer.

$\dpi{100} \huge \frac{d^{2}x^{\lambda}}{d\tau^{2}}+\Gamma^{\lambda}_{\mu\nu}\frac{dx^{\mu}}{d\tau}\frac{dx^{\nu}}{d\tau}=0$

>>> spacetime.print_proper_acceleration(0)

# Geodesics parametrized by coordinate time (Experimental)

This is a measure of the accelleration one observers another undergoing.

$\dpi{100} \huge \frac{d^{2}x^{\lambda}}{dt^{2}}=\Gamma^{0}_{\mu\nu}\frac{dx^{\mu}}{dt}\frac{dx^{\nu}}{dt}\frac{dx^{\lambda}}{dt}\;-\;\Gamma^{\lambda}_{\mu\nu}\frac{dx^{\mu}}{dt}\frac{dx^{\nu}}{dt}$

>>> spacetime.print_coordinate_acceleration(0)

# Geodesic deviation equation (Experimental)

This is a measure of how much two initial paralell geodesic paths will deviate or converge.

$\dpi{100} \huge \frac{d^{2}\xi^{\lambda}}{dt^{2}}=-\;R^{\lambda}_{\mu\nu\ell}\frac{dx^{\mu}}{dt}\frac{dx^{\nu}}{dt}\xi^{\ell}$

>>> spacetime.print_separation_geodesic_acceleration(0)

117

1yr ago

1

2

15

### OPEN PRs

0
VersionTagPublished
0.1.11
3yrs ago
0.1.10
3yrs ago
0.1.8
3yrs ago
0.1.7
3yrs ago