0
$\begingroup$

Mathematica seems to refuse to simplify the following inequality, even though it is obvious there are things that can be done

-((18 + 6 Sqrt[3] a1 - 78 a1^2 + 32 Sqrt[3] a1^3 + 134 a1^4 - 
      118 Sqrt[3] a1^5 + 22 a1^6 + 80 Sqrt[3] a1^7 - 96 a1^8 - 
      9 Sqrt[6]
        a1 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))] + 
      30 Sqrt[6]
        a1^3 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))] - 
      72 Sqrt[2]
        a1^4 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))] - 
      25 Sqrt[6]
        a1^5 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))] + 
      120 Sqrt[2]
        a1^6 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))] - 
      48 Sqrt[6]
        a1^7 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
           135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 
           1030 a1^5 - 227 Sqrt[3] a1^6 - 996 a1^7 + 
           720 Sqrt[3] a1^8 - 576 a1^9))/(
        a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 
           40 Sqrt[3] a1^5 + 48 a1^6)^2))])/(2 a1 (9 - 30 a1^2 + 
        24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 48 a1^6))) < a2

Simplify, Collect[,Sqrt[_],Simplify] and Together do nothing, even though all the square roots have exactly the same argument.

If I pick by hand just the part with the square roots inside the numerator

FullSimplify[
 Collect[-18 - 6 Sqrt[3] a1 + 78 a1^2 - 32 Sqrt[3] a1^3 - 134 a1^4 + 
   118 Sqrt[3] a1^5 - 22 a1^6 - 80 Sqrt[3] a1^7 + 96 a1^8 + 
   9 Sqrt[6]
     a1 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))] - 
   30 Sqrt[6]
     a1^3 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))] + 
   72 Sqrt[2]
     a1^4 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))] + 
   25 Sqrt[6]
     a1^5 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))] - 
   120 Sqrt[2]
     a1^6 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))] + 
   48 Sqrt[6]
     a1^7 Sqrt[-(((-1 + a1^2)^2 (-27 Sqrt[3] - 18 a1 + 
        135 Sqrt[3] a1^2 - 264 a1^3 - 273 Sqrt[3] a1^4 + 1030 a1^5 - 
        227 Sqrt[3] a1^6 - 996 a1^7 + 720 Sqrt[3] a1^8 - 576 a1^9))/(
     a1 (9 - 30 a1^2 + 24 Sqrt[3] a1^3 + 25 a1^4 - 40 Sqrt[3] a1^5 + 
        48 a1^6)^2))], Sqrt[_], FullSimplify@*Simplify]]

I can almost get it to work, it gives

-2 Sqrt[3] a1 (3 + 16 a1^2 - 59 a1^4 + 40 a1^6) + 
 2 (-1 + a1) (1 + a1) (9 - 30 a1^2 + 37 a1^4 + 48 a1^6) + 
 24 Sqrt[6]
   a1^4 (3 - 
    5 a1^2) Sqrt[((-1 + a1^2)^2 (3 Sqrt[3] + 
     a1 (2 - 5 Sqrt[3] a1 + 12 a1^2)))/(
  a1 (3 Sqrt[3] - 5 Sqrt[3] a1^2 + 12 a1^3)^2)] + 
 3 Sqrt[2] a1 (9 - 30 a1^2 + 25 a1^4 + 
    48 a1^6) Sqrt[((-1 + a1^2)^2 (3 Sqrt[3] + 
     a1 (2 - 5 Sqrt[3] a1 + 12 a1^2)))/(
  a1 (3 Sqrt[3] - 5 Sqrt[3] a1^2 + 12 a1^3)^2)]

which still has two square roots that can be combined together. I can do that by hand again, but that is not the point. I will then have to go back and pick up what was left from the initial expressions and combine it all. I have a list with hundreds more such expressions (most of them much longer). I can't do that by hand.

I want to knwo how can I make mathematica combine (collect) all the square roots together into one square root. This does not depend on the values of a1 and a2. I am not interested in the reality of the square root.

$\endgroup$
1
$\begingroup$

Simplification depends on values of a1. Do CylindricalDecomposition.

vars = {a1, a2};

cd = CylindricalDecomposition[ineq, vars] // FullSimplify;

TraditionalForm[
   cd //. Or -> 
 Composition[(Column[#, Right, Background -> {{White, LightGray}}, 
   Frame -> All] &), List]]

enter image description here

Edit 2

You can develop a semi-automatic procedure. First locate the squareroots and generate a rule for substitution.

aaRule = First@
 Select[Cases[List @@ eqn, Sqrt[aa_] -> Sqrt[aa], 4] // Union, 
MemberQ[#, a1, 3] &] -> aa

eqn2 = eqn /. aaRule;

sol = Reduce[a2 \[Element] Reals && eqn2, aa]

By the way this shows a1 have to be real.

Get a simplified inequation

sol /. Reverse[aaRule] // FullSimplify


(*   Sqrt[3] Sqrt[((-1 + a1^2)^2 (3 Sqrt[3] + 
 a1 (2 - 5 Sqrt[3] a1 + 12 a1^2)))/(
a1 (3 Sqrt[3] - 5 Sqrt[3] a1^2 + 12 a1^3)^2)] < 
1/3 (Sqrt[6]/a1 - Sqrt[6] a1 - (3 Sqrt[2] (-1 + a1^2))/(
3 + a1^2 (-5 + 4 Sqrt[3] a1)) + Sqrt[6] a2)   *)
$\endgroup$
3
  • $\begingroup$ The reality of the square roots within the expression depends on the value of a1. I don't care about the reality of the square root. Rewriting all the terms with square roots in them, as a single term that is the sum of the coefficients in front of the different square roots times the square root does not depend on the value of a1. It is that what I want Mathematica to achieve. Picking just the square roots in the numerator and applying Collect almost gets us that, as I have shown in the question $\endgroup$ – ThunderBiggi Feb 3 at 12:19
  • $\begingroup$ A quote from the documentation "CylindricalDecomposition assumes that all variables are real ". $\endgroup$ – user64494 Feb 3 at 12:20
  • $\begingroup$ @Akku14 Edit 2 does indeed solve the specific problem I have given in my question. It is semi-automatic, as you said. I don't have the time now to play with it to see whether I can automate it for my purposes. If you have any suggestions, let me know. In the meantime, I will accept it as the answer to my problem tomorrow, as it does resolve what I have posted. $\endgroup$ – ThunderBiggi Feb 4 at 15:10
1
$\begingroup$

Adding natural assumptions, I obtain (The notation inequalitystands for the long inequality under consideration.)

FullSimplify[inequality,Assumptions -> {a1, a2} \[Element] Reals]

a1 + (3 (-1 + a1^2))/( 3 Sqrt[3] - 5 Sqrt[3] a1^2 + 12 a1^3) + (3 Sqrt[3/ 2] \[Sqrt](18 + (27 Sqrt[3])/a1 + a1 (-135 Sqrt[3] + a1 (264 + a1 (273 Sqrt[3] + a1 (-1030 + a1 (227 Sqrt[3] + 12 a1 (83 - 60 Sqrt[3] a1 + 48 a1^2))))))) Abs[-1 + a1^2])/(3 Sqrt[3] - 5 Sqrt[3] a1^2 + 12 a1^3)^2 < 1/a1 + a2

A further simplification depends on the value of a1.

$\endgroup$
4
  • $\begingroup$ Yes, but these assumptions might not always hold. Moreover, as one can see when doing it by hand, they are not needed for Mathematica to be able to make progress $\endgroup$ – ThunderBiggi Feb 3 at 11:25
  • $\begingroup$ @ThunderBiggi: The assumption a1\[Element] Reals lightens the work since inequality may hold for some complex values of a1. Don't hesitate to ask for further explanation in need $\endgroup$ – user64494 Feb 3 at 12:07
  • $\begingroup$ @ThunderBiggi: Sorry, I prefer arguments over a lot of emotional words. $\endgroup$ – user64494 Feb 3 at 12:23
  • $\begingroup$ Ok. Combining all square roots into a single epxression should not depend on the values of the variables. I editted my question, explaining what I want Mathematica to do. $\endgroup$ – ThunderBiggi Feb 3 at 12:25
1
$\begingroup$

This may not be the way you want to do it, but you might find the method helpful.

sqrt1=Sqrt[-(((-1+a1^2)^2 (-27 Sqrt[3]-18 a1+135 Sqrt[3]a1^2-264 a1^3-
  273 Sqrt[3]a1^4+1030 a1^5-227 Sqrt[3]a1^6-996 a1^7+720 Sqrt[3]a1^8-
  576 a1^9))/(a1 (9-30 a1^2+24 Sqrt[3]a1^3+25 a1^4-40 Sqrt[3]a1^5+48 a1^6)^2))];
yourInequality//.h1__*sqrt1+h2__*sqrt1->(h1+h2)*sqrt1

instantly returns

-(18 + 6*Sqrt[3]*a1 - 78*a1^2 + 32*Sqrt[3]*a1^3 + 134*a1^4 - 118*Sqrt[3]*a1^5 + 
22*a1^6 + 80*Sqrt[3]*a1^7 - 96*a1^8 + (-4 + 2*Sqrt[2] + 4*Sqrt[6] + a1 + a1^3 + 
a1^4 + a1^5 + a1^6 + a1^7)*Sqrt[-(((-1 + a1^2)^2*(-27*Sqrt[3] - 18*a1 + 135*
Sqrt[3]*a1^2 - 264*a1^3 - 273*Sqrt[3]*a1^4 + 1030*a1^5 - 227*Sqrt[3]*a1^6 -
996*a1^7 + 720*Sqrt[3]*a1^8 - 576*a1^9))/(a1*(9 - 30*a1^2 + 24*Sqrt[3]*a1^3 + 
25*a1^4 - 40*Sqrt[3]*a1^5 + 48*a1^6)^2))])/(2*a1*(9 - 30*a1^2 + 24*Sqrt[3]*a1^3 +
25*a1^4 - 40*Sqrt[3]*a1^5 + 48*a1^6)) < a2

where it combined all those identical large square roots into one by adding together all the multipliers that were in front of each of the square roots.

I understand completely that it would be more convenient if it were possible for it to look through all the square roots and find those that were identical and do this without your needing to identify which square roots might qualify for this. But if you really want it to combine square roots and it is fighting against you then perhaps you can remember this idea and see if it will get the job done now instead of not getting it done at all.

EDIT

You can try to get it to more automatically combine like square roots using this

expr//.h1__*Sqrt[b1__]+h2__*Sqrt[b1__]->(h1+h2)*Sqrt[b1]

and see if you are lucky enough to get it to correctly recognize which square roots you want to combine without having to manually select which to do. But experimenting with this seems to show that it can sometimes choose the wrong path and combine things that you may not want done and at other times not combine things that I believe you do want done.

If you look carefully at the "structure" of any example that fails then that might help you understand why it isn't working. For example

4*Sqrt[5]+7*(2+3*Sqrt[5])//.h1__*Sqrt[b1__]+h2__*Sqrt[b1__]->(h1+h2)*Sqrt[b1]

doesn't simplify because it is not of the form or structure of

a*Sqrt[p]+b*Sqrt[p]+stuff

Using Expand before doing this pattern matching might make things like that into a form where this method of combining square roots would work, but often Expand is so aggressive that it turns expressions into far larger collections of terms that are difficult to compact back into something like the size of the original.

Note there were two underscores after h1 and h2 which will match one or more terms.

I hope it helps

$\endgroup$
4
  • $\begingroup$ I know this works. This is what I meant by hand. Unfortunately, I need to have this type of simplification done for hundreds of inequalities, where for each inequality, the repeating square root has a different argument, so I am not sure how to automate what you are suggesting. My hope was that Collect[expr,Sqrt[_],Simplify] would do that, but it fails $\endgroup$ – ThunderBiggi Feb 3 at 12:13
  • $\begingroup$ Well you can try expr//.h1__*Sqrt[b1__]+h2__*Sqrt[b1__]->(h1+h2)*Sqrt[b1] and see if you are lucky enough to get it to correctly recognize which square roots to combine without having to manually select which to do, but I am much less confident that this will work as desired in all cases and avoid trying to do that in cases that you don't want. $\endgroup$ – Bill Feb 3 at 12:28
  • $\begingroup$ Yep, this seems closest to what I need. Sometimes it leaves two square roots that are the same uncombined at the end. I was trying to get them combined, but to no avail. I might play a bit more with it later. You can update your answer with it and I will accept it tomorrow, if no better option is found. $\endgroup$ – ThunderBiggi Feb 3 at 12:59
  • $\begingroup$ I tried using Expand and for my complicated epxressions it makes matters worse. For simple examples, though, it might work, so good suggestion! $\endgroup$ – ThunderBiggi Feb 4 at 15:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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