2
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ are you assuming that c is Real and did you tell Mathematica that? $\endgroup$ Commented Jul 28, 2013 at 2:07

2 Answers 2

7
$\begingroup$

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

$\endgroup$
7
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ Very useful stuff. I need you in my corner if I ever return to Project Euler problems. :-) $\endgroup$
    – Mr.Wizard
    Commented Jul 29, 2013 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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