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


Python exprtools._monotonic_sign函数代码示例

本文整理汇总了Python中sympy.core.exprtools._monotonic_sign函数的典型用法代码示例。如果您正苦于以下问题:Python _monotonic_sign函数的具体用法?Python _monotonic_sign怎么用?Python _monotonic_sign使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _eval_is_negative

    def _eval_is_negative(self):
        from sympy.core.exprtools import _monotonic_sign

        if self.is_number:
            return super(Add, self)._eval_is_negative()
        c, a = self.as_coeff_Add()
        if not c.is_zero:
            v = _monotonic_sign(a)
            if v is not None:
                s = v + c
                if s.is_negative and a.is_nonpositive:
                    return True
                if len(self.free_symbols) == 1:
                    v = _monotonic_sign(self)
                    if v is not None and v.is_negative:
                        return True
        neg = nonpos = nonneg = unknown_sign = False
        saw_INF = set()
        args = [a for a in self.args if not a.is_zero]
        if not args:
            return False
        for a in args:
            isneg = a.is_negative
            infinite = a.is_infinite
            if infinite:
                saw_INF.add(fuzzy_or((isneg, a.is_nonpositive)))
                if True in saw_INF and False in saw_INF:
                    return
            if isneg:
                neg = True
                continue
            elif a.is_nonpositive:
                nonpos = True
                continue
            elif a.is_nonnegative:
                nonneg = True
                continue

            if infinite is None:
                return
            unknown_sign = True

        if saw_INF:
            if len(saw_INF) > 1:
                return
            return saw_INF.pop()
        elif unknown_sign:
            return
        elif not nonneg and not nonpos and neg:
            return True
        elif not nonneg and neg:
            return True
        elif not neg and not nonpos:
            return False
开发者ID:guanlongtianzi,项目名称:sympy,代码行数:54,代码来源:add.py

示例2: _eval_is_nonpositive

 def _eval_is_nonpositive(self):
     from sympy.core.exprtools import _monotonic_sign
     if not self.is_number:
         c, a = self.as_coeff_Add()
         if not c.is_zero and a.is_nonpositive:
             v = _monotonic_sign(a)
             if v is not None:
                 s = v + c
                 if s.is_nonpositive:
                     return True
                 if len(self.free_symbols) == 1:
                     v = _monotonic_sign(self)
                     if v is not None and v.is_nonpositive:
                         return True
开发者ID:nickle8424,项目名称:sympy,代码行数:14,代码来源:add.py


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