當前位置: 首頁>>代碼示例>>Python>>正文


Python scipy.sin方法代碼示例

本文整理匯總了Python中scipy.sin方法的典型用法代碼示例。如果您正苦於以下問題:Python scipy.sin方法的具體用法?Python scipy.sin怎麽用?Python scipy.sin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在scipy的用法示例。


在下文中一共展示了scipy.sin方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Z_Burnett

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sin [as 別名]
def Z_Burnett(Tr, Pr):
    """Calculate gas compressibility factor using the Burnett (1979)
    correlation

    Parameters
    ------------
    Tr : float
        Reduced temperature [-]
    Pr : float
        Reduced pressure [-]

    Returns
    -------
    Z : float
        Gas compressibility factor [-]

    Notes
    -----
    The correlation is in cited reference, the parameters are least square
    fitting by Leung.

    Raise :class:`NotImplementedError` if input pair isn't in limit:

        * 1.3 ≤ Tr ≤ 3
        * 0.2 ≤ Pr ≤ 4
    """
    # FIXME: Don't work
    # Check input in range of validity
    if Tr < 1.1 or Tr > 2.6 or Pr < 0.5 or Pr > 11:
        raise NotImplementedError("Incoming out of bound")

    Zo = 0.3379*log(log(Tr)) + 1.091
    Po = 21.46*Zo - 11.9*Zo**2 - 5.9
    N = (1.1 + 0.26*Tr + (1.04-1.42*Tr)*Pr/Po)*exp(Pr/Po)/Tr
    Z = 1 + (Zo-1) * sin(pi/2*Pr/Po)**N
    return unidades.Dimensionless(Z) 
開發者ID:jjgomera,項目名稱:pychemqt,代碼行數:38,代碼來源:crude.py

示例2: Mu_Muerto

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sin [as 別名]
def Mu_Muerto(self, T):
        """Viscosidad de petroleos muertos (sin gas disuelto)"""
        metodos=[self.Mu_Beal, self.Mu_Beggs_Robinson, self.Mu_Glaso, self.Mu_Egbogah, self.Mu_Kartoatmodjo_Schmidt][Preferences.getint("petro", "mu_dead")]
        return metodos(T) 
開發者ID:jjgomera,項目名稱:pychemqt,代碼行數:6,代碼來源:crude.py

示例3: spherical_integral

# 需要導入模塊: import scipy [as 別名]
# 或者: from scipy import sin [as 別名]
def spherical_integral(C,rho):
    """
    Calculate the integral of a function over a unit sphere.
    """
    # phi - azimuthal angle (angle in xy-plane)
    # theta - polar angle (angle between z and xy-plane)
    #       (  y  , x )
    def func(theta,phi,C,rho):  # Test function. Can I get 4*pi^2????
        x = sp.cos(phi)*sp.sin(theta)
        y = sp.sin(phi)*sp.sin(theta)
        z = sp.cos(theta)
        #dir = sp.array((x,y,z))
        #dc = dir_cosines(dir)
        dc = sp.array((x,y,z))  # Turns out these are direction cosines!
        Gamma = make_gamma(dc,C)
        rho_c_square = linalg.eigvals(Gamma).real  # GPa
        rho_c_square = rho_c_square*1e9  # Pa
        sound_vel = sp.sqrt(rho_c_square/rho)  # m/s
        integrand = 1/(sound_vel[0]**3) + 1/(sound_vel[1]**3) + 1/(sound_vel[2]**3)
        return integrand*sp.sin(theta)
    #        (  y  , x      )
    #def sfunc(theta,phi,args=()):
    #    return func(theta,phi,args)*sp.sin(theta)

    integral,error = dblquad(func,0,2*sp.pi,lambda g: 0,lambda h:
            sp.pi,args=(C,rho))
    return integral


#direction = sp.array((1.0,1.0,1.0))
#dc = dir_cosines(direction)
#C = read_file.read_file(sys.argv[1])
#C.pop(0)
#C = sp.array(C,float)
#Gamma = make_gamma(dc,C)
#density = 7500 #kg/m**3
#density = float(read_file.read_file(sys.argv[2])[0][0])
#rho_c_square = linalg.eigvals(Gamma) #GPa
#rho_c_square = rho_c_square*1e9 #Pa
#sound_vel = sp.sqrt(rho_c_square/density).real
#avg_vel = sp.average(sound_vel)
#print Gamma
#print direction
#print C
#print rho_c_square
#print rho_c_square.real
#print sound_vel," in m/s"
#print avg_vel
#print spherical_integral(C,density) 
開發者ID:wolverton-research-group,項目名稱:qmpy,代碼行數:51,代碼來源:sound_waves.py


注:本文中的scipy.sin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。