3
$\begingroup$
f = 2 Sqrt[b^3 (1 + b) (1 - b + 2 a^2 b) c] + 8 Sqrt[b^5 (1 + b) (1 - b + 2 a^2 b) c] + 
10 Sqrt[b^7 (1 + b) (1 - b + 2 a^2 b) c] - 10 Sqrt[b^11 (1 + b) (1 - b + 2 a^2 b) c] - 
8 Sqrt[b^13 (1 + b) (1 - b + 2 a^2 b) c] - 2 Sqrt[b^15 (1 + b) (1 - b + 2 a^2 b) c]

If we write (this is the best after I read so many questions in this page):

FullSimplify[f, Assumptions -> {a > 1, b > 1, c > 0,
  Element[a, Reals], Element[b, Reals], Element[c, Reals]}, 
    ComplexityFunction -> LeafCount]

We obtain (just each coefficient is reduced by a factor 2):

(Sqrt[b^3 (1 + b) (1 - b + 2 a^2 b) c] + 4 Sqrt[b^5 (1 + b) (1 - b + 2 a^2 b) c] + 
5 Sqrt[b^7 (1 + b) (1 - b + 2 a^2 b) c] - 5 Sqrt[b^11 (1 + b) (1 - b + 2 a^2 b) c] - 
4 Sqrt[b^13 (1 + b) (1 - b + 2 a^2 b) c] - Sqrt[b^15 (1 + b) (1 - b + 2 a^2 b) c])

We can do this (we see the common part Sqrt[b (1 + b) (1 + (-1 + 2 a^2) b) c]):

FullSimplify[(2 b + 8 b^2 + 10 b^3 - 10 b^5 - 8 b^6 - 2 b^7) Sqrt[b (1 + b)  
(1 - b + 2 a^2 b) c], {b > 1}]

and Mathematica out is:

-2 (-1 + b) b (1 + b)^5 Sqrt[b (1 + b) (1 + (-1 + 2 a^2) b) c]

But the problem is that this is a little part of a huge expression and doing this manualy may take weeks or more.

The optimal expresion would be:

-2 b (b - 1) (b + 1)^5 Sqrt[b c (b + 1) (1 + b (2 a^2 - 1))]

But I will be hilarious with the previous.

Suplemental question:

As prescribed in the second response by bbgodfrey, we obtain our objective! Thanks you very much!

But permit me to go far away, if we put bbgodfrey's solution in a more complex expression like:

ff = (a (2 a (-2 + a^2) b^(3/2) - 2 a^3 b^(5/2) - 2 a (-2 + a^2) b^(7/2) + 2 a^3 b^(9/2) + 
Sqrt[2] (-1 + a^2) b Sqrt[(-1 + b) (1 + b) (1 - b + 2 a^2 b) c] - 6 Sqrt[2](-1 + a^2) b^2 
Sqrt[(-1 + b) (1 + b) (1 - b + 2 a^2 b) c] + Sqrt[2] (-1 + a^2) b^3 Sqrt[(-1 + b) (1 + b) 
(1 - b + 2 a^2 b) c] + (4 a (Sqrt[b^3 (1 + b) (1 - b + 2 a^2 b) c] + 3 Sqrt[b^5 
(1 + b) (1 - b + 2 a^2 b) c] + 2 Sqrt[b^7 (1 + b) (1 - b + 2 a^2 b) c] - 2 Sqrt[b^9 
(1 + b) (1 - b + 2 a^2 b) c] - 3 Sqrt[b^11 (1 + b) (1 - b + 2 a^2 b) c] - Sqrt[b^13 
(1 + b) (1 - b + 2 a^2 b) c]))/(1 + b)^3 + b (-2 a Sqrt[b] + 2 a (-4 + a^2) b^(3/2) - 
2 a^3 b^(5/2) - 2 a (-4 + a^2) b^(7/2) + 2 (a + a^3) b^(9/2) + Sqrt[2] (-1 + a^2) b 
Sqrt[(-1 + b) (1 + b) (1 - b + 2 a^2 b) c] - 6 Sqrt[2] (-1 + a^2) b^2 Sqrt[(-1 + b) (1 + b)
(1 - b + 2 a^2 b) c] + Sqrt[2] (-1 + a^2) b^3 Sqrt[(-1 + b) (1 + b) (1 - b + 2 a^2 b) c] + 
4 a (Sqrt[b^3 (1 + b) (1 - b + 2 a^2 b) c] - Sqrt[b^7 (1 + b) (1 - b + 2 a^2 b) c]))))
/(4 (-1 + b) b^2 (1 + b) (2 a^3 Sqrt[b] + 2 a^3 b^(3/2) + Sqrt[2] (1 + a^2) Sqrt[(-1 + b)
(1 + b) (1 + (-1 + 2 a^2) b) c]))

FullSimplify[ff /. Sqrt[z1___ z3_^n_ z2___] -> z3^(n/2) Sqrt[z1 z2]]

Mathematica out is:

(a (2 a^3 (-1 + b)^2 Sqrt[b] (1 + b) - Sqrt[2] (1 + (-6 + b) b) Sqrt[(1 + (-1 + 2 a^2) b) 
(-1 + b^2) c] + Sqrt[2] a^2 (1 + (-6 + b) b) Sqrt[(1 + (-1 + 2 a^2) b) (-1 + b^2) c] + 
2 a Sqrt[b] (-1 + b^2) (3 + b - 2 Sqrt[(1 + b) (1 - b + 2 a^2 b) c])))/(4 (-1 + b) b 
(2 a^3 Sqrt[b] (1 + b) + Sqrt[2] Sqrt[(1 + (-1 + 2 a^2) b) (-1 + b^2) c] + Sqrt[2] 
a^2 Sqrt[(1 + (-1 + 2 a^2) b) (-1 + b^2) c]))

When we expect:

(a (2 a Sqrt[b] (3 + a^2 (-1 + b) + b) (-1 + b^2) + Sqrt[2] (-1 + a^2) (1 + (-6 + b) b) 
Sqrt[(1 + (-1 + 2 a^2) b) (-1 + b^2) c] - 2 a (-1 + b^2) 2 Sqrt[b (1 + b) (1 + (-1 + 2 a^2)
b) c]))/(4 (-1 + b) b (2 a^3 Sqrt[b] (1 + b) + Sqrt[2] (1 + a^2) Sqrt[(1 + (-1 + 2 a^2) b)
(-1 + b^2) c]))

Why can we automatize Mathematica to collect and reduce the expression length?

We are very interested in adding rules to accomplish a full simplification. What is the estructure of this sentences? We would be very grateful if anybody could explain or give information (other questions, tutorials...) about this.

Thanks to all the people who answers, comments, edits and reads!

$\endgroup$
10
  • $\begingroup$ Giving an assumption a>1 should mean you don't then need Element[a,Reals]. If you are sure your assumptions are valid then you might try f /. Sqrt[p_^n_* q_] /; OddQ[n] :> p^((n-1)/2)* Sqrt[p* q] to pull your odd powers outside your square roots. $\endgroup$
    – Bill
    Commented Dec 15, 2015 at 20:22
  • $\begingroup$ After you have extracted even powers of b and stored the result in say ff then you might try Simplify[ff //. p_* Sqrt[q_]+r_* Sqrt[q_]->(p+r)* Sqrt[q]] to collect together all your identical square roots into one. Use this cautiously. Check results carefully. $\endgroup$
    – Bill
    Commented Dec 15, 2015 at 20:50
  • 1
    $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Dec 16, 2015 at 12:23
  • 1
    $\begingroup$ @Nicolas Jumilla, do not spoil you question and nickname. You've made in intractable. Make a second question separate from the first, starting with the reference to the code. And do not forget to accept the bbgofrey`s answer if you like it. $\endgroup$
    – garej
    Commented Dec 16, 2015 at 21:28
  • $\begingroup$ Nicolas - please see: mathematica.stackexchange.com/help/merging-accounts $\endgroup$
    – Verbeia
    Commented Dec 16, 2015 at 22:23

2 Answers 2

2
$\begingroup$

The following works for expressions of the form in the question but, of course, not for all expressions.

Simplify[f /. Sqrt[Times[z1___, b^n_, z2___]] -> b^((n - 1)/2) Sqrt[Times[z1, b, z2]]]
(* -2 (-1 + b) b (1 + b)^5 Sqrt[b (1 + b) (1 + (-1 + 2 a^2) b) c] *)

If the variety of expressions to the simplified is modest, more rules can be developed along these lines to accomplish a full simplification.

Addendum

A simpler and more general solution is

Simplify[f /. Sqrt[z1___ z3_^n_ z2___] -> z3^(n/2) Sqrt[z1 z2]]
{* -2 (-1 + b) b^(3/2) (1 + b)^5 Sqrt[(1 + b) (1 + (-1 + 2 a^2) b) c] *}

Second Addendum

The following largely but not entirely satisfies the goal of the addition to the question.

FullSimplify[ff /. b -> d^2 /. Sqrt[z1___ z3_^n_ z2___] -> z3^(n/2) Sqrt[z1 z2], d > 0];
FullSimplify[
  Collect[Numerator[%136], Sqrt[c (1 + (-1 + 2 a^2) d^2) (-1 + d^4)], Simplify]/
  Collect[Denominator[%136], Sqrt[c (1 + (-1 + 2 a^2) d^2) (-1 + d^4)], Simplify] /. 
  d -> Sqrt[b], b > 0]
(* (a (Sqrt[2] (-1 + a^2) (1 + (-6 + b) b) Sqrt[(1 + (-1 + 2 a^2) b) (-1 +  b^2) c] + 
    2 a Sqrt[b] (-1 + b^2) (3 + a^2 (-1 + b) + b - 
    2 Sqrt[(1 + b) (1 - b + 2 a^2 b) c])))/
   (8 a^3 b^(3/2) (-1 + b^2) + 4 Sqrt[2] (1 + a^2) (-1 + b) b 
    Sqrt[(1 + (-1 + 2 a^2) b) (-1 + b^2) c]) *)

The denominator could be further simplified by using a ComplexityFunction that penalizes terms that the OP wishes to eliminate. However, at some point the approach becomes so specific to the problem that it is equivalent to performing the simplification by hand.

$\endgroup$
3
  • $\begingroup$ @bbgofrey, +1 for general solution and virtual accept =)) $\endgroup$
    – garej
    Commented Dec 16, 2015 at 21:30
  • $\begingroup$ @bbgodfrey, why does Mathematica not collect in a correct way in Simplify? I always though that Mathematica does this because it considers that its output expression is simpler than our expectative. Is there any command or sentence that change Mathematica behavior? Is there a general solution that reduces the length of expressions significantly? $\endgroup$ Commented Dec 19, 2015 at 1:16
  • $\begingroup$ @NicolasJumilla Simplify attempts to reduce the value of a ComplexityFunction by applying TransformationFunctions. This fails, if that desired result does not correspond to the lowest value of the ComplexityFunction being used or if none of the available TransformationFunctions is able to transform the expression to the desired result. Also, sometimes the needed sequence of transformations first must increase the complexity before reducing it, and Simplify may not explore that sequence in sufficient depth to determine that eventually it leads to a less complex result. $\endgroup$
    – bbgodfrey
    Commented Dec 19, 2015 at 11:29
3
$\begingroup$

Let us take

z = Sqrt[b (1 + b) (1 + (-1 + 2 a^2) b) c]; k = {a > 0, b > 0, c > 0};

So

z * FullSimplify[f/z, Assumptions -> k]

-2 (-1 + b) b (1 + b)^5 Sqrt[b (1 + b) (1 + (-1 + 2 a^2) b) c]

$\endgroup$
3
  • 1
    $\begingroup$ Your solution is elegant in its simplicity. The assumption b > 0 is sufficient, however. $\endgroup$
    – bbgodfrey
    Commented Dec 15, 2015 at 22:20
  • $\begingroup$ @bbgodfrey, you are right. The only thing c = 0 Should be ruled out. Otherwise expression f/z will return Indeterminate. I kept all of them because of OP's assumption. $\endgroup$
    – garej
    Commented Dec 15, 2015 at 22:57
  • $\begingroup$ @garej, it is a good idea. We can use in some punctual cases. $\endgroup$ Commented Dec 18, 2015 at 11:56

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.