[sympy] Is it possible to simplify x == 1 or x == 2 or x ==3 to x in [ 1, 2, 3 ] ?

2015-12-06 Thread Simon
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 )

Re: [sympy] Is it possible to simplify x == 1 or x == 2 or x ==3 to x in [ 1, 2, 3 ] ?

2015-12-08 Thread Aaron Meurer
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 relati

Re: [sympy] Is it possible to simplify x == 1 or x == 2 or x ==3 to x in [ 1, 2, 3 ] ?

2015-12-08 Thread Simon
Aaron Meurer , thanks for help. 在 2015年12月9日星期三 UTC+8上午1:57:42,Aaron Meurer写道: > > 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,