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

Install Package

pip install relativisticpy

Import Package and Write Your Equations


import relativisticpy as rel

wb = rel.Workbook()

wb.expr(
'''

MetricSymbol := G 
RicciSymbol := Ric 
Coordinates := [t, r, theta, phi] 

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

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

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

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

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

A = dsolve(eq6, A(r)) # Finally set the answers as A and B

B = 1/A

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

''')