Ejemplo n.º 1
0
def sweep(getBoundary, psis,oscN=1,verbose=False,status=False):
    lss=['-', '--', '-.', ':']
    bbs=[]
    end=-1.0
    sols=[]
    varParamsv=[1]
    for psii in range(len(psis)):
        if status: printRatio(psii,len(psis))
        bbs.append([])
        sols.append([])
        psi=psis[psii]
        if verbose:
            print(str(psii+1)+'/'+str(len(psis))+'#'*100)
            print(str(psi)+':')
        source=0
        expect=1
        def f(phiD):
            bb,_=getBoundary(phiD,psi)
            return bb[0][source]
        start=0
        for osci in range(oscN):
            a=f(start)
            osc=True
            maxEnd=None
            factor=1.2
            if osci==0:
                if len(sols)>1:
                    end=sols[-2][osci]
            else:
                end=start*(oscN+1)/oscN
            while a*f(end)>=0:
                #print 'Expand..'*10
                end=end*factor
            sol=end
            first=True
            while first or osc>osci*2:
                if not first:
                    if verbose: print 'Osc..'*20
                    end=sol*(osci*2+1)/float(osc+1)
                while True:
                    if a*f(end)<0:
                        break
                    end=random()*sol
                    if verbose: print('rand: '+str(end/sol))
                sol=brentq(f,start,end,xtol=abs(end)*1e-7)
                bb,osc=getBoundary(sol,psi)
                #assert osc>=osci*2-1
                first=False
            start=sol*1.001#assumption
            bbs[-1].append(bb)
            sols[-1].append(sol)
    return (zip(*bbs), zip(*sols))
Ejemplo n.º 2
0
from getBoundary import getBoundary
from solveBC import sweep, findrho
from printStatus import printRatio
import numpy as np
import pylab as pl
from fig import fig, saveFig, printText

a2s=np.logspace(-4,4,60)
y1s,y2s=[],[]
Tr=2
for i in range(len(a2s)):
    a2=a2s[i]
    printRatio(i,len(a2s))
    bbs,sols=sweep(lambda x,y:getBoundary(x,y,[0,a2]),[1e-6],oscN=1)
    
    rho=-np.array(bbs)[:,:,1,1].real
    rhoc=min([min(r) for r in rho])#rho, in units used at Tc

    rho=rhoc/Tr**2
    zh=1
    T=3./(zh*4.*np.pi)
    Tc=T*np.sqrt(rho/rhoc)


    bb,osc=getBoundary(1,0,[0,a2])
    guess=rho/(-bb[1][1])
    from scipy.optimize import fsolve
    hphi=fsolve(lambda hphi:rho+getBoundary(hphi,0,[0,a2])[0][1][1], guess)

    w=1e-3*Tc
    bb,osc=getBoundary(hphi,0,[w,a2])
Ejemplo n.º 3
0
from getBoundary import getBoundary
from solveBC import sweep, findrho
from printStatus import printRatio
import numpy as np
import pylab as pl
from fig import fig, saveFig, printText

a2=1e4
Trs=np.logspace(0,2.5,12)
Cs=[]
bbs,sols=sweep(lambda x,y:getBoundary(x,y,[0,a2]),[1e-6],oscN=1)
rho=-np.array(bbs)[:,:,1,1].real
rhoc=min([min(r) for r in rho])#rho, in units used at Tc
for j in range(len(Trs)):
    Tr=Trs[j]
    printRatio(j,len(Trs))
    
    rho=rhoc/Tr**2
    zh=1
    T=3./(zh*4.*np.pi)
    Tc=T*np.sqrt(rho/rhoc)

    bb,osc=getBoundary(1,0,[0,a2])
    guess=rho/(-bb[1][1])
    from scipy.optimize import fsolve
    hphi=fsolve(lambda hphi:rho+getBoundary(hphi,0,[0,a2])[0][1][1], guess)

    w=1e-3*Tc
    bb,osc=getBoundary(hphi,0,[w,a2])
    assert osc==0
    sigma=-1j*bb[2][1]/( bb[2][0]*w )
Ejemplo n.º 4
0
from solveBC import sweep, findrho
from printStatus import printRatio
import numpy as np
import pylab as pl
from fig import fig, saveFig, printText

a2s=np.logspace(-4,4,60)
Trs=[5**i for i in range(7)]
y1s,y2s=[],[]
for j in range(len(Trs)):
    Tr=Trs[j]
    y1s.append([])
    y2s.append([])
    for i in range(len(a2s)):
        a2=a2s[i]
        printRatio(i+j*len(a2s),len(a2s)*len(Trs))
        bbs,sols=sweep(lambda x,y:getBoundary(x,y,[0,a2]),[1e-6],oscN=1)
        
        rho=-np.array(bbs)[:,:,1,1].real
        rhoc=min([min(r) for r in rho])#rho, in units used at Tc

        rho=rhoc/Tr**2
        zh=1
        T=3./(zh*4.*np.pi)
        Tc=T*np.sqrt(rho/rhoc)


        bb,osc=getBoundary(1,0,[0,a2])
        guess=rho/(-bb[1][1])
        from scipy.optimize import fsolve
        hphi=fsolve(lambda hphi:rho+getBoundary(hphi,0,[0,a2])[0][1][1], guess)
Ejemplo n.º 5
0

print('Transforming EQM...') #fields -> fields2
B=[s(M.x[0]) for s in sp.symbols(['B_r','B_i'])]; dum=sp.Dummy(positive=True)
ATransRI=[B[i]+[sp.re,sp.im][i](sp.exp(sp.log(dum)*Beta).rewrite(sp.cos)).subs(dum,1-M.x[0]) for i in range(2)]
eqm=eqm[:2]+[eqm[2].subs(fields[2],t).doit() for t in ATransRI]
fields2=fields[:2]+B


print('Putting EQM in canonical form...')
try:
    sols=sp.sympify(load(open('cache/EQMsols')),dict(zip([str(s) for s in syms],syms)))
except IOError:
    sols=[]
    for fi in range(len(fields2)):
        printRatio(fi,len(fields2))
        s=sp.solve(eqm[fi], fields2[fi].diff(M.x[0],2))
        print s
        assert len(s)==1
        sols+=s
    dump(str(sols),open('cache/EQMsols','w'))
for i in range(2,4):
    sols[i]=sols[i].subs(fields2[1].diff(M.x[0],2),sols[1])
dofs=reduce(lambda a,b:a+b,[[f, f.diff(M.x[0])] for f in fields2]) #list of fields and derivatives
dummies=[sp.Dummy('d'+str(i)) for i in range(len(dofs))]
sols=[v.subs(zip(dofs,dummies)[::-1]) for v in sols]


if not os.path.isfile('solveBulk.so'):
    print('Making C-code for numeric functions...')
    codegen([('f'+str(i*2+1),sols[i]) for i in range(len(fields2))]+
Ejemplo n.º 6
0
Tc=T*np.sqrt(rho/rhoc)


bb,osc=getBoundary(1,0,[0,a2])
guess=rho/(-bb[1][1])
from scipy.optimize import fsolve
hphi=fsolve(lambda hphi:rho+getBoundary(hphi,0,[0,a2])[0][1][1], guess)

mu=getBoundary(hphi,0,[0,a2])[0][1][0]

assert osc==0

ws=np.logspace(-3,3,100)
sigmas=[]
for i in range(len(ws)):
    printRatio(i,len(ws))
    bb,osc=getBoundary(hphi,0,[Tc*ws[i],a2])
    assert osc==0
    sigmas.append(-1j*bb[2][1]/( bb[2][0]*(Tc*ws[i]) ))

li=0
sigma0=sigmas[li].real
tauTc=sigmas[li].imag/(ws[li]*sigma0) #tau*Tc
drude=sigma0/(1-1j*ws*tauTc)
fig(0,size=11)
pl.plot(ws,[s.real for s in sigmas],c='k',label=r'$\mathrm{AdS/CFT}$')
pl.plot(ws,[s.real for s in drude],c=[1.0,0.,0.],ls='--',label=r'$\mathrm{Drude}$')
pl.plot(ws,[s.imag for s in sigmas],c='k')
pl.plot(ws,[s.imag for s in drude],ls='--',c=[1.,0.,0.])
#pl.plot(ws,[(sigmas[si]-drude[si]).real for si in range(len(drude))],c=[1.0,0.,0.],ls='--',label=r'$\mathrm{Drude}$')
pl.xlabel(r'$\frac{\omega}{T_c}$')
Ejemplo n.º 7
0
#const=mu
const=np.sqrt(rhos)
cConst=min([min(r) for r in const])#rho, in units used at Tc

zh=1.#choice of length units makes zh numerically constant
T=3./(zh*4.*np.pi)#temp of solution in units used, this is numerically constant by choice of units

try:
    As=load(open('cache/As_oscN='+str(oscN)+'_a2='+str(a2)))
except IOError:
    from scipy.integrate import cumtrapz
    As=[]
    for s in sols:
        As.append([])
        for i in range(len(hpsis)):
            printRatio(i,len(hpsis))
            _,_,(zs,y)=getBoundary(s[i], hpsis[i], [0,a2], plot=False, returnSol=True)
            Al=[0]+list(cumtrapz([Lfun(*([zs[j]]+[0,a2]+y[j][:-4]+[0,0]))
                for j in range(len(zs))][::-1], x=zs[::-1]))
            As[-1].append(Al[-1])
    dump(As,open('cache/As_oscN='+str(oscN)+'_a2='+str(a2),'w'))

fig(1)
for osci in range(len(mu)):
    sign=-1 if O[osci][0]<0 else 1
    Tc=T/cConst*const[osci]
    pl.plot(cConst/const[osci],As[osci]/Tc**3,ls='-' if sign==1 else '--',c='k')

#pl.plot(Trs,rho*zh/Tc,lw=1)
Trs=np.linspace(0.01,1.2,100)
if a2==0 and False:
Ejemplo n.º 8
0
        rhoSol = findrho(lambda x, y: getBoundary(x, y, [0, a2]), sols, hpsis, bbs, rho)
    else:
        bb, osc = getBoundary(1, 0, [0, a2])
        guess = rho / (-bb[1][1])
        from scipy.optimize import fsolve

        hphi = fsolve(lambda hphi: rho + getBoundary(hphi, 0, [0, a2])[0][1][1], guess)
        rhoSol = [[hphi, 0]]
    assert len(rhoSol) == 1
    rhoSol = rhoSol[0]
    sigmas = []
    bb, osc = getBoundary(rhoSol[0], rhoSol[1], [0, a2], plot=True)
    mu = bb[1][0]
    sigmas = []
    for wvi in range(len(wvs)):
        printRatio(j * len(wvs) + wvi, len(Trs) * len(wvs))
        bb, osc = getBoundary(rhoSol[0], rhoSol[1], [mu * wvs[wvi], a2])
        assert osc == 0
        sigmas.append(-1j * bb[2][1] / (bb[2][0] * (mu * wvs[wvi])))
    first = False
    # tot=np.trapz([s.real-1 for s in sigmas],x=[w*mu for w in wvs])
    qws = []
    qsigmas = []
    C = 0.15

    def sigmaf(lwv):
        wv = np.exp(lwv) - C
        bb, osc = getBoundary(rhoSol[0], rhoSol[1], [mu * wv, a2])
        assert osc == 0
        qsigmas.append(-1j * bb[2][1] / (bb[2][0] * (mu * wv)))
        qws.append(wv)
Ejemplo n.º 9
0

print('Transforming EQM...') #fields -> fields2
B=[s(M.x[0]) for s in sp.symbols(['B_r','B_i'])]; dum=sp.Dummy(positive=True)
ATransRI=[B[i]+[sp.re,sp.im][i](sp.exp(sp.log(dum)*Beta).rewrite(sp.cos)).subs(dum,1-M.x[0]) for i in range(2)]
eqm=eqm[:2]+[eqm[2].subs(fields[2],t).doit() for t in ATransRI]
fields2=fields[:2]+B


print('Putting EQM in canonical form...')
try:
    sols=sp.sympify(load(open('cache/EQMsols')),dict(zip([str(s) for s in syms],syms)))
except IOError:
    sols=[]
    for fi in range(len(fields2)):
        printRatio(fi,len(fields2))
        s=sp.solve(eqm[fi], fields2[fi].diff(M.x[0],2))
        print s
        assert len(s)==1
        sols+=s
    dump(str(sols),open('cache/EQMsols','w'))
for i in range(2,4):
    sols[i]=sols[i].subs(fields2[1].diff(M.x[0],2),sols[1])
dofs=reduce(lambda a,b:a+b,[[f, f.diff(M.x[0])] for f in fields2]) #list of fields and derivatives
dummies=[sp.Dummy('d'+str(i)) for i in range(len(dofs))]
sols=[v.subs(zip(dofs,dummies)[::-1]) for v in sols]


print('Making C-code for numeric functions...')
codegen([('f'+str(i*2+1),sols[i]) for i in range(len(fields2))]+
        [('dfdz'+str(i*2+1),sols[i].diff(M.x[0])) for i in range(len(fields2))]+