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


Python C.log方法代码示例

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


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

示例1: evalf_log

# 需要导入模块: from basic import C [as 别名]
# 或者: from basic.C import log [as 别名]
def evalf_log(expr, prec, options):
    arg = expr.args[0]
    workprec = prec+10
    xre, xim, xacc, _ = evalf(arg, workprec, options)

    if xim:
        # XXX: use get_abs etc instead
        re = evalf_log(C.log(C.abs(arg, evaluate=False), evaluate=False), prec, options)
        im = mpf_atan2(xim, xre or fzero, prec)
        return re[0], im, re[2], prec

    imaginary_term = (mpf_cmp(xre, fzero) < 0)

    re = mpf_log(mpf_abs(xre), prec, round_nearest)
    size = fastlog(re)
    if prec - size > workprec:
        # We actually need to compute 1+x accurately, not x
        arg = C.Add(S.NegativeOne,arg,evaluate=False)
        xre, xim, xre_acc, xim_acc = evalf_add(arg, prec, options)
        prec2 = workprec - fastlog(xre)
        re = mpf_log(mpf_add(xre, fone, prec2), prec, round_nearest)

    re_acc = prec

    if imaginary_term:
        return re, mpf_pi(prec), re_acc, prec
    else:
        return re, None, re_acc, None
开发者ID:cran,项目名称:rSymPy,代码行数:30,代码来源:evalf.py

示例2: _eval_subs

# 需要导入模块: from basic import C [as 别名]
# 或者: from basic.C import log [as 别名]
 def _eval_subs(self, old, new):
     if self==old: return new
     if isinstance(old, self.__class__) and self.base==old.base:
         coeff1,terms1 = self.exp.as_coeff_terms()
         coeff2,terms2 = old.exp.as_coeff_terms()
         if terms1==terms2: return new ** (coeff1/coeff2) # (x**(2*y)).subs(x**(3*y),z) -> z**(2/3*y)
     if old.func is C.exp:
         coeff1,terms1 = old.args[0].as_coeff_terms()
         coeff2,terms2 = (self.exp * C.log(self.base)).as_coeff_terms()
         if terms1==terms2: return new ** (coeff1/coeff2) # (x**(2*y)).subs(exp(3*y*log(x)),z) -> z**(2/3*y)
     return self.base._eval_subs(old, new) ** self.exp._eval_subs(old, new)
开发者ID:gnulinooks,项目名称:sympy,代码行数:13,代码来源:power.py

示例3: _eval_as_leading_term

# 需要导入模块: from basic import C [as 别名]
# 或者: from basic.C import log [as 别名]
 def _eval_as_leading_term(self, x):
     if not self.exp.has(x):
         return self.base.as_leading_term(x) ** self.exp
     return C.exp(self.exp * C.log(self.base)).as_leading_term(x)
开发者ID:rkern,项目名称:sympy-rkern,代码行数:6,代码来源:power.py

示例4: _eval_derivative

# 需要导入模块: from basic import C [as 别名]
# 或者: from basic.C import log [as 别名]
 def _eval_derivative(self, s):
     dbase = self.base.diff(s)
     dexp = self.exp.diff(s)
     return self * (dexp * C.log(self.base) + dbase * self.exp / self.base)
开发者ID:rkern,项目名称:sympy-rkern,代码行数:6,代码来源:power.py


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