Skip to content

Commit 5104877

Browse files
Update README.md
1 parent 5b20185 commit 5104877

1 file changed

Lines changed: 88 additions & 167 deletions

File tree

README.md

Lines changed: 88 additions & 167 deletions
Original file line numberDiff line numberDiff line change
@@ -1,208 +1,129 @@
1-
================================================================================
2-
SpacetimeEngine: Symbolic Einstein Field Equation Analyzer
3-
================================================================================
1+
![alt text](https://github.com/spacetimeengineer/spacetimeengine/blob/master/resources/spacetimeengine_logo.png)
42

5-
A Python utility built on Sympy (a symbolic mathematics library) that analyzes any given metric solution to the Einstein field equations.
3+
A Python utility built on Sympy (A symbolic mathematics library) which will analyze any given metric solution to the Einstein field equations.
64

7-
Einstein Field Equations:
8-
G_{μν} + Λg_{μν} = (8πG / c⁴) T_{μν}
5+
![equation](https://latex.codecogs.com/png.latex?%5Cdpi%7B100%7D%20%5Chuge%20G_%7B%5Cmu%5Cnu%7D%20+%20%5CLambda%20g_%7B%5Cmu%5Cnu%7D%20%3D%20%5Cfrac%7B8%5Cpi%20G%7D%7Bc%5E4%7DT_%7B%5Cmu%5Cnu%7D)
96

10-
--------------------------------------------------------------------------------
11-
Prerequisites
12-
--------------------------------------------------------------------------------
7+
# Prerequisites (Linux)
138

14-
Linux
15-
-----
16-
1. Install Python 3:
17-
$ sudo apt install python3
18-
19-
2. Install pip3:
20-
$ sudo apt install python3-pip
21-
22-
3. Install git:
23-
$ sudo apt-get install git
24-
25-
MacOS
26-
-----
27-
1. Install Homebrew:
28-
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
29-
30-
2. Set Python environment variable:
31-
$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"
32-
33-
3. Install git:
34-
$ brew install git
35-
36-
4. Install Python 3 and pip3:
37-
$ brew install python3
38-
$ brew postinstall python3
39-
40-
Windows
41-
-------
42-
1. Install Python 3 and pip3:
43-
https://www.python.org/downloads/
44-
45-
2. Install git:
46-
https://gitforwindows.org/
47-
48-
--------------------------------------------------------------------------------
49-
Installation
50-
--------------------------------------------------------------------------------
51-
52-
With pip3:
53-
----------
54-
1. Install package:
55-
$ pip3 install spacetimeengine
56-
57-
2. Enter Python shell:
58-
$ python3
59-
60-
3. Import the package:
61-
>>> from spacetimeengine import *
62-
63-
4. Create a SpaceTime object (Schwarzschild example):
64-
>>> schwarzschild_spacetime = SpaceTime(Solution().schwarzschild())
65-
66-
With git:
67-
---------
68-
1. Clone the repository:
69-
$ git clone https://github.com/spacetimeengineer/spacetimeengine
70-
71-
2. Navigate to the sample directory:
72-
$ cd spacetimeengine/spacetimeengine/samples
73-
74-
3. Run the example:
75-
$ python3 example.py
76-
77-
--------------------------------------------------------------------------------
78-
Suggested Use
79-
--------------------------------------------------------------------------------
80-
81-
SpacetimeEngine is useful for students and researchers studying General Relativity. If you're analyzing a metric solution in published literature, this tool can compute curvature tensors and help verify or explore their physical implications.
82-
83-
It is especially useful for validating metrics, checking errors, and learning how different tensors arise from a given spacetime configuration.
84-
85-
--------------------------------------------------------------------------------
86-
Metric Tensor
87-
--------------------------------------------------------------------------------
88-
89-
Any solution to the Einstein field equations is represented by a metric tensor, often in matrix form. SpacetimeEngine uses Sympy's Matrix object to represent this tensor.
90-
91-
Example: Schwarzschild Metric
9+
1.) Install Python3
9210

93-
g_{μν} =
94-
⎡ (1 - 2GM/rc²) 0 0 0 ⎤
95-
⎢ 0 -1/(1 - 2GM/rc²) 0 0 ⎥
96-
⎢ 0 0 -r² 0 ⎥
97-
⎣ 0 0 0 -r²sin²θ ⎦
11+
$ sudo apt install python3
9812

99-
--------------------------------------------------------------------------------
100-
Constructing a Solution (In Development)
101-
--------------------------------------------------------------------------------
13+
2.) Install pip3
10214

103-
All metric solutions are packaged into an array with the following elements:
104-
1. Metric (Sympy Matrix)
105-
2. Coordinate set
106-
3. Index configuration (e.g., "dd", "uu")
107-
4. Cosmological constant
15+
$ sudo apt install python3-pip
10816

109-
Example: Schwarzschild solution
17+
3.) Install git
11018

111-
def schwarzschild(self):
112-
x0, x1, x2, x3 = symbols('t r theta phi')
113-
coordinate_set = [x0, x1, x2, x3]
114-
G, M, c = symbols('G M c')
19+
$ sudo apt-get install git
11520

116-
metric = Matrix([
117-
[ (1 - (2*G*M)/(x1*c**2)), 0, 0, 0 ],
118-
[ 0, -1/(1 - (2*G*M)/(x1*c**2)), 0, 0 ],
119-
[ 0, 0, -x1**2, 0 ],
120-
[ 0, 0, 0, -x1**2*sin(x2)**2 ]
121-
])
21+
# Prerequisites (MacOS)
12222

123-
index_config = "dd"
124-
cosmological_constant = 0
23+
1.) Install homebrew
12524

126-
return [metric, coordinate_set, index_config, cosmological_constant]
25+
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" brew doctor
12726

128-
To use:
27+
2.) Set python as an environmental variable.
12928

130-
>>> spacetime = SpaceTime(Solution().schwarzschild())
29+
$ export PATH="/usr/local/opt/python/libexec/bin:$PATH"
13130

132-
Note: Only certain index configurations are currently supported.
31+
3.) Install git
13332

134-
--------------------------------------------------------------------------------
135-
Stress-Energy-Momentum Tensor
136-
--------------------------------------------------------------------------------
33+
$ brew install git
13734

138-
The tensor T_{μν} represents the distribution of mass and energy. The cosmological constant (Λ) can be set as a parameter.
35+
4.) Install python3 and pip3 (https://docs.python-guide.org/starting/install3/osx/)
13936

140-
Example:
37+
$ brew install python3
38+
$ brew postinstall python3
14139

142-
>>> cosmological_constant = 0
143-
>>> mu = 0 # dt
144-
>>> nu = 1 # dr
145-
>>> index_config = "dd"
146-
>>> spacetime.print_stress_energy_coefficient(index_config, mu, nu)
40+
# Prerequisites (Windows)
14741

148-
0
42+
1.) Install Python3 & pip3
14943

150-
(Schwarzschild is a vacuum solution, so T_{μν} = 0)
44+
Navigate to https://www.python.org/downloads/
15145

152-
--------------------------------------------------------------------------------
153-
Einstein Tensor
154-
--------------------------------------------------------------------------------
46+
2.) Install git
15547

156-
G_{μν} = R_{μν} - (1/2)Rg_{μν}
48+
Navigate to https://gitforwindows.org/
15749

158-
Describes curvature of spacetime.
50+
# Installation with pip3
15951

160-
Example:
52+
1.) Install with pip3
16153

162-
>>> mu = 0
163-
>>> nu = 1
164-
>>> index_config = "dd"
165-
>>> spacetime.print_einstein_coefficient(index_config, mu, nu)
54+
$ pip3 install spacetimeengine
16655

167-
G₀₁ = 0
56+
2.) Enter python shell
16857

169-
--------------------------------------------------------------------------------
170-
Ricci Tensor
171-
--------------------------------------------------------------------------------
58+
$ python3
17259

173-
The Ricci tensor R_{μν} measures how much volumes in curved space deviate from flat space.
60+
3.) Import spacetimeengine
17461

175-
R_{ij} = R^k_{ikj}
62+
>> from spacetimeengine import *
17663

177-
Example:
64+
4.) Create a SpaceTime object which describes the Schwarzschild spacetime
17865

179-
>>> spacetime.print_ricci_coefficient("dd", 3, 2)
66+
>> schwarzschild_spacetime = SpaceTime(Solution().schwarzschild())
18067

181-
R₃₂ = 0
68+
5.) Enjoy watching the coefficients get computed.
18269

183-
--------------------------------------------------------------------------------
184-
Riemann Tensor
185-
--------------------------------------------------------------------------------
70+
# Installation with git
18671

187-
Measures how the metric deviates from flat space at a point.
72+
1.) Clone repository
18873

189-
R^ρ_{σμν} = ∂μΓ^ρ_{νσ} - ∂νΓ^ρ_{μσ} + Γ^ρ_{μλ}Γ^λ_{νσ} - Γ^ρ_{νλ}Γ^λ_{μσ}
74+
$ git clone https://github.com/spacetimeengineer/spacetimeengine
19075

191-
Example:
76+
2.) Enter directory
19277

193-
>>> spacetime.print_reimann_coefficient("uddd", 3, 2, 2, 3)
78+
$ cd spacetimeengine/spacetimeengine/samples
19479

195-
-2⋅G⋅M
196-
R³₂₂₃ = ───────
197-
2
198-
c ⋅x₁
80+
3.) Run example.py
19981

200-
--------------------------------------------------------------------------------
201-
References
202-
--------------------------------------------------------------------------------
82+
$ python3 example.py
20383

204-
- Metric Tensor: https://en.wikipedia.org/wiki/Metric_tensor
205-
- Stress-Energy Tensor: https://en.wikipedia.org/wiki/Stress-energy_tensor
206-
- Einstein Tensor: https://en.wikipedia.org/wiki/Einstein_tensor
207-
- Ricci Tensor: https://en.wikipedia.org/wiki/Ricci_curvature
208-
- Riemann Tensor: https://en.wikipedia.org/wiki/Riemann_curvature_tensor
84+
# Suggested Use
85+
86+
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 associated 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.
87+
88+
## [Metric Tensor](https://en.wikipedia.org/wiki/Metric_tensor)
89+
90+
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.
91+
92+
![equation](https://latex.codecogs.com/png.latex?%5Cdpi%7B100%7D%20%5Chuge%20g_%7B%5Cmu%5Cnu%7D%3D%5Cbegin%7Bbmatrix%7D%20%5Cleft%20%28%201-%5Cfrac%7B2GM%7D%7Brc%5E%7B2%7D%7D%20%5Cright%20%29%20%26%200%20%26%200%20%26%200%20%5C%5C%200%20%26%20-%5Cleft%20%28%201-%5Cfrac%7B2GM%7D%7Brc%5E%7B2%7D%7D%20%5Cright%20%29%5E%7B-1%7D%20%26%200%20%26%200%20%5C%5C%200%20%26%200%20%26%20-r%5E%7B2%7D%20%26%200%20%5C%5C%200%20%26%200%20%26%200%20%26%20-r%5E%7B2%7D%5Csin%5E%7B2%7D%5Ctheta%20%5Cend%7Bbmatrix%7D)
93+
94+
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.
95+
96+
# Constructing a solution (In development)
97+
98+
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.
99+
100+
```python
101+
def schwarzschild(self):
102+
103+
# Assigns meaning to the coordinates.
104+
x0, x1, x2, x3 = symbols('t r theta phi')
105+
# Groups the coordinates in an array.
106+
coordinate_set = [x0, x1, x2, x3]
107+
108+
# Constants required to describe the metric.
109+
G, M, c = symbols('G M c')
110+
111+
# Metric.
112+
metric = Matrix([
113+
[ (1-(2*G*M)/(x1*c**2)), 0, 0, 0 ],
114+
[ 0, - (1-(2*G*M)/(x1*c**2))**(-1), 0, 0 ],
115+
[ 0, 0, - x1**2, 0 ],
116+
[ 0, 0, 0, - x1**2*sin(x2)**2 ]
117+
])
118+
119+
# Describes the index configuration which the metric represents.
120+
index_config = "dd"
121+
122+
# Cosmological constant.
123+
cosmological_constant = 0
124+
125+
# An array detailing the solution.
126+
solution_array = [ metric, coordinate_set, index_config, cosmological_constant ]
127+
128+
# Returns solution
129+
return solution_array

0 commit comments

Comments
 (0)