0

I have the following problem. Defining two simple functions in Mathematica, say, foo[x_]:= x, and bar[y_]:=y, I would expect that the expression foo[x]^(-bar[y])-(1/foo[x])^(bar[y]) will be evaluated to zero. However, I find (oddly) that Mathematica insists rather on keeping this thing "in a symbolic fashion", not willing to simplify at all. Tried many things to overcome this behaviour but they all failed. Any help much appreciated :)

Simon Righley
  • 4,538
  • 6
  • 26
  • 33

1 Answers1

0

You have to tell Mathematica that x>0:

Simplify[foo[x]^(-bar[y]) - (1/foo[x])^(bar[y]), x > 0]

0
FJRA
  • 286
  • 1
  • 6
  • `foo[x]^(-bar[y]) - (1/foo[x])^(bar[y]) /. {y -> 1/2, x -> -1/2}` – ssch Nov 21 '13 at 18:00
  • Yep, OK, but it's not really a very generic solution. For instance, why does it work for `x>0` but it doesn't if I assume `x<0`? More generally, if I have a very complicated function, I would not like waste time trying all possible combinations of assumptions. Trying with other silly examples (e.g., a^(-b)*c^(b)), you will soon realize (again) that in order to get the expected behaviour, you need to assume something very specific. Why is that? Is there a (more general) way of "enforcing" what simply stands to reason? – Simon Righley Nov 21 '13 at 18:09
  • That's because simplifying it for x<0 is not valid in general terms. Mathematica knows it, and without a value or assumption only simplifies all it is allowed by the most general rules. – FJRA Nov 22 '13 at 19:43