2
$\begingroup$

I am trying to solve the cubic solution, and I could not understand how these two codes are different. One is using Root, and one is using Solve.

Using Root

Solve[
Root[a + b #1 + #1^3 &, 2] == 1/Root[a + b #1 + #1^3 &, 2]
, b]

Using Solve

Solve[
Solve[a + b x + x^3 == 0, x][[2, 1, 2]] == 1/Solve[a + b x + x^3 == 0, x][[2, 1, 2]]
, b]

I got the solution quick with Root, but Solve is just taking quite a while, and I don't think Root and Solve are same. What is the difference between Root and Solve?

$\endgroup$
3
$\begingroup$

We can get an idea of what is going on by specifying MaxExtraConditions->All:

Solve[Root[a + b #1 + #1^3 &, 2] == 1/Root[a + b #1 + #1^3 &, 2], b, MaxExtraConditions -> All]

This results in: (apart from a warning)

{{b -> ConditionalExpression[-1 - a, 
    a != 0 && Root[a + (-1 - a) #1 + #1^3 &, 2] == 1]}, {b -> 
   ConditionalExpression[-1 + a, 
    a != 0 && Root[a + (-1 + a) #1 + #1^3 &, 2] == -1]}}

Without MaxExtraConditions, we get the following:

{{b -> -1 - a}, {b -> -1 + a}}

This implies that the solution returned is not the full truth. Indeed: Inserting one of these solutions into the original problem: (Using Reduce for the outer and Solve for the inner equation to get the complete set of solutions)

Reduce[Solve[a + (-1 + a) x + x^3 == 0, x][[2, 1, 2]] == 
  1/Solve[a + (-1 + a) x + x^3 == 0, x][[2, 1, 2]], a]

gives us a == -2, i.e. the solution b -> -1 + a is only valid for "some" a, in this case a single one. So while obeying the specification, the result you get from your first attempt is incomplete. The solution from your second attempt is probably more complete, although it is still running for me as of writing this.

To answer your original question: The difference between the two is that in the case with Root, Solve decides to only return a few specific solutions, whereas it tries a lot harder in the second case.

$\endgroup$

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.