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


Python Q.is_true方法代码示例

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


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

示例1: test_Piecewise

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_Piecewise():
    assert refine(Piecewise((1, x < 0), (3, True)), Q.is_true(x < 0)) == 1
    assert refine(Piecewise((1, x < 0), (3, True)), ~Q.is_true(x < 0)) == 3
    assert refine(Piecewise((1, x < 0), (3, True)), Q.is_true(y < 0)) == \
        Piecewise((1, x < 0), (3, True))
    assert refine(Piecewise((1, x > 0), (3, True)), Q.is_true(x > 0)) == 1
    assert refine(Piecewise((1, x > 0), (3, True)), ~Q.is_true(x > 0)) == 3
    assert refine(Piecewise((1, x > 0), (3, True)), Q.is_true(y > 0)) == \
        Piecewise((1, x > 0), (3, True))
    assert refine(Piecewise((1, x <= 0), (3, True)), Q.is_true(x <= 0)) == 1
    assert refine(Piecewise((1, x <= 0), (3, True)), ~Q.is_true(x <= 0)) == 3
    assert refine(Piecewise((1, x <= 0), (3, True)), Q.is_true(y <= 0)) == \
        Piecewise((1, x <= 0), (3, True))
    assert refine(Piecewise((1, x >= 0), (3, True)), Q.is_true(x >= 0)) == 1
    assert refine(Piecewise((1, x >= 0), (3, True)), ~Q.is_true(x >= 0)) == 3
    assert refine(Piecewise((1, x >= 0), (3, True)), Q.is_true(y >= 0)) == \
        Piecewise((1, x >= 0), (3, True))
    assert refine(Piecewise((1, Eq(x, 0)), (3, True)), Q.is_true(Eq(x, 0)))\
        == 1
    assert refine(Piecewise((1, Eq(x, 0)), (3, True)), ~Q.is_true(Eq(x, 0)))\
        == 3
    assert refine(Piecewise((1, Eq(x, 0)), (3, True)), Q.is_true(Eq(y, 0)))\
        == Piecewise((1, Eq(x, 0)), (3, True))
    assert refine(Piecewise((1, Ne(x, 0)), (3, True)), Q.is_true(Ne(x, 0)))\
        == 1
    assert refine(Piecewise((1, Ne(x, 0)), (3, True)), ~Q.is_true(Ne(x, 0)))\
        == 3
    assert refine(Piecewise((1, Ne(x, 0)), (3, True)), Q.is_true(Ne(y, 0)))\
        == Piecewise((1, Ne(x, 0)), (3, True))
开发者ID:preetskhalsa97,项目名称:sympy,代码行数:31,代码来源:test_refine.py

示例2: test_Relational

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_Relational():
    assert not refine(x < 0, ~Q.is_true(x < 0))
    assert refine(x < 0, Q.is_true(x < 0))
    assert refine(x < 0, Q.is_true(y < 0)) == (x < 0)
    assert not refine(x <= 0, ~Q.is_true(x <= 0))
    assert refine(x <= 0,  Q.is_true(x <= 0))
    assert refine(x <= 0,  Q.is_true(y <= 0)) == (x <= 0)
    assert not refine(x > 0, ~Q.is_true(x > 0))
    assert refine(x > 0,  Q.is_true(x > 0))
    assert refine(x > 0,  Q.is_true(y > 0)) == (x > 0)
    assert not refine(x >= 0, ~Q.is_true(x >= 0))
    assert refine(x >= 0,  Q.is_true(x >= 0))
    assert refine(x >= 0,  Q.is_true(y >= 0)) == (x >= 0)
    assert not refine(Eq(x, 0), ~Q.is_true(Eq(x, 0)))
    assert refine(Eq(x, 0),  Q.is_true(Eq(x, 0)))
    assert refine(Eq(x, 0),  Q.is_true(Eq(y, 0))) == Eq(x, 0)
    assert not refine(Ne(x, 0), ~Q.is_true(Ne(x, 0)))
    assert refine(Ne(x, 0),  Q.is_true(Ne(x, 0)))
    assert refine(Ne(x, 0),  Q.is_true(Ne(y, 0))) == (Ne(x, 0))
开发者ID:preetskhalsa97,项目名称:sympy,代码行数:21,代码来源:test_refine.py

示例3: test_N8

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N8():
    x, y, z = symbols('x y z', real=True)
    assert ask(Q.is_true((x == y) & (y == z)), Q.is_true((x >= y) & (y >= z) & (z >= x)))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例4: test_M27

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_M27():
    x = symbols('x', real=True)
    b = symbols('b', real=True)
    with assuming(Q.is_true(sin(cos(1/E**2) + 1) + b > 0)):
        solve(log(acos(asin(x**R(2,3) - b) - 1)) + 2, x) == [-b - sin(1 + cos(1/e**2))**R(3/2), b + sin(1 + cos(1/e**2))**R(3/2)]
开发者ID:akritas,项目名称:sympy,代码行数:7,代码来源:test_wester.py

示例5: test_N6

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N6():
    x, y, k, n = symbols('x y k n', real=True)
    assert ask(Q.is_true(k*x**n > k*y**n), Q.is_true((x > y) & (y > 0) & (k > 0) & (n > 0)))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例6: test_N7

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N7():
    x, y = symbols('x y', real=True)
    assert ask(Q.is_true(y > 0), Q.is_true((x > 1) & (y >= x - 1)))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例7: test_N5

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N5():
    x, y, k = symbols('x y k', real=True)
    assert ask(Q.is_true(k*x**2 > k*y**2), Q.is_true((x > y) & (y > 0) & (k > 0)))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例8: test_N4

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N4():
    x, y = symbols('x y', real=True)
    assert ask(Q.is_true(2*x**2 > 2*y**2), Q.is_true((x > y) & (y > 0)))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例9: test_N3

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N3():
    x = symbols('x', real=True)
    assert ask(Q.is_true(And(Lt(-1, x), Lt(x, 1))), Q.is_true(abs(x) < 1 ))
开发者ID:akritas,项目名称:sympy,代码行数:5,代码来源:test_wester.py

示例10: test_N2

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N2():
    x = symbols('x', real=True)
    assert ask(Q.is_true(x**4 - x + 1 > 0))
    assert ask(Q.is_true(x**4 - x + 1 > 1)) == False
开发者ID:akritas,项目名称:sympy,代码行数:6,代码来源:test_wester.py

示例11: test_N1

# 需要导入模块: from sympy import Q [as 别名]
# 或者: from sympy.Q import is_true [as 别名]
def test_N1():
    assert ask(Q.is_true(E**pi > pi**E))
开发者ID:akritas,项目名称:sympy,代码行数:4,代码来源:test_wester.py


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