# Unable to evaluate reasonable max expression

Consider the following statement:

Max[0, Sqrt[1 - Cos[4 \[Theta]]]]


You'll find that Mathematica won't evaluate this, because it doesn't know the range of $\theta$. Okay, that makes sense, so change it to:

Simplify[Max[0, Sqrt[1 - Cos[4 \[Theta]]]], {0 <= \[Theta] <= 2 \[Pi]}]


This evaluates happily. As it should. But then consider this not-impactful adjustment:

Simplify[Max[0, Sqrt[1 - Cos[4 \[Theta]]]/
Sqrt], {0 <= \[Theta] <= 2 \[Pi]}]


This doesn't evaluate. I don't know why; because it seems quite obvious that it should be exactly the same as the previous case, right? (The constant factor of 1/Sqrt can't change the fact that it is still $\geq 0$). Any thoughts on how to fix this? Of course, in my case I want to actually keep the Max ..., but I don't know the exact form of the other side, so I can't just arbitrarily remove constants ...

• Simplify[Max[0, Simplify[Sqrt[1 - Cos[4 \[Theta]]]/Sqrt]], {0 <= \[Theta] <= 2 \[Pi]}]  seems to work. Sep 26 '12 at 7:11
• ...and what happens if you use FullSimplify[] instead? Sep 26 '12 at 7:14
• Thanks for the Accept, but I encourage all users to wait 24 hours before Accepting as answer so that other users have a chance to read and answer the question before it appears concluded. Quick Accepts may prevent the posting of other, potentially better answers. Sep 26 '12 at 7:20
• Thanks @Mr.Wizard; I did try and un-accept yesterday, but for some reason actions on this site occasionally don't work (like voting and commenting.) Sep 26 '12 at 22:15

There are many potential simplifications that Simplify and FullSimplify do not make, presumably because they are deemed too costly to attempt.

In this case it appears that parts are at too deep a level for the required simplifications to be made:

expr = Max[0, Sqrt[1 - Cos[4 t]]/Sqrt];
simp = FullSimplify[#, {0 <= t <= 2 Pi}] &;

simp @ expr

Max[0, 1/Sqrt[Csc[2 t]^2]]


If you apply the simplification function to all the subexpressions further transformations are made:

simp //@ expr

Abs[Sin[2 t]]

• Nice, a very rare occurrence of MapAll! Sep 26 '12 at 7:16
• Indeed, MapAll[] is always a good idea when simplifying tricky things. Sep 26 '12 at 7:18
• Funny enough, your solution does not work with Simplify, but the less specific (and inferior) Simplify[Max[0, Simplify[Sqrt[1 - Cos[4 \[Theta]]]/Sqrt]], {0 <= \[Theta] <= 2 \[Pi]}]  does? Sep 26 '12 at 7:22
• @Yves I am not surprised; there is a large element of chance involved in this and I certainly do not mean to imply that //@ is a panacea -- far from it in fact. It only so happens that it produces the needed string of transformations in this case. Search MathGroup for VOISimplify for a good illustration of the order dependence of Simplify that often manifests as apparent capriciousness. Sep 26 '12 at 7:36
• An insightful statement by Andrzej Kozlowski in that thread: ... there are just too many different groupings and rearrangements that would have to be tried to get to a simpler form. Moreover, Mathematica will only apply a transformation if it immediately leads to a decrease in complexity. Sometimes the only way to transform an expression to a simpler form is by first transforming it to a more complex one ... Sep 26 '12 at 7:40