RelativisticPy

RelativisticPy - General Relativity for physicists in a hurry. Simple equation looking User Interface. Write and Go! It is not the most complex, comprehensive or fast symbolic calculator, but it is a symbolic calculator.

PyPi | Source

TL;DR - Features & Installation

Install Python Environment

pip install relativisticpy

Black Hole Solution in < 10 lines


Coordinates := [t, r, theta, phi]

# Define the metric tensor components: we define a general spherically symmetric tensor

g_{mu}_{nu} := [[-A(r),0,0,0], [0,B(r),0,0], [0,0,r**2,0], [0,0,0,r**2*sin(theta)**2]]

# Now we have defined the metric above, we can call any individual component of the Ricci tensor itself (as it is metric dependent)

eq0 = Ric_{mu:0}_{nu:0}
eq1 = Ric_{mu:1}_{nu:1}
eq2 = Ric_{mu:2}_{nu:2}

# We construct a simplified equation from the Ricci components as follows

eq5 = (eq0*B(r) + eq1*A(r))*(r*B(r))

# We call the dsolve method which is a differential equation solver

solutionB = dsolve(eq5, B(r)) # returns B(r) = C1/A(r)

# We know the solution of B(r) = C1/A(r) so we substitute it in the third Ricci equation we have available to us

eq6 = simplify(subs(eq2, B(r), C1/A(r)))

# Finally set the answers as A and B

A = dsolve(eq6, A(r))

A

# DOES NOT WORK FROM THIS POINT ON => COMMENTED OUT --- FIX COMMING 

# B = 1/A

# Output the answer as latex, if you wish: (remove latex method if you do not)

# [[-A,0,0,0], [0,B,0,0], [0,0,r**2,0], [0,0,0,r**2*sin(theta)**2]]