Ejemplo n.º 1
0
from Ricci import *
from Rscalar import *
from ET import *

B = Function('B')
A = Function('A')

t = Symbol('t')
r = Symbol('r')
theta = Symbol('theta')
phi = Symbol('phi')

g = Metric((-B(r), 0, 0, 0), (0, A(r), 0, 0), (0, 0, r**2, 0),
           (0, 0, 0, r**2 * sin(theta)**2))
x = (t, r, theta, phi)
C = Christoffel(g, x)
Rie = Riemann(C, x)
Ric = Ricci(Rie, x)
Rs = Rscalar(Ric)
G = ET(Ric, g, Rs)

print 'Initial metric:'
pprint(g.matrix())
#C.nonzero()
Ric.nonzero()
#Rie.nonzero()
#Rs.printing()
G.nonzero()

print 'Initial metric:'
pprint(gdd)
Ejemplo n.º 2
0
t=Symbol('t')
r=Symbol('r')
theta=Symbol('theta')
phi=Symbol('phi')

A= Function('A')
K = Symbol('K')

#general, spherically symmetric metric
gdd=Matrix((
    (-1,0,0,0),
    (0, A(t)/(1 - K*r**2), 0, 0),
    (0, 0, A(t)*r**2, 0),
    (0, 0, 0, A(t)*r**2*sin(theta)**2)
    ))

g=Metric(gdd)
x=(t,r,theta,phi)
C=Christoffel(g,x)
Rie = Riemann(C,x)
Ric=Ricci( Rie,x)
Rs =Rscalar(Ric)


print 'Initial metric:'
pprint(gdd)
C.nonzero()
Ric.nonzero()
#Rie.nonzero()
#Rs.printing() 
Ejemplo n.º 3
0
t=Symbol('t')
r=Symbol('r')
theta=Symbol('theta')
phi=Symbol('phi')

#general, spherically symmetric metric
gdd=Matrix((
    (-B(r),0,0,0),
    (0, A(r), 0, 0),
    (0, 0, r**2, 0),
    (0, 0, 0, r**2*sin(theta)**2)
    ))

g=Metric(gdd)
X=(t,r,theta,phi)
Gamma=Christoffel(g,X)
Rie = Riemann(Gamma,X)
Ric=Ricci(Rie,X)
Rs =Rscalar(Ric)

print 'Initial metric:'
pprint(gdd)

Gamma.nonzero()
Ric.nonzero()
#Rie.nonzero()
Rs.printing() 

print '-'*40
#Solving EFE for A and B
s = ( Ric.dd(1,1)/ A(r) ) + ( Ric.dd(0,0)/ B(r) )
Ejemplo n.º 4
0
t=Symbol('t')
r=Symbol('r')
theta=Symbol('theta')
phi=Symbol('phi')

#general, spherically symmetric metric
gdd=Matrix((
    (-B(r),0,0,0),
    (0, A(r), 0, 0),
    (0, 0, r**2, 0),
    (0, 0, 0, r**2*sin(theta)**2)
    ))

g=Metric(gdd)
X=(t,r,theta,phi)
Gamma=Christoffel(g,X)
Ric=Ricci(Riemann(Gamma,X),X)

def pprint_Gamma_udd(i,k,l):
    pprint(Eq(Symbol('Gamma^%i_%i%i' % (i,k,l)), Gamma.udd(i,k,l)))

def pprint_Ric_dd(i,j):
    pprint(Eq(Symbol('R_%i%i' % (i,j)), Ric.dd(i,j)))

print 'Initial metric:'
pprint(gdd)
print '-'*40
print 'Christoffel symbols:'
for i in [0,1,2,3]:
	for k in [0,1,2,3]:
		for l in [0,1,2,3]:
Ejemplo n.º 5
0
from Rscalar import *

B = Function('B')
A = Function('A')

t = Symbol('t')
r = Symbol('r')
theta = Symbol('theta')
phi = Symbol('phi')

#general, spherically symmetric metric

g = Metric(((-B(r), 0, 0, 0), (0, A(r), 0, 0), (0, 0, r**2, 0),
            (0, 0, 0, r**2 * sin(theta)**2)))
x = (t, r, theta, phi)
C = Christoffel(g, x)
Rie = Riemann(C, x)
Ric = Ricci(Rie, x)
Rs = Rscalar(Ric)

print 'Initial metric:'
pprint(g.matrix())
C.nonzero()
Ric.nonzero()
#Rie.nonzero()
Rs.printing()

print '-' * 40
#Solving EFE for A and B
s = (Ric.dd(1, 1) / A(r)) + (Ric.dd(0, 0) / B(r))
#pprint (s)
Ejemplo n.º 6
0
from sympy import *
from Riemann import *

R = Symbol('R')
theta = Symbol('theta')
phi = Symbol('phi')

g = Metric((theta, phi))
g[-0, -0] = 1
g[-1, -1] = R**2 * (sin(theta))**2

print(g.components.keys())

g.invert()

C = Christoffel(g)
R = Riemann(C)
Ric = Ricci(R)
Rs = RicciScalar(g, Ric)
print "Christoffel: "
for i in range(len(C.nonzero)):
    print(str(C.nonzero[i][0]) + ":")
    print(cancel(C.nonzero[i][1]))
print "The components of the Ricci tensor for a FLRW universe are: "
for i in range(len(Ric.nonzero)):
    print(str(Ric.nonzero[i][0]) + ":")
    print(cancel(Ric.nonzero[i][1]))
for i in range(len(C.nonzero)):
    print(str(C.nonzero[i][0]) + ":")
    print(C.nonzero[i][1])
G = EnMt(g, Ric, Rs)
Ejemplo n.º 7
0
t=Symbol('t')
r=Symbol('r')
theta=Symbol('theta')
phi=Symbol('phi')

#general, spherically symmetric metric
gdd=Matrix((
    (-B(r),0,0,0),
    (0, A(r), 0, 0),
    (0, 0, r**2, 0),
    (0, 0, 0, r**2*sin(theta)**2)
    ))

g=Metric(gdd)
X=(t,r,theta,phi)
Gamma=Christoffel(g,X)
Rie = Riemann(Gamma,X)
Ric=Ricci(Rie,X)


print 'Initial metric:'
pprint(gdd)
print '-'*40
print 'Christoffel symbols:'
for i in [0,1,2,3]:
	for k in [0,1,2,3]:
		for l in [0,1,2,3]:
			if Gamma.udd(i,k,l) != 0 :
				Gamma.printing(i,k,l)
print'-'*40
print'Ricci tensor:'