power.py 文件源码

python
阅读 35 收藏 0 点赞 0 评论 0

项目:zippy 作者: securesystemslab 项目源码 文件源码
def _eval_power(self, other):
        from sympy.functions.elementary.exponential import log

        b, e = self.as_base_exp()
        b_nneg = b.is_nonnegative
        if b.is_real and not b_nneg and e.is_even:
            b = abs(b)
            b_nneg = True

        # Special case for when b is nan. See pull req 1714 for details
        if b is S.NaN:
            smallarg = abs(e).is_negative
        else:
            smallarg = (abs(e) - abs(S.Pi/log(b))).is_negative
        if (other.is_Rational and other.q == 2 and
                e.is_real is False and smallarg is False):
            return -self.func(b, e*other)
        if (other.is_integer or
            e.is_real and (b_nneg or (abs(e) < 1) == True) or
            e.is_real is False and smallarg is True or
                b.is_polar):
            return self.func(b, e*other)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号