示例#1
0
文件: RG.py 项目: iCodeIN/deft
def ID(integrand, T, n, i):
    maxn = 1 / (sigma**3 * np.pi / 6)
    # maxx = 1
    # if maxx*n > maxn:
    #     maxx = maxn/n
    maxx = np.minimum(np.ones_like(n), maxn / n)
    return integrate.midpoint(lambda x: integrand_ID(T, n, x, i), 0, maxx, 100)
示例#2
0
文件: RG.py 项目: droundy/deft
def ID_ref(integrand,T,n,i):
    maxn = 1/(sigma**3*np.pi/6)
    #maxx = 1
    maxx = np.minimum(np.ones_like(n),maxn/n)
    # if maxx*n > maxn:
    #     maxx = maxn/n
    return integrate.midpoint(lambda x: integrand_ID_ref(T,n,x,i),0,maxx,100)
示例#3
0
文件: RG.py 项目: droundy/deft
def ID(integrand,T,n,i):
    maxn = 1/(sigma**3*np.pi/6)
    # maxx = 1
    # if maxx*n > maxn:
    #     maxx = maxn/n
    maxx = np.minimum(np.ones_like(n),maxn/(n+1e-100)-1)
    return integrate.midpoint(lambda x: integrand_ID(T,n,x,i),0,maxx,1000)*n
示例#4
0
文件: RG.py 项目: yyfdemajia/deft
def ID_ref(integrand,T,n,i):
    maxn = 1/(sigma**3*np.pi/6)
    #maxx = 1
    #print "N inside IDREF: ",n
    maxx = np.minimum(np.ones_like(n),maxn/(n+1e-100)-1)
    # if maxx*n > maxn:
    #     maxx = maxn/n
    return integrate.midpoint(lambda x: integrand_ID_ref(T,n,x,i),0,maxx,1000)*n
示例#5
0
def ID2star(n, maxx):

        maxpower = -1e99
        dx = maxx/num_init
        xpoints = np.arange(dx/2,maxx, dx)
        kmax=0
        for k in range(len(xpoints)):
                if maxpower<onlyPowerStar(n,xpoints[k],fn):
                        maxpower = onlyPowerStar(n,xpoints[k],fn)
                        kmax=k
                
        #########FIND LEFT SIDE
        x_left = xpoints[kmax]
        k_left = kmax
        while k_left>0 and integrand_ID2star(n,maxpower,x_left)>0.1:
                k_left -= 1
                x_left = xpoints[k_left]
        #########FIND RIGHT SIDE
        x_right = xpoints[kmax]
        k_right = kmax
        while k_right<len(xpoints)-1 and integrand_ID2star(n,maxpower,x_right)>0.1:
                k_right += 1
                x_right = xpoints[k_right]
        

        integral_left = 0

        dx_left = x_left/num_left
        xpoints_left = np.arange(dx_left/2,x_left,dx_left)
        max_power_left = -1e99
        for k in range(len(xpoints_left)):
                max_power_left = max(max_power_left,onlyPowerStar(n,xpoints_left[k],fn))
        

        integral_right = 0
 
        dx_right = (maxx-x_right)/num_right
        xpoints_right = np.arange(x_right+dx_right/2,maxx,dx_right)
        max_power_right = -1e99
        for k in range(len(xpoints_right)):
                max_power_right = max(max_power_right,onlyPowerStar(n,xpoints_right[k],fn))


        
        integral_mid = 0
        
        dx_mid = (x_right-x_left)/num_mid
        xpoints_mid = np.arange(x_left+dx_mid/2,x_right,dx_mid)
        max_power_mid = -1e99
        for k in range(len(xpoints_mid)):
                max_power_mid = max(max_power_mid,onlyPowerStar(n,xpoints_mid[k],fn))
        

        if max_power_left > max_power_mid:
                x_left = 0
                integral_left = 0                
        else:
                integral_left += integrate.midpoint(lambda x: integrand_ID2star(n,max_power_left,x),0,x_left,num_left)*n
        if max_power_right > max_power_mid:
                x_right = maxx
                integral_right = 0
        else:
                integral_right += integrate.midpoint(lambda x: integrand_ID2star(n,max_power_right,x),x_right,maxx,num_right)*n
        
        if x_left != 0 and x_right != maxx:
                integral_mid += integrate.midpoint(lambda x: integrand_ID2star(n,max_power_mid,x),x_left,x_right,num_mid)*n

        else:
                dx_mid = (x_right-x_left)/num_mid
                xpoints_mid = np.arange(x_left+dx_mid/2,x_right,dx_mid)
                max_power_mid = -1e99
                for k in range(len(xpoints_mid)):
                        max_power_mid = max(max_power_mid,onlyPowerStar(n,xpoints_mid[k],fn))
                integral_mid += integrate.midpoint(lambda x: integrand_ID2star(n,max_power_mid,x),x_left,x_right,num_mid)*n
                

        if integral_left == 0 and integral_right == 0:
                #print "TTm=%.2E   \r"%(max_power_mid),
                return np.log(integral_mid)+max_power_mid
        if integral_left != 0 and integral_right == 0:
                #print "FTlm=%.2E   \r"%(max_power_left-max_power_mid),
                return np.log(integral_left*np.exp(max_power_left-max_power_mid)+integral_mid)+max_power_mid
        if integral_left == 0 and integral_right != 0:
                #print "TFrm=%.2E   \r"%(max_power_right-max_power_mid),
                return np.log(integral_right*np.exp(max_power_right-max_power_mid)+integral_mid)+max_power_mid
        
                
        #print "FFlm=%.2E FFrm=%.2E   \r"%(max_power_left-max_power_mid,max_power_right-max_power_mid),
        return np.log(integral_left*np.exp(max_power_left-max_power_mid)+integral_right*np.exp(max_power_right-max_power_mid)+integral_mid)+max_power_mid
示例#6
0
文件: RG_v2.py 项目: droundy/deft
def ID(integrand,T,n,i):
    maxn = 1/(sigma**3*np.pi/6)
    maxx = np.minimum(np.ones_like(n),maxn/n - 1)
    return integrate.midpoint(lambda x: integrand_ID(T,n,x,i),0,maxx,100)
示例#7
0
文件: RG.py 项目: maksimovica/deft
def ID_ref(integrand,T,n,i):
    value = integrate.midpoint(lambda x: integrand_ID_ref(T,x,i),0,1,1000)
    return value
示例#8
0
文件: RG_v2.py 项目: iCodeIN/deft
def ID_ref(integrand, T, n, i):
    maxn = 1 / (sigma**3 * np.pi / 6)
    maxx = np.minimum(np.ones_like(n), maxn / n - 1)
    return integrate.midpoint(lambda x: integrand_ID_ref(T, n, x, i), 0, maxx,
                              100)