Hi Ranier, Here's a way to do it:
>>> import sympy >>> x, y, z = sympy.symbols('x y z') >>> sympy.solvers.inequalities.reduce_inequalities([x + 2 > 0, x < 5], x) (-2 < x) & (x < 5) reduce_inequalities is the top-level inequality reducer, which will call other lower-level functions (such as reduce_rational_inequalities) as needed. reduce_inequalities takes a simple list, rather than a nested list, of inequalities. I'm actually drafting a guide page on this topic now; glad to know it's of interest! You can access the draft <https://output.circle-artifacts.com/output/job/a1f8297d-6be8-4627-9f47-a969709f9293/artifacts/0/doc/_build/html/guides/solving/solve-system-of-inequalities-algebraically.html>, and I'd appreciate any feedback (either here or on the pull request <https://github.com/sympy/sympy/pull/23768> on GitHub). Best, Jeremy P.S. If you like, you can use less-verbose function calls by importing reduce_inequalities and symbols from SymPy: >>> from sympy import reduce_inequalities, symbols >>> x, y, z = symbols('x y z') >>> reduce_inequalities([x + 2 > 0, x < 5], x) (-2 < x) & (x < 5) On Sat, Aug 6, 2022 at 3:31 AM 'Rainer Dorsch' via sympy < sympy@googlegroups.com> wrote: > Hi, > > I just started with sympy, and try to understand how to tell sympy, what I > want. I tried > print(sympy.solvers.inequalities.reduce_rational_inequalities([[x + 2 > > 0],[x > < 5]], x)) > and expected > (-2 < x) & (x < 5) > but got > (-oo < x) & (x < oo) > Can anybody tell how I can tell sympy that x should satisfy both > inequalities > the same time? > For me it seems sympy rather interprets the set of equations rather as an > "or" > and not an "and" > > Here is the full example > > rd@h370:~/tmp.nobackup$ cat test-sympy.py > import sympy > > x, y, z = sympy.symbols('x y z') > sympy.init_printing(use_unicode=True) > > print(sympy.solvers.inequalities.reduce_rational_inequalities([[x + 2 > > 0]], > x)) > > > print(sympy.solvers.inequalities.reduce_rational_inequalities([[x + 2 > > 0],[x > < 5]], x)) > rd@h370:~/tmp.nobackup$ python3 test-sympy.py > (-2 < x) & (x < oo) > (-oo < x) & (x < oo) > rd@h370:~/tmp.nobackup$ > > > Any hint is welcome. > > Thanks > Rainer > > > -- > Rainer Dorsch > http://bokomoko.de/ > > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/4120287.OZXsGyJSKq%40h370. > -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAO00iLiMjspDr5US9jasbFik2NbMKcKGPFTKVB8B9jcGmkqQ2Q%40mail.gmail.com.