# Forcing mathematica to solve polynomials exactly

It used to be the default behavior that Mathematica would solve polynomials of degree 4 exactly. In the current version I have (12.2.2.0) it sometimes gives numerical answers. Is there a way to change the default behavior?

Example:

Solve[1 + 320*R + 51200*R^2 - 327680*R^3 + 1048576*R^4 == 0, R]


gives the a mess with numerical answers that I can't display, even though by tweaking if I do

Solve[S^4 + 320*R * S^3 + 51200*R^2 * S^2 - 327680*R^3 S + 1048576*R^4 == 0, R]


I get back

{{R -> 1/64 ((5 + 5 I) S - 3 (-1)^(1/4) Sqrt[6] S)}, {R -> 1/64 ((5 + 5 I) S + 3 (-1)^(1/4) Sqrt[6] S)}, {R -> 1/64 ((5 - 5 I) S - 3 (-1)^(3/4) Sqrt[6] S)}, {R -> 1/64 ((5 - 5 I) S + 3 (-1)^(3/4) Sqrt[6] S)}}


(which setting $$S=1$$ is what I wanted to get in the first place).

Edit: To be clear, here are some specific things I would like to be able to do:

1. Permanently disable mathematica from displaying an exact number as a numerical complex number poorly rendered inside a box:

I don't know who imagined this would be desirable as a default.

1. Have settings such as SetOptions[Solve, Quartics -> True] (suggested in the comments) as default settings. (More generally, I would prefer FullSimplify to leave things as radical expressions rather than convert them to the form above (or to a form Root).

another possibly related problem: Even working with what are supposed to be "exact" quantities, Mathematica repeatedly spits out error messages of the form "Unable to decide whether numeric quantity: [messy expression involving algebraic numbers] is equal to zero. This never happened in previous versions of mathematica.

• You could use ToRadicals to get exact solutions. Apr 8, 2021 at 16:55
• Zero-testing is more difficult with explicit radicals than it is with Root objects. So you might be pitting one goal against another. Apr 8, 2021 at 22:51

You have a quartic equation, so setting Quartics -> True gives explicit quartics:

Solve[1 + 320*R + 51200*R^2 - 327680*R^3 + 1048576*R^4 == 0, R,
Quartics -> True]

(*    {{R -> 1/64 (5 - 3 Sqrt[3] - 32 I Sqrt[13/256 - (15 Sqrt[3])/512])},
{R -> 1/64 (5 - 3 Sqrt[3] + 32 I Sqrt[13/256 - (15 Sqrt[3])/512])},
{R -> 1/64 (5 + 3 Sqrt[3] - I Sqrt[2 (26 + 15 Sqrt[3])])},
{R -> 1/64 (5 + 3 Sqrt[3] + I Sqrt[2 (26 + 15 Sqrt[3])])}}             *)


On the other hand, there's nothing wrong (and a lot right) with working directly with Root objects.

• Is there any way to make this a global default option without having to remember this? I don't understand why Solve should ever return a numerical answer, that's what NSolve is for. Apr 8, 2021 at 17:05
• You misunderstand. Root objects are not numerical (finite-precision), they are exact. Please read the documentation. Apr 8, 2021 at 17:06
• I understand that Root objects are not numerical, but the answer I am getting is displayed as some numerical complex number. Even just saying Root[1 + ...] etc. would be a vast improvement on the current display. Anyway, I know the solutions lie in some particular abelian number fields and that Mathematica can work out their particular form, and the Root object is not useful for that purpose. My question is about how to change back the default answer and this doesn't answer that. Apr 8, 2021 at 17:12
• @bringbacktheoldstylings You may display the result in InputForm if you wish to see Root[]. But what, exactly, is the problem you are attempting to solve? Apr 8, 2021 at 17:53
• @bringbacktheoldstylings SetOptions[Solve, Quartics -> True]. There's also a Cubics option. Read the documentation for Solve for more information. Apr 8, 2021 at 18:44

If you look at the InputForm, you will see that the output consists of Root objects:

Solve[1+320*R+51200*R^2-327680*R^3+1048576*R^4==0,R] //InputForm


{{R -> Root[1 + 320*#1 + 51200*#1^2 - 327680*#1^3 + 1048576*#1^4 & , 1, 0]}, {R -> Root[1 + 320*#1 + 51200*#1^2 - 327680*#1^3 + 1048576*#1^4 & , 2, 0]}, {R -> Root[1 + 320*#1 + 51200*#1^2 - 327680*#1^3 + 1048576*#1^4 & , 3, 0]}, {R -> Root[1 + 320*#1 + 51200*#1^2 - 327680*#1^3 + 1048576*#1^4 & , 4, 0]}}

Since Root objects are somewhat unwieldy, they get a short display form in StandardForm, which you dislike. You can turn off this short display form with:

Unprotect[BoxFormUseApproximations];
BoxFormUseApproximations=False;


Then you don't need InputForm any more to avoid seeing the short display form:

Solve[1+320*R+51200*R^2-327680*R^3+1048576*R^4==0,R]


{{R -> Root[1 + 320 #1 + 51200 #1^2 - 327680 #1^3 + 1048576 #1^4 &, 1]}, {R -> Root[1 + 320 #1 + 51200 #1^2 - 327680 #1^3 + 1048576 #1^4 &, 2]}, {R -> Root[1 + 320 #1 + 51200 #1^2 - 327680 #1^3 + 1048576 #1^4 &, 3]}, {R -> Root[1 + 320 #1 + 51200 #1^2 - 327680 #1^3 + 1048576 #1^4 &, 4]}}

• Just to check, it seems like version 12 has changed a lot from the last version in this regard? Apologies if this is a naive question --- is there a way to make these settings defaults for any mathematica session? Apr 10, 2021 at 2:23