Is there a way to print simple roots as Root objects?
expr = 3 - Sqrt[2];
Use ToNumberField
to convert the expression to an AlgebraicNumber
expr2 = expr // ToNumberField
The short form display of the AlgebraicNumber
is similar to that of Root
RootReduce
will convert the expression back to the radical representation.
expr2 // RootReduce
(* 3 - Sqrt[2] *)
You can discover the polynomial with MinimalPolynomial
:
p = MinimalPolynomial[3 - Sqrt[2]]
(* 7 - 6 #1 + #1^2 & *)
p[x]
(* 7 - 6 x + x^2 *)
Root[p, 1]
(* 3 - Sqrt[2] *)
From the documentation of Root
:
For linear and quadratic polynomials
f[x]
,Root[f,k]
is automatically reduced to explicit rational or radical form.
You can wrap HoldForm only around Root.
Edit
p = MinimalPolynomial[ro = 3 - Sqrt[2]];
a = Select[Range[10], Root[p, #] == ro &][[1]] // Quiet;
hf = HoldForm[Root][p, a]
(* Root(#1^2-6 #1+7&,1) *)
hf // ReleaseHold
(* 3 - Sqrt[2] *)