1
$\begingroup$

For higher order bivariate polynomials, if I want to find the roots I'll expect answer using Root[], e.g. from the help pages,

In[1]:= Solve[x^5 + 2 x + 1 == 0, x]

Out[1]= {
 {x -> Root[1 + 2 #1 + #1^5 &, 1]}, 
 {x -> Root[1 + 2 #1 + #1^5 &, 2]}, 
 {x -> Root[1 + 2 #1 + #1^5 &, 3]}, 
 {x -> Root[1 + 2 #1 + #1^5 &, 4]}, 
 {x -> Root[1 + 2 #1 + #1^5 &, 5]}
}

Now, I know from the help page of Root[], that their is a partial ordering of the roots,

"...The ordering used by Root[f,k] takes real roots to come before complex ones, and takes complex conjugate pairs of roots to be adjacent. "

But for instance, if I restart the computation or Mathematica, will the order of a subset of these stay the same, e.g. the real roots? Or will there be a re-ordering (not necessarily but possible) each time, e.g.

sol_today = {{x -> Root[...,1]}, {x -> Root[...,2]}, ...}
N/@sol_today = { {x -> 1}, {x -> 5}, ...}

versus tomorrow,

sol_tomorrow = {{x -> Root[...,1]}, {x -> Root[...,2]}, ...}
N/@sol_tomorrow = { {x -> 5}, {x -> 1}, ... }

From here, Root and ToRadical[Root] do not preserve order of roots, the first answer touches on ordering of Root[], by saying it is sorted by numerical values,

I believe the reason for this behaviour is that the ordering used by Root is based on the numerical value of the roots. Real ones come first, followed by complex conjugate pairs. Beyond this, they are sorted by real part.

but really talks about the mapping between Root[] and ToRadicals[], which makes sense. The second answer also only talks about this mapping.

Because the first answer to the linked page mentions "I believe", is there a way of knowing for sure? The real roots ordered numerically from smallest to largest? But then the complex roots, how are they ordered? It is not an orderable field... by reals and then imaginaries? Etc.?

I just need to know that once I have a root, e.g. Out[1][[3]], that it will not change from day to day....

EDIT

Just for clarity...

I have 2 bivariate polynomials;

F[a_,b_] = 1+-2*b+a*(b^3 - b^4 - 2*b^5 - 2*b^6 + 4*b^7)+a^2*(-b^9 + b^10)
FD[a_,b_] = -2+a*(3*b^2 - 4*b^3 - 10*b^4 - 12*b^5 + 28*b^6)+a^2*(-9*b^8 + 10*b^9)

and I find a Groebner basis,

S1 = GroebnerBasis[{FF23[a, b, 2] == 0, FF23D[a, b, 2] == 0}, {a, b}, 
 CoefficientDomain -> Rationals, 
 Method -> "Buchberger", 
 MonomialOrder -> Lexicographic];
Variables /@ S1

(* {{b},{a,b}} *)

I see I can solve for one univariate equation's roots - the first one,

S1a = Solve[
 S1[[1]] == 0,
 b, 
 Complexes, 
 MaxExtraConditions -> All, 
 Method -> Reduce, 
 VerifySolutions -> True]

{{b -> -(1/Sqrt[2])}, 
 {b -> -(1/Sqrt[2])}, 
 {b -> 1/Sqrt[2]}, 
 {b -> 1/Sqrt[2]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 +   
  144 #1^6 &, 1]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 +          
  144 #1^6 &, 2]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
  144 #1^6 &, 3]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
  144 #1^6 &, 4]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
  144 #1^6 &, 5]}, 
 {b -> Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
  144 #1^6 &, 6]}}

I then substitute each value/rule into the other equation of the basis and solve for a, here is the first one,

Solve[
 (
   S1[[2]] /. S1a[[1]]
   ) == 0, a
 ]
{a /. %, b /. S1a[[1]]}

{{4 Sqrt[2]}, -(1/Sqrt[2])}

and here is the 5th one (the first of the Root type ones),

Solve[
 (
   S1[[2]] /. S1a[[5]]
   ) == 0, a
 ]
{a /. %, b /. S1a[[5]]}

{{(1/5292)(-4146515 + 
    12347784 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1] + 
    5374080 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^2 - 
    32390976 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^3 - 
    6380124 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^4 + 
    585696 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^5 + 
    93550672 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^6 - 
    11150976 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^7 - 
    138229248 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^8 + 
    80845056 Root[
      18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
        144 #1^6 &, 1]^9)}, 
 Root[18 - 84 #1 + 138 #1^2 - 155 #1^3 + 276 #1^4 - 336 #1^5 + 
    144 #1^6 &, 1]}

and its approximate value,

% // N

{{-4.38426 - 3.57467 I}, -0.294228 - 0.642985 I}

and if I do them all,

In[126]:= Table[
  Flatten[
   {
    a /.
     Solve[
      (
        S1[[2]] /. S1a[[i]]
        ) == 0, a,
      Complexes,
      MaxExtraConditions -> All,
      Method -> Reduce,
      VerifySolutions -> True
      ],
    b /. S1a[[i]]
    }
   ],
  {i, 1, 10}];
% // N

{{5.65685, -0.707107}, 
 {5.65685, -0.707107}, 
 {-5.65685, 0.707107}, 
 {-5.65685, 0.707107}, 
 {-4.38426 - 3.57467 I, -0.294228 - 0.642985 I}, 
 {-4.38426 + 3.57467 I, -0.294228 + 0.642985 I}, 
 {-4.38426 - 3.57467 I, 0.532424 - 0.056971 I}, 
 {-4.38426 + 3.57467 I, 0.532424 + 0.056971 I}, 
 {-4.38426 - 3.57467 I, 0.92847 - 0.0993489 I}, 
 {-4.38426 + 3.57467 I, 0.92847 + 0.0993489 I}}

and so there are two double real roots, and 3 pairs whose a coordinates are complex conjugates, with 3 different b coordinates.

$\endgroup$
  • 2
    $\begingroup$ You write "bivariate" but all your examples are univariate. I don't see an example here that illustrates the difficulty you describe. One could always use Sort to order them. In any case, I'm not sure who could tell you for sure what aspects are independent of time other than WRI. I can say that there is time dependence in Mathematica, depending on version used, paclet updates, curated data and perhaps other volatile aspects of the system. I believe Root and Solve are affected only by version changes, and rarely then. But there's that "I believe" again. $\endgroup$ – Michael E2 Apr 6 at 3:18
  • $\begingroup$ true, I utilized GroebnerBasis to isolate a variable down to a univariate equation... but Solve spits out answers with Root in either solving the bivariate or the univariate, and I assumed Root is operating on the same mechanism either way. It seems one cannot count on order preserved by Solve and Root... Sort can order Complex numbers but don't know if it is employed... $\endgroup$ – nate Apr 6 at 4:16
  • $\begingroup$ It would be interesting to have an answer that was consistent across versions of Mathematica $\endgroup$ – mikado Apr 6 at 6:11
  • $\begingroup$ If the Root objects are numeric, then the sorting is as stated. If they have parameters then the sorting cannot correspond to numeric values in a way that would both be consistent for different instantiations of parameter values, and maintain continuity of derivatives (when considered as functions of the parameter(s)). $\endgroup$ – Daniel Lichtblau Apr 6 at 14:32
  • $\begingroup$ That makes sense, though I don't have any parameters. I naively assumed such objects would carry a similar ambiguity as the problem associated with the mapping ToRadicals, in the linked question (though it makes me wonder about when I perturbed the curve with one... ) . I also tried to avoid numerical values by avoiding NSolve, and saying only Solve. NSolve works fine, I get my 10 roots, but as I need Mathematica to recognize them as poles, I avoid numerics. $\endgroup$ – nate Apr 6 at 15:55

Your Answer

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

Browse other questions tagged or ask your own question.