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


Python Interval.open方法代码示例

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


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

示例1: test_issue_10285

# 需要导入模块: from sympy import Interval [as 别名]
# 或者: from sympy.Interval import open [as 别名]
def test_issue_10285():
    assert FiniteSet(-x - 1).intersect(Interval.Ropen(1, 2)) == FiniteSet(x).intersect(Interval.Lopen(-3, -2))
    eq = -x - 2 * (-x - y)
    s = signsimp(eq)
    ivl = Interval.open(0, 1)
    assert FiniteSet(eq).intersect(ivl) == FiniteSet(s).intersect(ivl)
    assert FiniteSet(-eq).intersect(ivl) == FiniteSet(s).intersect(Interval.open(-1, 0))
    eq -= 1
    ivl = Interval.Lopen(1, oo)
    assert FiniteSet(eq).intersect(ivl) == FiniteSet(s).intersect(Interval.Lopen(2, oo))
开发者ID:Carreau,项目名称:sympy,代码行数:12,代码来源:test_sets.py

示例2: test_reduce_rational_inequalities_real_relational

# 需要导入模块: from sympy import Interval [as 别名]
# 或者: from sympy.Interval import open [as 别名]
def test_reduce_rational_inequalities_real_relational():
    assert reduce_rational_inequalities([], x) == False
    assert reduce_rational_inequalities(
        [[(x**2 + 3*x + 2)/(x**2 - 16) >= 0]], x, relational=False) == \
        Union(Interval.open(-oo, -4), Interval(-2, -1), Interval.open(4, oo))

    assert reduce_rational_inequalities(
        [[((-2*x - 10)*(3 - x))/((x**2 + 5)*(x - 2)**2) < 0]], x,
        relational=False) == \
        Union(Interval.open(-5, 2), Interval.open(2, 3))

    assert reduce_rational_inequalities([[(x + 1)/(x - 5) <= 0]], x,
        relational=False) == \
        Interval.Ropen(-1, 5)

    assert reduce_rational_inequalities([[(x**2 + 4*x + 3)/(x - 1) > 0]], x,
        relational=False) == \
        Union(Interval.open(-3, -1), Interval.open(1, oo))

    assert reduce_rational_inequalities([[(x**2 - 16)/(x - 1)**2 < 0]], x,
        relational=False) == \
        Union(Interval.open(-4, 1), Interval.open(1, 4))

    assert reduce_rational_inequalities([[(3*x + 1)/(x + 4) >= 1]], x,
        relational=False) == \
        Union(Interval.open(-oo, -4), Interval.Ropen(S(3)/2, oo))

    assert reduce_rational_inequalities([[(x - 8)/x <= 3 - x]], x,
        relational=False) == \
        Union(Interval.Lopen(-oo, -2), Interval.Lopen(0, 4))

    # issue sympy/sympy#10237
    assert reduce_rational_inequalities(
        [[x < oo, x >= 0, -oo < x]], x, relational=False) == Interval(0, oo)
开发者ID:richardotis,项目名称:sympy,代码行数:36,代码来源:test_inequalities.py

示例3: test_solve_abs

# 需要导入模块: from sympy import Interval [as 别名]
# 或者: from sympy.Interval import open [as 别名]
def test_solve_abs():
    assert solveset_real(Abs(x) - 2, x) == FiniteSet(-2, 2)
    assert solveset_real(Abs(x + 3) - 2 * Abs(x - 3), x) == FiniteSet(1, 9)
    assert solveset_real(2 * Abs(x) - Abs(x - 1), x) == FiniteSet(-1, Rational(1, 3))

    assert solveset_real(Abs(x - 7) - 8, x) == FiniteSet(-S(1), S(15))

    # issue 9565. Note: solveset_real does not solve this as it is
    # solveset's job to handle Relationals
    assert solveset(Abs((x - 1) / (x - 5)) <= S(1) / 3, domain=S.Reals) == Interval(-1, 2)

    # issue #10069
    eq = abs(1 / (x - 1)) - 1 > 0
    u = Union(Interval.open(0, 1), Interval.open(1, 2))
    assert solveset_real(eq, x) == u
    assert solveset(eq, x, domain=S.Reals) == u

    raises(ValueError, lambda: solveset(abs(x) - 1, x))
开发者ID:pabloferz,项目名称:sympy,代码行数:20,代码来源:test_solveset.py

示例4: test_solve_abs

# 需要导入模块: from sympy import Interval [as 别名]
# 或者: from sympy.Interval import open [as 别名]
def test_solve_abs():
    assert solveset_real(Abs(x) - 2, x) == FiniteSet(-2, 2)
    assert solveset_real(Abs(x + 3) - 2*Abs(x - 3), x) == \
        FiniteSet(1, 9)
    assert solveset_real(2*Abs(x) - Abs(x - 1), x) == \
        FiniteSet(-1, Rational(1, 3))

    assert solveset_real(Abs(x - 7) - 8, x) == FiniteSet(-S(1), S(15))

    # issue 9565. Note: solveset_real does not solve this as it is
    # solveset's job to handle Relationals
    assert solveset(Abs((x - 1)/(x - 5)) <= S(1)/3, domain=S.Reals
        ) == Interval(-1, 2)

    # issue #10069
    assert solveset_real(abs(1/(x - 1)) - 1 > 0, x) == \
        ConditionSet(x, Eq((1 - Abs(x - 1))/Abs(x - 1) > 0, 0),
            S.Reals)
    assert solveset(abs(1/(x - 1)) - 1 > 0, x, domain=S.Reals
        ) == Union(Interval.open(0, 1), Interval.open(1, 2))
开发者ID:nickle8424,项目名称:sympy,代码行数:22,代码来源:test_solveset.py

示例5: test_issue_8715

# 需要导入模块: from sympy import Interval [as 别名]
# 或者: from sympy.Interval import open [as 别名]
def test_issue_8715():
    eq = x + 1 / x > -2 + 1 / x
    assert solveset(eq, x, S.Reals) == (Interval.open(-2, oo) - FiniteSet(0))
    assert solveset(eq.subs(x, log(x)), x, S.Reals) == Interval.open(exp(-2), oo) - FiniteSet(1)
开发者ID:pabloferz,项目名称:sympy,代码行数:6,代码来源:test_solveset.py


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