当前位置: 首页>>代码示例>>Python>>正文


Python cmath.log方法代码示例

本文整理汇总了Python中cmath.log方法的典型用法代码示例。如果您正苦于以下问题:Python cmath.log方法的具体用法?Python cmath.log怎么用?Python cmath.log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmath的用法示例。


在下文中一共展示了cmath.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: F_87

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def F_87(Lmu, sh):
    """Function $F_8^{(7)}$ giving the contribution of $O_7$ to the matrix element
    of $O_8$, as given in eq. (40) of hep-ph/0312063.

    - `sh` is $\hat s=q^2/m_b^2$,
    """
    if sh==0.:
        return (-4*(33 + 24*Lmu + 6j*pi - 2*pi**2))/27.
    return (-32/9. * Lmu + 8/27. * pi**2 - 44/9. - 8/9. * 1j * pi
    + (4/3. * pi**2 - 40/3.) * sh + (32/9. * pi**2 - 316/9.) * sh**2
    + (200/27. * pi**2 - 658/9.) * sh**3 - 8/9. * log(sh) * (sh + sh**2 + sh**3))


# Functions for the two-loop virtual corrections to the matrix elements of
# O1,2 in b->dl+l- (also needed for doubly Cabibbo-suppressed contributions
# to b>sl+l-). Taken from hep-ph/0403185v2 (Seidel) 
开发者ID:flav-io,项目名称:flavio,代码行数:18,代码来源:matrixelements.py

示例2: delta_C7

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def delta_C7(par, wc, q2, scale, qiqj):
    alpha_s = running.get_alpha(par, scale)['alpha_s']
    mb = running.get_mb_pole(par)
    mc = par['m_c BVgamma']
    xi_t = ckm.xi('t', qiqj)(par)
    xi_u = ckm.xi('u', qiqj)(par)
    muh = scale/mb
    sh = q2/mb**2
    z = mc**2/mb**2
    Lmu = log(scale/mb)
    # computing this once to save time
    delta_tmp = wc['C1_'+qiqj] * F_17(muh, z, sh) + wc['C2_'+qiqj] * F_27(muh, z, sh)
    delta_t = wc['C8eff_'+qiqj] * F_87(Lmu, sh) + delta_tmp
    delta_u = delta_tmp + wc['C1_'+qiqj] * Fu_17(q2, mb, scale) + wc['C2_'+qiqj] * Fu_27(q2, mb, scale)
    # note the minus sign between delta_t and delta_u. This is because of a sign
    # switch in the definition of the "Fu" functions between hep-ph/0403185
    # (used here) and hep-ph/0412400, see footnote 5 of 0811.1214.
    return -alpha_s/(4*pi) * (delta_t - xi_u/xi_t * delta_u) 
开发者ID:flav-io,项目名称:flavio,代码行数:20,代码来源:matrixelements.py

示例3: delta_C9

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def delta_C9(par, wc, q2, scale, qiqj):
    alpha_s = running.get_alpha(par, scale)['alpha_s']
    mb = running.get_mb_pole(par)
    mc = running.get_mc_pole(par)
    xi_t = ckm.xi('t', qiqj)(par)
    xi_u = ckm.xi('u', qiqj)(par)
    muh = scale/mb
    sh = q2/mb**2
    z = mc**2/mb**2
    Lmu = log(scale/mb)
    Ls = log(sh)
    # computing this once to save time
    delta_tmp = wc['C1_'+qiqj] * F_19(muh, z, sh) + wc['C2_'+qiqj] * F_29(muh, z, sh)
    delta_t = wc['C8eff_'+qiqj] * F_89(Ls, sh) + delta_tmp
    delta_u = delta_tmp + wc['C1_'+qiqj] * Fu_19(q2, mb, scale) + wc['C2_'+qiqj] * Fu_29(q2, mb, scale)
    # note the minus sign between delta_t and delta_u. This is because of a sign
    # switch in the definition of the "Fu" functions between hep-ph/0403185
    # (used here) and hep-ph/0412400, see footnote 5 of 0811.1214.
    return -alpha_s/(4*pi) * (delta_t - xi_u/xi_t * delta_u) 
开发者ID:flav-io,项目名称:flavio,代码行数:21,代码来源:matrixelements.py

示例4: gLR

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def gLR(xc, xl):
    if xl == 0:
        return (4*sqrt(xc)*(1 + 9*xc - 9*xc**2 - xc**3 + 6*xc*(1 + xc)*log(xc))).real
    else:
        return (4*sqrt(xc)*(sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        + 10*xc*sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        + xc**2*sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - 5*xl*sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - 5*xc*xl*sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - 2*xl**2*sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - 12*xc*log(2) - 12*xc**2*log(2) + 24*xc*xl*log(2)
        - 12*xl**2*log(2) - 12*(-1 + xc)*xl**2* log(1 - sqrt(xc))
        - 6*xc*log(xc) - 6*xc**2*log(xc) + 12*xc*xl*log(xc) - 3*xl**2*log(xc)
        - 3*xc*xl**2*log(xc) - 6*xl**2*log(sqrt(xc) - 2*xc + xc**1.5)
        + 6*xc*xl**2* log(sqrt(xc) - 2*xc + xc**1.5) - 6*xl**2*log(xl)
        + 6*xc*xl**2*log(xl) + 12*xc*log(1 + xc - xl
        - sqrt(1 + (xc - xl)**2 - 2*(xc + xl)))
        + 12*xc**2*log(1 + xc - xl - sqrt(1 + (xc - xl)**2 - 2*(xc + xl)))
        - 24*xc*xl*log(1 + xc - xl - sqrt(1 + (xc - xl)**2 - 2*(xc + xl)))
        + 6*xl**2*log(1 + xc - xl - sqrt(1 + (xc - xl)**2 - 2*(xc + xl)))
        + 6*xc*xl**2* log(1 + xc - xl - sqrt(1 + (xc - xl)**2 - 2*(xc + xl)))
        + 6*xl**2*log(1 + xc**2 - xl + sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - xc*(2 + xl + sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))))
        - 6*xc*xl**2* log(1 + xc**2 - xl + sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl))
        - xc*(2 + xl + sqrt(xc**2 + (-1 + xl)**2 - 2*xc*(1 + xl)))))).real 
开发者ID:flav-io,项目名称:flavio,代码行数:27,代码来源:bxlnu.py

示例5: _digamma_complex

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def _digamma_complex(x):
    if not x.imag:
        return complex(_digamma_real(x.real))
    if x.real < 0.5:
        x = 1.0-x
        s = pi*cotpi(x)
    else:
        s = 0.0
    while abs(x) < 10.0:
        s -= 1.0/x
        x += 1.0
    x2 = x**-2
    t = x2
    for c in _psi_coeff:
        s -= c*t
        if abs(t) < 1e-20:
            break
        t *= x2
    return s + cmath.log(x) - 0.5/x 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:21,代码来源:math2.py

示例6: ei_taylor

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def ei_taylor(z, _e1=False):
    s = t = z
    k = 2
    while 1:
        t = t*z/k
        term = t/k
        if abs(term) < 1e-17:
            break
        s += term
        k += 1
    s += euler
    if _e1:
        s += log(-z)
    else:
        if type(z) is float or z.imag == 0.0:
            s += math_log(abs(z))
        else:
            s += cmath.log(z)
    return s 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:21,代码来源:math2.py

示例7: powm1

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def powm1(ctx, x, y):
    mag = ctx.mag
    one = ctx.one
    w = x**y - one
    M = mag(w)
    # Only moderate cancellation
    if M > -8:
        return w
    # Check for the only possible exact cases
    if not w:
        if (not y) or (x in (1, -1, 1j, -1j) and ctx.isint(y)):
            return w
    x1 = x - one
    magy = mag(y)
    lnx = ctx.ln(x)
    # Small y: x^y - 1 ~ log(x)*y + O(log(x)^2 * y^2)
    if magy + mag(lnx) < -ctx.prec:
        return lnx*y + (lnx*y)**2/2
    # TODO: accurately eval the smaller of the real/imag part
    return ctx.sum_accurately(lambda: iter([x**y, -1]), 1) 
开发者ID:nsalomonis,项目名称:altanalyze,代码行数:22,代码来源:functions.py

示例8: Plen

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def Plen(a):
    if is_num(a):
        if isinstance(a, complex) or a < 0:
            return cmath.log(a, 2)
        return math.log(a, 2)

    if is_col(a):
        return len(a)
    return unknown_types(Plen, "l", a) 
开发者ID:isaacg1,项目名称:pyth,代码行数:11,代码来源:macros.py

示例9: log

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def log(a, b=math.e):
    if not is_num(a) or not is_num(b):
        return unknown_types(log, ".l", a, b)
    if a < 0:
        return cmath.log(a, b)

    return math.log(a, b) 
开发者ID:isaacg1,项目名称:pyth,代码行数:9,代码来源:macros.py

示例10: computeBaseClassifierCoefficient

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def computeBaseClassifierCoefficient(self, classifierIdx):
        '''
        输入当前正在训练的基分类器下标(从0开始),计算当前的基分类器系数 alpha 。
        :param classifierIdx: 当前分类器下标(从0开始)
        :return:
        '''
        self.alphaList[classifierIdx] = (1.0 / 2 * \
                                         cmath.log((1.0-self.eList[classifierIdx])/self.eList[classifierIdx], cmath.e)\
                                         ).real 
开发者ID:ysh329,项目名称:statistical-learning-methods-note,代码行数:11,代码来源:AdaBoost.py

示例11: LOG

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def LOG(df, price='Close'):
    """
    Logarithm
    Returns: list of floats = jhta.LOG(df, price='Close')
    """
    return [cmath.log(df[price][i]).real for i in range(len(df[price]))] 
开发者ID:joosthoeks,项目名称:jhTAlib,代码行数:8,代码来源:math_functions.py

示例12: B0diffBFS

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def B0diffBFS(q2, u, mq, mB):
    ubar = 1 - u
    if mq == 0.:
        return -log(-(2/q2)) + log(-(2/(q2*u + mB**2 * ubar)))
    return B0(ubar * mB**2 + u * q2, mq) - B0(q2, mq)

# (29) of hep-ph/0106067v2 
开发者ID:flav-io,项目名称:flavio,代码行数:9,代码来源:qcdf.py

示例13: L1

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def L1(x):
    if x == 0.:
        return -(pi**2/6.)
    elif x == 1.:
        return 0
    return log((x - 1)/x) * log(1 - x) - pi**2/6. + li2(x/(x - 1)) 
开发者ID:flav-io,项目名称:flavio,代码行数:8,代码来源:qcdf.py

示例14: h

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def h(s, mq, mu):
  """Fermion loop function as defined e.g. in eq. (11) of hep-ph/0106067v2."""
  if mq == 0.:
      return 8/27. + (4j*pi)/9. + (8 * log(mu))/9. - (4 * log(s))/9.
  if s == 0.:
      return -4/9. * (1 + log(mq**2/mu**2))
  z = 4 * mq**2/s
  if z > 1:
      A = atan(1/sqrt(z-1))
  else:
      A = log((1+sqrt(1-z))/sqrt(z)) - 1j*pi/2.
  return (-4/9. * log(mq**2/mu**2) + 8/27. + 4/9. * z
          -4/9. * (2 + z) * sqrt(abs(z - 1)) * A) 
开发者ID:flav-io,项目名称:flavio,代码行数:15,代码来源:matrixelements.py

示例15: SeidelA

# 需要导入模块: import cmath [as 别名]
# 或者: from cmath import log [as 别名]
def SeidelA(q2, mb, mu):
    """Function $A(s\equiv q^2)$ defined in eq. (29) of hep-ph/0403185v2.
    """
    if q2==0:
        return 1/729. * (833 + 120j*pi - 312 * log(mb**2/mu**2))
    sh = min(q2/mb**2, 0.999)
    z = 4 / sh
    return (-(104)/(243) * log((mb**2)/(mu**2)) + (4 * sh)/(27 * (1 - sh)) *
    (li2(sh) + log(sh) * log( 1 - sh)) + (1)/(729 * (1 - sh)**2) * (6 * sh *
    (29 - 47 * sh) * log(sh) + 785 - 1600 * sh + 833 * sh**2 + 6 * pi * 1j * (20 -
    49 * sh + 47 * sh**2)) - (2)/(243 * (1 - sh)**3) * (2 * sqrt( z - 1) * (-4 +
    9 * sh - 15 * sh**2 + 4 * sh**3) * acot(sqrt(z - 1)) + 9 * sh**3 *
    log(sh)**2 + 18 * pi * 1j * sh * (1 - 2 * sh) * log(sh)) + (2 * sh)/(243 *
    (1 - sh)**4) * (36 * acot( sqrt(z - 1))**2 + pi**2 * (-4 + 9 * sh - 9 *
    sh**2 + 3 * sh**3))) 
开发者ID:flav-io,项目名称:flavio,代码行数:17,代码来源:matrixelements.py


注:本文中的cmath.log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。