Exemple #1
0
print('Generating Lagrangian...')
try:
    L=sp.sympify(load(open('cache/L')),dict(zip([str(s) for s in syms],syms)))
except IOError:
    L=getLagrangian(M,m2,0,0,alpha2,psi,A,verbose=True)
    dump(str(L),open('cache/L','w'))
L=L.subs(ass)
dofs=reduce(lambda a,b:a+b,[[f, f.diff(M.x[0])] for f in fields]) #list of fields and derivatives
dummies=[sp.Dummy('d'+str(i)) for i in range(len(dofs))]
Le=L.subs(A[2],0).subs(zip(dofs, dummies)[::-1]).subs(M.x[1],0).doit()
Lfun=sp.lambdify([M.x[0]]+varParams+dummies, Le)


print('Calculating equations of motion...')
eqm=[fieldEqn(L,f,M.x).subs(A[2],0).doit().simplify() for f in fields[:2]]
d=sp.Dummy()
eqm.append(series(fieldEqn(L,A[2],M.x).subs(A[2],d*Axf).doit(),d).subs(d,1).doit().simplify())
oeqm=eqm=[sp.fraction(e.cancel())[0] for e in eqm]
fields[2]=fieldsF[3](M.x[0])
del A

print('Solving indicial equations...')
try:
    ind=load(open('cache/indicial'))
except IOError:
    sing=[0,1]  #singular points to do expansion around
    ind=[indicial(eqm[:2],fields[:2], M.x[0], z0=s,verbose=True) for s in sing] #get solutions to indicial equation
    ind[1]=[i for i in ind[1] if i[1]>0] #remove solutions not satisfying z=1 BC
    for i in range(len(sing)): #some lousy code to first solve without A, and then add A. Because small A lim
        indn=[]
Exemple #2
0
    #TODO assert that r[0] x r[1] x ... x r[n] == i
    #reduce(lambda a,b:[[(ai,bi) for bi in b]for ai in a],r)
    assert(len(i)==reduce(lambda a,b:a*b, [len(ri) for ri in r]))
    return r

def getExpansion(ind,p,z):
    return [sum(j[0]*z**j[1] for j in zip(p[i], ind[i])) for i in range(len(ind))]

def getExpansionFun(ind,der=0):
    dums=[[sp.Dummy() for i in range(len(ind[j]))] for j in range(len(ind))]
    z=sp.Dummy('z')
    return sp.lambdify(reduce(lambda a,b:a+b,dums)+[z], [e.diff(z,der) for e in getExpansion(ind,dums,z)])

if __name__=="__main__":
    from metric import AdSBHz as M
    #fields, assume only radial dependence
    A=[f(M.x[0]) for f in sp.symbols(['Az','phi','A1','A2'])]
    psi=sp.Symbol('psi')(M.x[0])

    #parameters
    m2,gamma,alpha1,alpha2=sp.symbols(['m2','gamma','alpha1','alpha2'],real=True)

    L=getLagrangian(M,m2,gamma,alpha1,alpha2,psi,*A)
    L=L.subs({m2:-sp.S('2'),M.L:1,M.zh:1,gamma:0,alpha1:0,alpha2:0,A[0]:0,A[2]:0,A[3]:0}).doit()
    eqm=psieqm, phieqm=[fieldEqn(L,f,M.x).expand().collect(f) for f in [psi,A[1]]]

    sp.pprint(frobenius(eqm,[A[1],psi],M.x[0],0,2))
    sp.pprint(frobenius(eqm,[A[1],psi],M.x[0],1,2))

   
Exemple #3
0

print('Generating Lagrangian...')
try:
    L=sp.sympify(load(open('cache/L')),dict(zip([str(s) for s in syms],syms)))
except IOError:
    L=getLagrangian(M,m2,alpha3,alpha1,alpha2,psi,[A[0],A[1],A[2]*sp.exp(w*M.x[1]),A[3]],verbose=True)
    dump(str(L),open('cache/L','w'))
L=L.subs(ass)
dofs=reduce(lambda a,b:a+b,[[f, f.diff(M.x[0])] for f in fields]) #list of fields and derivatives
dummies=[sp.Dummy('d'+str(i)) for i in range(len(dofs))]
Lfun=sp.lambdify([M.x[0]]+varParams+dummies, L.subs(zip(dofs, dummies)[::-1]).subs(M.x[1],0))


print('Calculating equations of motion...')
eqm=[fieldEqn(L,f,M.x).expand().collect(f) for f in fields]
eqm=[series(e,A[2]).doit().simplify() for e in eqm] #assume small Ax, gives eqm linear in Ax

print('Solving indicial equations...')
try:
    ind=load(open('cache/indicial'))
except IOError:
    sing=[0,1]  #singular points to do expansion around
    ind=[indicial(eqm[:2],fields[:2], M.x[0], z0=s) for s in sing] #get solutions to indicial equation
    ind[1]=[i for i in ind[1] if i[1]>0] #remove solutions not satisfying z=1 BC
    for i in range(len(sing)): #some lousy code to first solve without A, and then add A. Because small A lim
        indn=[]
        for j in range(len(ind[i])):
            ind2=indicial([eqm[2].subs([(fields[fi],M.x[0]**ind[i][j][fi]) for fi in range(2)])],
                    fields[2:], M.x[0], z0=sing[i]) 
            for i2 in ind2:
Exemple #4
0
L=getLagrangian(M,m2,gamma,alpha1,alpha2,psi,*A)

'''L=L.subs({A[0]:0, A[3]:0}).doit()
Axeqm=fieldEqn(L,A[2],M.x)
Axeqm=Axeqm.subs(A[2],d).series(d,n=2).subs(sp.Order(d**2),0).subs(d,A[2])
Axeqm=(Axeqm/(M.x[0]**2*(M.x[0]**3-1))).ratsimp().collect(A[2])
Axeqm=sum(sp.simplify(e,ratio=1).collect(A[1]) for e in Axeqm.args)
#Axeqm=Axeqm.subs({A[2]:d,A[2].diff(M.x[0]):d2,A[2].diff(M.x[0]):d3}).series(d)
sp.pprint(Axeqm)
totex.save(Axeqm.subs({psi:sp.Symbol('psi'),A[1]:sp.Symbol('phi'),A[2]:sp.Symbol('A_x')}),'Axeqm')'''

L=L.subs({gamma:0,alpha1:0,alpha2:0,A[0]:0,A[3]:0}).doit()
#psieqm=simpSum( sp.fraction((fieldEqn(L,psi,M.x)/2).together())[0].collect(psi) )
#psieqm=(fieldEqn(L,psi,M.x)/(-M.r**2*2*M.f)).expand().collect(psi)

psieqm, phieqm, Axeqm=[sp.fraction(fieldEqn(L,f,M.x).together())[0].expand().collect(f) for f in [psi,A[1],A[2]]]

t=sp.Dummy('t')
hpsieqm=psieqm.subs(M.x[0],M.zh+t).simplify()

hpsiexp=[hpsieqm.diff(t,deg).limit(t,0).subs(A[1].subs(M.x[0],M.zh),0) for deg in range(2)]
sp.pprint( sp.solve(hpsiexp[1],psi.subs(M.x[0],M.zh))) #.diff(M.x[0]).subs(M.x[0],M.zh)) )
#phieqm=simpSum( (phieqm/(phieqm.subs(A[1].diff(M.x[0],2),d).diff(d))).together().ratsimp().collect(A[1]) )
#sol=sp.solve(phieqm.subs(A[1].diff(M.x[0],2),d),d)
#sp.pprint(sol)
#assert len(sol)==1
#fr=sp.fraction(sol[0])
#sp.pprint(fr[0].collect(A[1])/fr[1].collect(A[1]))
if __name__=='__main__':
    sp.pprint(psieqm)
    sp.pprint(phieqm)