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.

I would like Mathematica to simplify this expression:

$4 \left(16 \sqrt{\left(-1+2 c^2\right)^2}-32 c^2 \sqrt{\left(-1+2 c^2\right)^2}+\sqrt{\left(1-8 c^2+8 c^4\right)^2}\right)^2$

expression = 4*( 16*Sqrt[(-1 + 2*c^2)^2] - 32*c^2*Sqrt[(-1 + 2*c^2)^2] 
                 + Sqrt[(1 - 8*c^2 + 8*c^4)^2])^2;

I have tried

PowerExpand[expression]

FullSimplify[expression]

but they did not simplify expression.

share|improve this question
    
are you assuming that c is Real and did you tell Mathematica that? –  bobthechemist Jul 28 '13 at 2:07
add comment

2 Answers 2

We should exploit the second argument in Simplify or FullSimplify being an assumption on possible variables or symbols in a given axpression. For more complete discussion of simplification methods see the answers to this question What is the difference between a few simplification techniques?.

One should have consider a few cases since we could use various assumptions. Let's start with plotting graphs of polynomial functions apprearing in the expression. We'd like to distinguish cases where 1 - 8 c^2 + 8 c^4 and 1 - 2 c^2 are non-negative.

Plot[{ 1 - 8 c^2 + 8 c^4, 1 - 2 c^2}, {c, -4/3, 4/3}, 
       PlotLegends -> "Expressions", PlotStyle -> Thick]

enter image description here

There are two independent terms which can be simplified in different ways with respect to assumptions given, e.g.

Simplify[ Sqrt[(-1 + 2 c^2)^2], #]& /@ {-(1/Sqrt[2]) < c < 1/Sqrt[2], 1/Sqrt[2] < c} //  
Column
 1 - 2 c^2
-1 + 2 c^2 

We shouldn't impose accidental assumptions since expressions couldn't be simplified to the simplest form (appropriate assumptions for the first term, in general will not be adequate for the other one), e.g.

Simplify[ expression, #] & /@ {-(1/Sqrt[2]) < c < 1/Sqrt[2], 1/Sqrt[2] < c} // Column
4 ( 16 (1 - 2 c^2)^2 + Abs[1 - 8 c^2 + 8 c^4])^2
4 (-16 (1 - 2 c^2)^2 + Abs[1 - 8 c^2 + 8 c^4])^2

Here Sqrt[(1 - 8 c^2 + 8 c^4)^2] could be simplified only to Abs[1 - 8 c^2 + 8 c^4] since it is the most general (and the simplest) form satisfying imposed assumptions.

Now, in order to complete simplification we need to deal with Reduce for writing down different assumptions:

Grid[(cs = Table[ Reduce[ g[1 - 8 c^2 + 8 c^4, 0] && h[1 - 2 c^2, 0], c], 
                  {g, {GreaterEqual, Less}}, {h, {GreaterEqual, Less}}]), 
      Frame -> All] // TraditionalForm

enter image description here

and the simplifications are respectively:

Grid[ Map[ Simplify[ 4(16Sqrt[(-1 + 2c^2)^2] - 32c^2 Sqrt[(-1 + 2 c^2)^2] + 
                     Sqrt[(1 - 8c^2 + 8c^4)^2])^2, #] &, cs, {2}], 
      Frame -> All] // TraditionalForm

enter image description here

In general for more involved expressions one should deal with FullSimplify, nevertheless we get in our case the same expressions with Simplify.

share|improve this answer
    
Very useful stuff. I need you in my corner if I ever return to Project Euler problems. :-) –  Mr.Wizard Jul 29 '13 at 14:57
add comment

The simplification that I think you are looking for only works if you tell Mathematica to assume c is real. Try

Simplify[4*(16*Sqrt[(-1 + 2*c^2)^2] - 
     32*c^2*Sqrt[(-1 + 2*c^2)^2] + 
     Sqrt[(1 - 8*c^2 + 8*c^4)^2])^2, 
  c ∈ Reals]

4 ((16 - 32 c^2) Abs[1 - 2 c^2] + Abs[1 - 8 c^2 + 8 c^4])^2

share|improve this answer
add comment

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.