SymPy can represent each, but as far as I know, no functions exist to simplify one to the other.
The representation of each would be like Or(Eq(x, 1), Eq(x, 2), Eq(x, 3)) Contains(x, FiniteSet(1, 2, 3)) And(Neq(x, 1), Neq(x, 2), Neq(x, 3)) Not(Contains(x, FiniteSet(1, 2, 3))) Contains is relatively new in SymPy, so not much exists yet to manipulate it, but it shouldn't be hard to add functions to go from Contains to a boolean or visa-versa. Aaron Meurer On Sun, Dec 6, 2015 at 11:39 AM, Simon <[email protected]> wrote: > Hello, > > I'm newcomer to sympy and just read some document from sympy website, sympy > does a very good job on simplify Boolean expression. I would greatly > appreciate it if someone could let me know whether I can customer sympy to > support below cases > > simplify( x == 1 or x == 2 or x ==3 ) > get result x > in [ 1, 2, 3 ] > > simplify( x != 1 and x != 2 and x !=3 ) > get result x not > in [1, 2, 3] > > Simon. > > -- > 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 post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/8d68708e-a94d-4b89-b5ed-db5cd00b2217%40googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- 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 post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6%2BFC4GjHZHD_cBeos0Jx6HY9%2BTGCkERkWhoEaRkgkLgmw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
