Just to be clear, what you probably want is sp.ask(sp.Ne(U1, red), assumptions=sp.Eq(U1, green) & Ne(red, green)). Unfortunately, ask() does not yet know how to do any sorts of deductions based on equalities, so this also returns None. Note that None in the SymPy assumptions means "don't know". It could be because the result can be either true or false, or it could be because SymPy just doesn't have the algorithms to determine whether something is true or false.
Aaron Meurer On Wed, Oct 26, 2022 at 7:54 AM Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > > On Wed, 26 Oct 2022 at 12:09, Juan Francisco Puentes Calvo > <p...@fernandowirtz.com> 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 sympy+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAHVvXxRO2BoZtKw9DwO9izhAWpJEA39ZB4pExcD0FVj2416Bew%40mail.gmail.com. -- 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/CAKgW%3D6LgOY0sPTvhvycWp_Qt90sY528CTAj%3DdwL2sy8e%3DrTcwg%40mail.gmail.com.