0
$\begingroup$

Mathematica doesn't seem to have any problem with these commands:

Simplify[x y, x == 0 && y == 0]
Simplify[x y, x == 0 && y == 10]
Simplify[x y, x == 1 && y == 5]

But when it comes to this command:

Simplify[x y, x == 0 \[Or] y == 0]

it just returns xy back. I know that for general cases like Simplify[x y, x == 5 \[Or] y == -8] there isn't any good simplification. Even so, an output like 5y||-8x can be returned. (Please tell if there's any command to do so). But for the command Simplify[x y, x == 0 \[Or] y == 0], the result is pretty obvious which is zero.

I want to know if there's any method to get the output as zero directly. Also, I don't want an output like {0,0} doing the substitutions alternately.

Thank You.

$\endgroup$
4
  • $\begingroup$ Previously: mathematica.stackexchange.com/questions/256211/… $\endgroup$
    – Syed
    Sep 29 at 13:45
  • $\begingroup$ @Syed I was about to add the link here in the comments. Thanks. I'm afraid this will be marked as duplicate and will get closed, but I haven't got any helpful answer for the previous question either. $\endgroup$ Sep 29 at 13:46
  • $\begingroup$ maybe something like: ClearAll[or]; or /: Refine[a_, or[b__]] := Or @@ (Refine[a, #] & /@ {b}); Refine[x y, or[x == 5, y == -8]]? $\endgroup$
    – kglr
    Sep 29 at 14:22
  • $\begingroup$ @kglr Thanks. It does work but isn't there some inbuilt method which works just like your new modified Refine command? Also, ClearAll[or]; or /: Refine[a_, or[b__]] := Or @@ (Refine[a, #] & /@ {b}); Refine[x y, or[x == 0, y == -0]] returns 0||0 whereas I wanted it simplified to 0 only. $\endgroup$ Sep 29 at 16:33
0
$\begingroup$

One idea is to use FunctionRange:

FunctionRange[{x y, x == 0 || y == 0}, {x, y}, z]

z == 0

$\endgroup$
2
  • $\begingroup$ I don't know why this doesn't work on my pc. Is it not supported in Mathematica 9.0? Also, I couldn't find this in documentation centre. $\endgroup$ Oct 1 at 8:51
  • $\begingroup$ @AmanKushwaha FunctionRange is new in M10. $\endgroup$
    – Carl Woll
    Oct 1 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.