On Wed, 26 Oct 2022 at 12:09, Juan Francisco Puentes Calvo <[email protected]> wrote: > > Something as simple as below: > > import sympy as sp; > U1, red, green = sp.symbols("U1, red, green"); > sp.ask(sp.Ne(U1,red), assumptions=sp.Eq(U1,green)); > > Returns None, but. > > sp.ask(sp.Eq(U1,green), assumptions=sp.Eq(U1,green)); > > Returns True. > > What I are doing wrong?
I don't know what you are doing wrong. Presumably you intended for these operations to mean something different from what they actually are because if you understood what ask is supposed to do then these outputs are both obviously correct. Your use of odd symbols names makes this somewhat confusing for me so I'm just going to use x, y and z for the symbols. This is your first query: In [1]: print(ask(Ne(x, y), assumptions=Eq(x, z))) None Here you have asked if x != y based on the assumption that x == z. Clearly the assumption gives no information to answer the query so you get None which is the correct response because it just means maybe/don't know in this context. In [2]: print(ask(Eq(x, y), assumptions=Eq(x, y))) True Now you have asked if x == y given that x == y. Clearly the assumption implies that the query is True and so you get True. -- Oscar -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAHVvXxRO2BoZtKw9DwO9izhAWpJEA39ZB4pExcD0FVj2416Bew%40mail.gmail.com.
