complexes.py 文件源码

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

项目:Python-iBeacon-Scan 作者: NikNitro 项目源码 文件源码
def eval(cls, ar, period):
        # Our strategy is to evaluate the argument on the Riemann surface of the
        # logarithm, and then reduce.
        # NOTE evidently this means it is a rather bad idea to use this with
        # period != 2*pi and non-polar numbers.
        from sympy import ceiling, oo, atan2, atan, polar_lift, pi, Mul
        if not period.is_positive:
            return None
        if period == oo and isinstance(ar, principal_branch):
            return periodic_argument(*ar.args)
        if ar.func is polar_lift and period >= 2*pi:
            return periodic_argument(ar.args[0], period)
        if ar.is_Mul:
            newargs = [x for x in ar.args if not x.is_positive]
            if len(newargs) != len(ar.args):
                return periodic_argument(Mul(*newargs), period)
        unbranched = cls._getunbranched(ar)
        if unbranched is None:
            return None
        if unbranched.has(periodic_argument, atan2, arg, atan):
            return None
        if period == oo:
            return unbranched
        if period != oo:
            n = ceiling(unbranched/period - S(1)/2)*period
            if not n.has(ceiling):
                return unbranched - n
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号