All Projects → spacetimeengineer → Spacetimeengine

spacetimeengineer / Spacetimeengine

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

Programming Languages

python
139335 projects - #7 most used programming language
gravity
16 projects

Projects that are alternatives of or similar to Spacetimeengine

Oscar.jl
A comprehensive open source computer algebra system for computations in algebra, geometry, and number theory.
Stars: ✭ 182 (+66.97%)
Mutual labels:  computer-algebra
Angourimath
Open-source symbolic algebra library for C# and F#. One of the most powerful in .NET
Stars: ✭ 266 (+144.04%)
Mutual labels:  computer-algebra
Symengine
SymEngine is a fast symbolic manipulation library, written in C++
Stars: ✭ 703 (+544.95%)
Mutual labels:  computer-algebra
symengine.rb
Ruby wrappers for SymEngine
Stars: ✭ 26 (-76.15%)
Mutual labels:  computer-algebra
libsemigroups
C++ library for semigroups and monoids
Stars: ✭ 34 (-68.81%)
Mutual labels:  computer-algebra
Expreduce
An experimental computer algebra system written in Go
Stars: ✭ 318 (+191.74%)
Mutual labels:  computer-algebra
diofant
A Python CAS library
Stars: ✭ 61 (-44.04%)
Mutual labels:  computer-algebra
Pymbolic
A simple package to do symbolic math (focus on code gen and DSLs)
Stars: ✭ 57 (-47.71%)
Mutual labels:  computer-algebra
Mathnet Symbolics
Math.NET Symbolics
Stars: ✭ 256 (+134.86%)
Mutual labels:  computer-algebra
Modelingtoolkit.jl
A modeling framework for automatically parallelized scientific machine learning (SciML) in Julia. A computer algebra system for integrated symbolics for physics-informed machine learning and automated transformations of differential equations
Stars: ✭ 540 (+395.41%)
Mutual labels:  computer-algebra
Hecke.jl
Computational algebraic number theory
Stars: ✭ 142 (+30.28%)
Mutual labels:  computer-algebra
obake
A C++20 library for the symbolic manipulation of sparse polynomials & co.
Stars: ✭ 16 (-85.32%)
Mutual labels:  computer-algebra
Kotlingrad
Shape-Safe Symbolic Differentiation with Algebraic Data Types
Stars: ✭ 388 (+255.96%)
Mutual labels:  computer-algebra
rascas
Computer Algebra System for Racket
Stars: ✭ 20 (-81.65%)
Mutual labels:  computer-algebra
Algebrite
Computer Algebra System in Javascript (Coffeescript)
Stars: ✭ 800 (+633.94%)
Mutual labels:  computer-algebra
piranha
The Piranha computer algebra system.
Stars: ✭ 91 (-16.51%)
Mutual labels:  computer-algebra
Grassmann.jl
⟨Leibniz-Grassmann-Clifford⟩ differential geometric algebra / multivector simplicial complex
Stars: ✭ 289 (+165.14%)
Mutual labels:  computer-algebra
Octsympy
A Symbolic Package for Octave using SymPy
Stars: ✭ 92 (-15.6%)
Mutual labels:  computer-algebra
Sympy
A computer algebra system written in pure Python
Stars: ✭ 8,688 (+7870.64%)
Mutual labels:  computer-algebra
Gap
Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
Stars: ✭ 447 (+310.09%)
Mutual labels:  computer-algebra

alt text Beta

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

equation

Prerequisites (Linux)

1.) Install Python3

$ sudo apt install python3

2.) Install pip3

$ sudo apt install python3-pip

3.) Install git

$ sudo apt-get install git

Prerequisites (MacOS)

1.) Install homebrew

$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor

2.) Set python as an enviornmental varible.

$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"

2.) Install git

$ brew install git

3.) Install python3 and pip3 (https://docs.python-guide.org/starting/install3/osx/)

$ brew install python3
$ brew postinstall python3

Prerequisites (Windows)

1.) Install Python3 & pip3

Navigate to https://www.python.org/downloads/

3.) Install git

Navigate to https://gitforwindows.org/

Installation with pip3

1.) Install with pip3

$ pip3 install spacetimeengine    

2.) Enter python shell

$ python3

3.) Import spacetimeengine

>> from spacetimeengine import *

4.) Create a SpaceTime object which describes the Schwarzschild spacetime

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

5.) Enjoy watching the coefficients get computed.

Installation with git

1.) Clone repository

$ git clone https://github.com/spacetimeengineer/spacetimeengine

2.) Enter directory

$ cd spacetimeengine/spacetimeengine/samples

3.) Run example.py

$ python3 example.py

Suggested Use

If you are a student or researcher, and you find yourself reading a publication based in General Relativity which provides metric solutions, then this utility can be used for working out the curvature coefficients which associate with the solution provided by the user. This can be a helpful utility as you read through the literature because you will be able to cross-reference the information provided by the literature with the values the spacetimeengine provides (this is why I developed it originally). More commonly, this utility can be used for error checking.

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 the spacetimeengine package adopts this representation.

equation

The spacetimeengine package 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 new solutions.

Constructing a solution (In development)

Currently, all metric solutions are packaged by specifying four key parameters and storing them in an array. These parameters include an index configuration for the given metric solution, the coordinates to define the metric in terms of, the metric itself, and the cosmological constant. It is important to note that a zero-valued cosmological constant indicates the employment of a classical formulation to the Einstein field equations. 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

It may be helpful to store the solutions in a separate module. I prefer to keep my solutions in a 'Solution()' class, which can be found in the 'solutions' module. To construct a 'SpaceTime' object just execute the command below, but first consider the given solution since high complexity solutions can take exponentially longer to process.

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

The index configuration in this case is "dd" which represents a down-down configuration, which reflects a double covariant index configuration. These can be "uu", "dd", "ud", "du", but this library currently only supports certain index configurations depending on the quantity in question.

Stress-Energy-Momentum Tensor

The Einstein field equations describe the equivilence of space-time curvature to mass-energy. The mass-energy is described 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 (since it is independent of the metric in most cases) and represents the dark energy thought to be responsble for the accellerated expansion of the cosmos.

equation

>>> 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.

equation

>>> 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.

equation

>>> 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.

equation

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

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

equation

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

            ⎛         2  ⎞
        G⋅M⋅⎝2⋅G⋅M - c ⋅r⎠
R₂₀₂₀ = ──────────────────
               4  2       
              c ⋅r        

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.

equation

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

       -G⋅M 
Γ₁₀₀ = ─────
        2  2
       c ⋅r 

Christoffel symbols of the Second Kind

equation

>>> 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.

equation

>>> 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)

equation

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

                                2
          ⎛         2  ⎞ ⎛d    ⎞ 
      G⋅M⋅⎝2⋅G⋅M - c ⋅r⎠⋅⎜──(t)⎟ 
                         ⎝dt   ⎠ 
P₀₀ = ───────────────────────────
                  4  3           
                 c ⋅r         

Geodesics parametrized by proper time (Experimental)

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

equation

>>> spacetime.print_proper_acceleration(0)

Geodesics parametrized by coordinate time (Experimental)

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

equation

>>> 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.

equation

>>> spacetime.print_separation_geodesic_acceleration(0)

Using with Jupyter Notebook (In development)

Jupyter notebook has become very popular tool for python development in recent years. It is great for science and research and this api is no exception. In order to use with Jupyter notebook the only thing to consider is the printing system.

Buy me a cold brew

Donate

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].