Is there a simple way to merge equivalent conditions in Piecewise? For example, in the following we have (trivially) pw==x.
pw = Piecewise[{{x, x != 0}}, 0];
Is there some way to force this without cheating? I would call the following cheating:
Assuming[x != 0, Refine[pw]]
(* x *)
As a further example, can I get the simplification (for x real) pw2==Abs[x]?
pw2 = Piecewise[{{x, x > 0}}, -x];
xwas supposed to be complex? – Michael E2 Sep 28 '16 at 22:30xreal) helps with the first case? In the second example, I was interested in the case withxreal (I think this is implicit in any expression involving an inequality). In this case, I think the expressionAbs[x]is a reasonable simplification result - just asAbs[x]simplifies toxwhen I assumesx>0. – mikado Sep 29 '16 at 18:14Abs[]example). Note thatUnsameQinstead ofUnequalworks without the assumption:Simplify[Piecewise[{{x, x =!= 0}}, 0]]. -- What I've noticed aboutAbs[]is that M will simplify it to something else whenxis real or positive, etc., but it will not go from an expression toAbs[]. I suppose there's not a strong argument why this behavior is preferably, but I almost never wantAbs[x]whenxis real (differentiating it is a pain). – Michael E2 Sep 29 '16 at 18:33