-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython_schw
More file actions
31 lines (31 loc) · 820 Bytes
/
python_schw
File metadata and controls
31 lines (31 loc) · 820 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from gravipy import *
#####################
# Coordinates (\chi is the four-vector of coordinates)
t, r, theta, phi, M = symbols('t, r, theta, phi, M')
x = Coordinates('\chi', [t, r, theta, phi])
#####################
# Metric tensor
Metric = diag((1-2*M/r), -1/(1-2*M/r), -r**2, -r**2*sin(theta)**2)
g = MetricTensor('g', x, Metric)
#####################
# Christoffel symbols
Ga = Christoffel('Ga', g)
# Display all components
print(Ga(All, All, All))
# Display a single component
print(Ga(1,2,1))
#####################
# Ricci tensor
Ri = Ricci('Ri', g)
# Display all components
print(Ri(All, All))
# Display a single component
print(Ri(1, 2))
#####################
# Einstein tensor
G = Einstein('G', Ri)
# Display all components
print(G(All, All))
# Display a single component
print(G(3, 3))
#####################