(Please see the edit part for the real problem)
I have two expressions which are same but written in different ways.
expr1 = ConditionalExpression[Plus[1, Times[-1, x]],
Inequality[0, LessEqual, x, LessEqual, Rational[1, 2]]]
expr2 = ConditionalExpression[Plus[1, Times[-1, x]],
LessEqual[0, x, Rational[1, 2]]]
Now if I use Equal function:
expr1 == expr2
It returns True together with domains combining of the two functions. However, I want it to return True
only (no domain) if the functions are same and domains are same as well.
How can I do that?
SameQ
doesn't work here as they are same mathematically but the underlying representations are different.
EDIT: Basically I have a list like this.
list = {ConditionalExpression[Plus[1, Times[-1, x]],
Inequality[0, LessEqual, x, LessEqual, Rational[1, 2]]],
ConditionalExpression[Plus[1, Times[-1, x]], LessEqual[1, x, 2]],
ConditionalExpression[Plus[1, Times[-1, x]],
LessEqual[0, x, Rational[1, 2]]]}
I want to return the position of elements in the list that same as reffunc as follows:
reffunc =
ConditionalExpression[Plus[1, Times[-1, x]],
LessEqual[0, x, Rational[1, 2]]];
Position[list, reffunc]
I expected the positions of the first and third are returned but only the third is returned.