How can I get Mathematica to simplify the true and false clauses for If[] statements?
For example:
bar[a_] := a
FullSimplify[If[a > b, bar[a], bar[b]]]
If[a > b, bar[a], bar[b]]
I was hoping for at least If[a>b, a, b]. I thought that it might be hesitating to simplify bar[] because of possible side effects in the function, but I noticed this:
FullSimplify[If[a + a + a > b + b + b, a + a + a, b + b + b]]
If[a > b, a + a + a, b + b + b]
Note that the conditional clause was simplified, but nothing else was. But if the form is slightly different, it will simplify:
FullSimplify[If[a > b, a - a + a, b - b + b]]
{a a > b
{b True
How can I get simplified expressions within If statements? I feel like I'm missing something very basic.