Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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[2]], {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[2] 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 ...

share|improve this question
1  
Simplify[Max[0, Simplify[Sqrt[1 - Cos[4 \[Theta]]]/Sqrt[2]]], {0 <= \[Theta] <= 2 \[Pi]}] seems to work. –  Yves Klett Sep 26 '12 at 7:11
    
...and what happens if you use FullSimplify[] instead? –  J. M. 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. –  Mr.Wizard 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.) –  Noon Silk Sep 26 '12 at 22:15
add comment

1 Answer 1

up vote 11 down vote accepted

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[2]];
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]]
share|improve this answer
    
Nice, a very rare occurrence of MapAll! –  Sjoerd C. de Vries Sep 26 '12 at 7:16
    
Indeed, MapAll[] is always a good idea when simplifying tricky things. –  J. M. Sep 26 '12 at 7:18
1  
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[2]]], {0 <= \[Theta] <= 2 \[Pi]}] does? –  Yves Klett Sep 26 '12 at 7:22
1  
@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. –  Mr.Wizard Sep 26 '12 at 7:36
4  
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 ... –  Mr.Wizard Sep 26 '12 at 7:40
show 4 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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