How to solve inequalities of this kind?

Hello, good afternoon

How to solve inequalities of this kind?

4 <= 3x - 2 < 13

See this thread https://discourse.julialang.org/t/solving-inequations/58410.

1 Like

I saw it when searching for a solution, but it has not has two inequalities. Then I found something in Python group.

x = sp.symbols('x')

s1 = sp.solve_univariate_inequality(4 <= 3*x - 2, x)
s2 = sp.solve_univariate_inequality(3*x - 2 < 13, x)
s1 & s2

For completeness, within Julia, the same can be done with SymPy as:

@syms x::real
u = solve(Lt(4, 3x-2), x) & solve(3x-2 ≦ 12,x) # \leqq[tab] is infix unicode for Lt
u.as_set()

The latter conversion allows you to query, as in 3 ∈ u.as_set()

2 Likes