本文整理汇总了Python中sympy.solvers.inequalities.reduce_rational_inequalities函数的典型用法代码示例。如果您正苦于以下问题:Python reduce_rational_inequalities函数的具体用法?Python reduce_rational_inequalities怎么用?Python reduce_rational_inequalities使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reduce_rational_inequalities函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_reduce_rational_inequalities_real_relational
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,代码行数:34,代码来源:test_inequalities.py
示例2: test_reduce_rational_inequalities_real_relational
def test_reduce_rational_inequalities_real_relational():
def OpenInterval(a, b):
return Interval(a, b, True, True)
def LeftOpenInterval(a, b):
return Interval(a, b, True, False)
def RightOpenInterval(a, b):
return Interval(a, b, False, True)
with assuming(Q.real(x)):
assert reduce_rational_inequalities([[(x**2 + 3*x + 2)/(x**2 - 16) >= 0]], x, relational=False) == \
Union(OpenInterval(-oo, -4), Interval(-2, -1), OpenInterval(4, oo))
assert reduce_rational_inequalities([[((-2*x - 10)*(3 - x))/((x**2 + 5)*(x - 2)**2) < 0]], x, relational=False) == \
Union(OpenInterval(-5, 2), OpenInterval(2, 3))
assert reduce_rational_inequalities([[(x + 1)/(x - 5) <= 0]], x, assume=Q.real(x), relational=False) == \
RightOpenInterval(-1, 5)
assert reduce_rational_inequalities([[(x**2 + 4*x + 3)/(x - 1) > 0]], x, assume=Q.real(x), relational=False) == \
Union(OpenInterval(-3, -1), OpenInterval(1, oo))
assert reduce_rational_inequalities([[(x**2 - 16)/(x - 1)**2 < 0]], x, assume=Q.real(x), relational=False) == \
Union(OpenInterval(-4, 1), OpenInterval(1, 4))
assert reduce_rational_inequalities([[(3*x + 1)/(x + 4) >= 1]], x, assume=Q.real(x), relational=False) == \
Union(OpenInterval(-oo, -4), RightOpenInterval(S(3)/2, oo))
assert reduce_rational_inequalities([[(x - 8)/x <= 3 - x]], x, assume=Q.real(x), relational=False) == \
Union(LeftOpenInterval(-oo, -2), LeftOpenInterval(0, 4))
开发者ID:AALEKH,项目名称:sympy,代码行数:29,代码来源:test_inequalities.py
示例3: _has_conflict
def _has_conflict(rd1, rd2, offset):
"""
:param rd1: rectangular domain from Stencil1 (1D) <- (low, high, stride) (written domain)
:param rd2: rectangular domain from Stencil2 (1D) <- (low, high, stride) (read domain)
:param offset_vector: Offset from the center (relative to rd2), 1D projections
:return: Whether OV from rectangular domain 2 reads from rectangular domain 1
"""
n1 = sympy.Symbol("n1")
n2 = sympy.Symbol("n2")
# Diophantine equations:
# offset(iterationspace1) + n1 * stride(iteration_space1) <- write vectors
diophantine_eq1 = rd1[0] + n1 * rd1[2]
# offset(iterationspace2) + n2 * stride(iteration_space2) + offset_vector <- Read vectors
diophantine_eq2 = rd2[0] + n2 * rd2[2] + offset
# Since sympy solves eq = 0, we want dio_eq1 - dio_eq2 = 0.
eqn = diophantine_eq1 - diophantine_eq2
parameter = sympy.Symbol("t", integer=True)
sat_param = sympy.Symbol("t_0", integer=True)
if not eqn.free_symbols:
return eqn == 0
solutions = dio.diophantine(eqn, parameter) # default parameter is "t"
# print("Sols:", solutions)
for sol in solutions:
if len(eqn.free_symbols) != 2:
if n1 in eqn.free_symbols:
parametric_n1 = sol[0]
parametric_n2 = 0
else:
parametric_n1 = 0
parametric_n2 = sol[0]
else:
(parametric_n1, parametric_n2) = sol
# Solutions is a set of tuples, each containing either a number or parametric expression
# which give conditions on satisfiability.
# are these satisfiable on the original bounds?
# substitute the parametric forms in
substituted_1 = diophantine_eq1.subs({n1: parametric_n1})
substituted_2 = (
rd2[0] + parametric_n2 * rd2[2]
) # we ditch the offset because it's irrelevant since the bounds are based on the center of the stencil
# print(substituted_1, "\t", substituted_2)
# print(rd1[0], rd1[1], rd2[0], rd2[1])
# now do they satisfy the bounds?
satisfactory_interval = ineq.reduce_rational_inequalities(
[[rd1[0] <= substituted_1, rd1[1] > substituted_1, rd2[0] <= substituted_2, rd2[1] > substituted_2]],
sat_param,
relational=False,
)
# print(satisfactory_interval)
if _contains_integer(satisfactory_interval):
return True
return False
开发者ID:ucb-sejits,项目名称:snowflake,代码行数:57,代码来源:analytics.py
示例4: test_reduce_poly_inequalities_real_interval
def test_reduce_poly_inequalities_real_interval():
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=False) == FiniteSet(0)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=False) == FiniteSet(0)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=False) == S.EmptySet
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=False) == \
S.Reals if x.is_real else Interval(-oo, oo)
assert reduce_rational_inequalities(
[[Gt(x**2, 0)]], x, relational=False) == \
FiniteSet(0).complement(S.Reals)
assert reduce_rational_inequalities(
[[Ne(x**2, 0)]], x, relational=False) == \
FiniteSet(0).complement(S.Reals)
assert reduce_rational_inequalities(
[[Eq(x**2, 1)]], x, relational=False) == FiniteSet(-1, 1)
assert reduce_rational_inequalities(
[[Le(x**2, 1)]], x, relational=False) == Interval(-1, 1)
assert reduce_rational_inequalities(
[[Lt(x**2, 1)]], x, relational=False) == Interval(-1, 1, True, True)
assert reduce_rational_inequalities(
[[Ge(x**2, 1)]], x, relational=False) == \
Union(Interval(-oo, -1), Interval(1, oo))
assert reduce_rational_inequalities(
[[Gt(x**2, 1)]], x, relational=False) == \
Interval(-1, 1).complement(S.Reals)
assert reduce_rational_inequalities(
[[Ne(x**2, 1)]], x, relational=False) == \
FiniteSet(-1, 1).complement(S.Reals)
assert reduce_rational_inequalities([[Eq(
x**2, 1.0)]], x, relational=False) == FiniteSet(-1.0, 1.0).evalf()
assert reduce_rational_inequalities(
[[Le(x**2, 1.0)]], x, relational=False) == Interval(-1.0, 1.0)
assert reduce_rational_inequalities([[Lt(
x**2, 1.0)]], x, relational=False) == Interval(-1.0, 1.0, True, True)
assert reduce_rational_inequalities(
[[Ge(x**2, 1.0)]], x, relational=False) == \
Union(Interval(-inf, -1.0), Interval(1.0, inf))
assert reduce_rational_inequalities(
[[Gt(x**2, 1.0)]], x, relational=False) == \
Union(Interval(-inf, -1.0, right_open=True),
Interval(1.0, inf, left_open=True))
assert reduce_rational_inequalities([[Ne(
x**2, 1.0)]], x, relational=False) == \
FiniteSet(-1.0, 1.0).complement(S.Reals)
s = sqrt(2)
assert reduce_rational_inequalities([[Lt(
x**2 - 1, 0), Gt(x**2 - 1, 0)]], x, relational=False) == S.EmptySet
assert reduce_rational_inequalities([[Le(x**2 - 1, 0), Ge(
x**2 - 1, 0)]], x, relational=False) == FiniteSet(-1, 1)
assert reduce_rational_inequalities(
[[Le(x**2 - 2, 0), Ge(x**2 - 1, 0)]], x, relational=False
) == Union(Interval(-s, -1, False, False), Interval(1, s, False, False))
assert reduce_rational_inequalities(
[[Le(x**2 - 2, 0), Gt(x**2 - 1, 0)]], x, relational=False
) == Union(Interval(-s, -1, False, True), Interval(1, s, True, False))
assert reduce_rational_inequalities(
[[Lt(x**2 - 2, 0), Ge(x**2 - 1, 0)]], x, relational=False
) == Union(Interval(-s, -1, True, False), Interval(1, s, False, True))
assert reduce_rational_inequalities(
[[Lt(x**2 - 2, 0), Gt(x**2 - 1, 0)]], x, relational=False
) == Union(Interval(-s, -1, True, True), Interval(1, s, True, True))
assert reduce_rational_inequalities(
[[Lt(x**2 - 2, 0), Ne(x**2 - 1, 0)]], x, relational=False
) == Union(Interval(-s, -1, True, True), Interval(-1, 1, True, True),
Interval(1, s, True, True))
开发者ID:richardotis,项目名称:sympy,代码行数:71,代码来源:test_inequalities.py
示例5: test_reduce_poly_inequalities_complex_relational
def test_reduce_poly_inequalities_complex_relational():
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=True) == False
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=True) == And(Lt(-oo, x), Lt(x, oo))
assert reduce_rational_inequalities(
[[Gt(x**2, 0)]], x, relational=True) == \
And(Gt(x, -oo), Lt(x, oo), Ne(x, 0))
assert reduce_rational_inequalities(
[[Ne(x**2, 0)]], x, relational=True) == \
And(Gt(x, -oo), Lt(x, oo), Ne(x, 0))
for one in (S(1), S(1.0)):
inf = one*oo
assert reduce_rational_inequalities(
[[Eq(x**2, one)]], x, relational=True) == \
Or(Eq(x, -one), Eq(x, one))
assert reduce_rational_inequalities(
[[Le(x**2, one)]], x, relational=True) == \
And(And(Le(-one, x), Le(x, one)))
assert reduce_rational_inequalities(
[[Lt(x**2, one)]], x, relational=True) == \
And(And(Lt(-one, x), Lt(x, one)))
assert reduce_rational_inequalities(
[[Ge(x**2, one)]], x, relational=True) == \
And(Or(And(Le(one, x), Lt(x, inf)), And(Le(x, -one), Lt(-inf, x))))
assert reduce_rational_inequalities(
[[Gt(x**2, one)]], x, relational=True) == \
And(Or(And(Lt(-inf, x), Lt(x, -one)), And(Lt(one, x), Lt(x, inf))))
assert reduce_rational_inequalities(
[[Ne(x**2, one)]], x, relational=True) == \
Or(And(Lt(-inf, x), Lt(x, -one)),
And(Lt(-one, x), Lt(x, one)),
And(Lt(one, x), Lt(x, inf)))
开发者ID:richardotis,项目名称:sympy,代码行数:38,代码来源:test_inequalities.py
示例6: _reduce_inequalities
def _reduce_inequalities(conditions, var, **kwargs):
try:
return reduce_rational_inequalities(conditions, var, **kwargs)
except PolynomialError:
raise ValueError("Reduction of condition failed %s\n" % conditions[0])
开发者ID:A-turing-machine,项目名称:sympy,代码行数:5,代码来源:crv.py
示例7: test_reduce_poly_inequalities_real_relational
def test_reduce_poly_inequalities_real_relational():
with assuming(Q.real(x), Q.real(y)):
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=True) is False
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=True) is True
assert reduce_rational_inequalities(
[[Gt(x**2, 0)]], x, relational=True) == Or(Lt(x, 0), Gt(x, 0))
assert reduce_rational_inequalities(
[[Ne(x**2, 0)]], x, relational=True) == Or(Lt(x, 0), Gt(x, 0))
assert reduce_rational_inequalities(
[[Eq(x**2, 1)]], x, relational=True) == Or(Eq(x, -1), Eq(x, 1))
assert reduce_rational_inequalities(
[[Le(x**2, 1)]], x, relational=True) == And(Le(-1, x), Le(x, 1))
assert reduce_rational_inequalities(
[[Lt(x**2, 1)]], x, relational=True) == And(Lt(-1, x), Lt(x, 1))
assert reduce_rational_inequalities(
[[Ge(x**2, 1)]], x, relational=True) == Or(Le(x, -1), Ge(x, 1))
assert reduce_rational_inequalities(
[[Gt(x**2, 1)]], x, relational=True) == Or(Lt(x, -1), Gt(x, 1))
assert reduce_rational_inequalities([[Ne(x**2, 1)]], x, relational=True) == Or(
Lt(x, -1), And(Lt(-1, x), Lt(x, 1)), Gt(x, 1))
assert reduce_rational_inequalities(
[[Le(x**2, 1.0)]], x, relational=True) == And(Le(-1.0, x), Le(x, 1.0))
assert reduce_rational_inequalities(
[[Lt(x**2, 1.0)]], x, relational=True) == And(Lt(-1.0, x), Lt(x, 1.0))
assert reduce_rational_inequalities(
[[Ge(x**2, 1.0)]], x, relational=True) == Or(Le(x, -1.0), Ge(x, 1.0))
assert reduce_rational_inequalities(
[[Gt(x**2, 1.0)]], x, relational=True) == Or(Lt(x, -1.0), Gt(x, 1.0))
assert reduce_rational_inequalities([[Ne(x**2, 1.0)]], x, relational=True) == \
Or(Lt(x, -1.0), And(Lt(-1.0, x), Lt(x, 1.0)), Gt(x, 1.0))
开发者ID:AALEKH,项目名称:sympy,代码行数:38,代码来源:test_inequalities.py
示例8: test_reduce_poly_inequalities_complex_relational
def test_reduce_poly_inequalities_complex_relational():
cond = Eq(im(x), 0)
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=True) == And(Eq(re(x), 0), cond)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=True) == And(Eq(re(x), 0), cond)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=True) == False
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=True) == cond
assert reduce_rational_inequalities([[Gt(x**2, 0)]], x, relational=True) == \
And(Or(Lt(re(x), 0), Gt(re(x), 0)), cond)
assert reduce_rational_inequalities([[Ne(x**2, 0)]], x, relational=True) == \
And(Or(Lt(re(x), 0), Gt(re(x), 0)), cond)
assert reduce_rational_inequalities([[Eq(x**2, 1)]], x, relational=True) == \
And(Or(Eq(re(x), -1), Eq(re(x), 1)), cond)
assert reduce_rational_inequalities([[Le(x**2, 1)]], x, relational=True) == \
And(And(Le(-1, re(x)), Le(re(x), 1)), cond)
assert reduce_rational_inequalities([[Lt(x**2, 1)]], x, relational=True) == \
And(And(Lt(-1, re(x)), Lt(re(x), 1)), cond)
assert reduce_rational_inequalities([[Ge(x**2, 1)]], x, relational=True) == \
And(Or(Le(re(x), -1), Ge(re(x), 1)), cond)
assert reduce_rational_inequalities([[Gt(x**2, 1)]], x, relational=True) == \
And(Or(Lt(re(x), -1), Gt(re(x), 1)), cond)
assert reduce_rational_inequalities([[Ne(x**2, 1)]], x, relational=True) == \
And(Or(Lt(re(x), -1), And(Lt(-1, re(x)), Lt(re(x), 1)), Gt(re(x), 1)), cond)
assert reduce_rational_inequalities([[Le(x**2, 1.0)]], x, relational=True) == \
And(And(Le(-1.0, re(x)), Le(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Lt(x**2, 1.0)]], x, relational=True) == \
And(And(Lt(-1.0, re(x)), Lt(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Ge(x**2, 1.0)]], x, relational=True) == \
And(Or(Le(re(x), -1.0), Ge(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Gt(x**2, 1.0)]], x, relational=True) == \
And(Or(Lt(re(x), -1.0), Gt(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Ne(x**2, 1.0)]], x, relational=True) == \
And(Or(Lt(re(x), -1.0), And(Lt(-1.0, re(x)), Lt(re(x), 1.0)), Gt(re(x), 1.0)), cond)
开发者ID:AALEKH,项目名称:sympy,代码行数:39,代码来源:test_inequalities.py
示例9: test_reduce_poly_inequalities_real_relational
def test_reduce_poly_inequalities_real_relational():
with assuming(Q.real(x), Q.real(y)):
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=True) == Eq(x, 0)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=True) == False
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=True) == And(Lt(-oo, x), Lt(x, oo))
assert reduce_rational_inequalities(
[[Gt(x**2, 0)]], x, relational=True) == Or(And(Lt(-oo, x), Lt(x, 0)), And(Lt(0, x), Lt(x, oo)))
assert reduce_rational_inequalities(
[[Ne(x**2, 0)]], x, relational=True) == Or(And(Lt(-oo, x), Lt(x, 0)), And(Lt(0, x), Lt(x, oo)))
assert reduce_rational_inequalities(
[[Eq(x**2, 1)]], x, relational=True) == Or(Eq(x, -1), Eq(x, 1))
assert reduce_rational_inequalities(
[[Le(x**2, 1)]], x, relational=True) == And(Le(-1, x), Le(x, 1))
assert reduce_rational_inequalities(
[[Lt(x**2, 1)]], x, relational=True) == And(Lt(-1, x), Lt(x, 1))
assert reduce_rational_inequalities(
[[Ge(x**2, 1)]], x, relational=True) == Or(And(Le(1, x), Lt(x, oo)), And(Le(x, -1), Lt(-oo, x)))
assert reduce_rational_inequalities(
[[Gt(x**2, 1)]], x, relational=True) == Or(And(Lt(1, x), Lt(x, oo)), And(Lt(x, -1), Lt(-oo, x)))
assert reduce_rational_inequalities([[Ne(x**2, 1)]], x, relational=True) == Or(
And(Lt(-oo, x), Lt(x, -1)), And(Lt(-1, x), Lt(x, 1)), And(Lt(1, x), Lt(x, oo)))
assert reduce_rational_inequalities(
[[Le(x**2, 1.0)]], x, relational=True) == And(Le(-1.0, x), Le(x, 1.0))
assert reduce_rational_inequalities(
[[Lt(x**2, 1.0)]], x, relational=True) == And(Lt(-1.0, x), Lt(x, 1.0))
assert reduce_rational_inequalities(
[[Ge(x**2, 1.0)]], x, relational=True) == Or(And(Lt(Float('-inf'), x), Le(x, -1.0)),
And(Le(1.0, x), Lt(x, Float('+inf'))))
assert reduce_rational_inequalities(
[[Gt(x**2, 1.0)]], x, relational=True) == Or(And(Lt(Float('-inf'), x), Lt(x, -1.0)),
And(Lt(1.0, x), Lt(x, Float('+inf'))))
assert reduce_rational_inequalities([[Ne(x**2, 1.0)]], x, relational=True) == \
Or(And(Lt(-1.0, x), Lt(x, 1.0)), And(Lt(Float('-inf'), x), Lt(x, -1.0)),
And(Lt(1.0, x), Lt(x, Float('+inf'))))
开发者ID:aiwku1277,项目名称:sympy,代码行数:41,代码来源:test_inequalities.py
示例10: test_reduce_poly_inequalities_complex_relational
def test_reduce_poly_inequalities_complex_relational():
cond = Eq(im(x), 0)
assert reduce_rational_inequalities(
[[Eq(x**2, 0)]], x, relational=True) == And(Eq(re(x), 0), cond)
assert reduce_rational_inequalities(
[[Le(x**2, 0)]], x, relational=True) == And(Eq(re(x), 0), cond)
assert reduce_rational_inequalities(
[[Lt(x**2, 0)]], x, relational=True) == False
assert reduce_rational_inequalities(
[[Ge(x**2, 0)]], x, relational=True) == And(cond, Lt(-oo, re(x)), Lt(re(x), oo))
assert reduce_rational_inequalities([[Gt(x**2, 0)]], x, relational=True) == \
And(cond, Or(And(Lt(-oo, re(x)), Lt(re(x), 0)), And(Lt(0, re(x)), Lt(re(x), oo))))
assert reduce_rational_inequalities([[Ne(x**2, 0)]], x, relational=True) == \
And(cond, Or(And(Lt(-oo, re(x)), Lt(re(x), 0)), And(Lt(0, re(x)), Lt(re(x), oo))))
assert reduce_rational_inequalities([[Eq(x**2, 1)]], x, relational=True) == \
And(Or(Eq(re(x), -1), Eq(re(x), 1)), cond)
assert reduce_rational_inequalities([[Le(x**2, 1)]], x, relational=True) == \
And(And(Le(-1, re(x)), Le(re(x), 1)), cond)
assert reduce_rational_inequalities([[Lt(x**2, 1)]], x, relational=True) == \
And(And(Lt(-1, re(x)), Lt(re(x), 1)), cond)
assert reduce_rational_inequalities([[Ge(x**2, 1)]], x, relational=True) == \
And(cond, Or(And(Le(1, re(x)), Lt(re(x), oo)), And(Le(re(x), -1), Lt(-oo, re(x)))))
assert reduce_rational_inequalities([[Gt(x**2, 1)]], x, relational=True) == \
And(cond, Or(And(Lt(-oo, re(x)), Lt(re(x), -1)), And(Lt(1, re(x)), Lt(re(x), oo))))
assert reduce_rational_inequalities([[Ne(x**2, 1)]], x, relational=True) == \
And(cond, Or(And(Lt(-oo, re(x)), Lt(re(x), -1)),
And(Lt(-1, re(x)), Lt(re(x), 1)), And(Lt(1, re(x)), Lt(re(x), oo))))
assert reduce_rational_inequalities([[Le(x**2, 1.0)]], x, relational=True) == \
And(And(Le(-1.0, re(x)), Le(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Lt(x**2, 1.0)]], x, relational=True) == \
And(And(Lt(-1.0, re(x)), Lt(re(x), 1.0)), cond)
assert reduce_rational_inequalities([[Ge(x**2, 1.0)]], x, relational=True) == \
And(cond, Or(And(Le(1.0, re(x)), re(x) < Float('+inf')),
And(Le(re(x), -1.0), Float('-inf') < re(x))))
assert reduce_rational_inequalities([[Gt(x**2, 1.0)]], x, relational=True) == \
And(cond, Or(And(Float('-inf') < re(x), re(x) < -1.0),
And(Lt(1.0, re(x)), re(x) < Float('+inf'))))
assert reduce_rational_inequalities([[Ne(x**2, 1.0)]], x, relational=True) == \
And(cond, Or(And(Float('-inf') < re(x), Lt(re(x), -1.0)),
And(Lt(-1.0, re(x)), re(x) < 1.0), And(Lt(1.0, re(x)), re(x) < Float('+inf'))))
开发者ID:aiwku1277,项目名称:sympy,代码行数:43,代码来源:test_inequalities.py
注:本文中的sympy.solvers.inequalities.reduce_rational_inequalities函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论