Is there a way to find the minimum of a piecewise functions with parameters?
Here is a simple example:
Minimize[{If[x > 0, 3 x, x^2 - x - 4]}, x]
works fine, but
Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
doesn't work at all.
Is there some way to make it work? Or can anyone explain why is not working or suggest other methods to get the minimum?
Edit 1
The answer I would like to get is something like:
If[a < 0, 0, -a]
Edit 2
When I try
Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
I get as output:
Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, x]
I'm using V10.1.0 for Linux x86 (64-bit) (March 24, 2015)"
Minimize[{If[x > 0, 3 x, x^2 - x - a], -2 < a < 2}, {x, a}]
instead. But since Mathematica tells me that there is no minimum, I am in doubt that this is what you are looking for... $\endgroup$Simplify[Minimize[{If[x > 0, 3 x, x^2 - x - a], 1 < a < 2}, x], 1 < a < 2]
? $\endgroup$PiecewiseExpand@If[x > 0, 3 x, x^2 - x - a]
for your function. $\endgroup$