I have trouble understanding Root
in Mathematica.
For instance:
Solve[x^5 + 2 x + 1 == 0, x]
gives me a strange solution that I don't quite understand. Any help would be highly appreciated.
I have trouble understanding Root
in Mathematica.
For instance:
Solve[x^5 + 2 x + 1 == 0, x]
gives me a strange solution that I don't quite understand. Any help would be highly appreciated.
An expression like:
Root[1 + 2*#1 + #1^5 & , 1, 0]
is simply an exact representation of an algebraic number. Radicals like Sqrt[2]
are more familiar, but cannot express every algebraic number.
You can treat such things pretty much as any other exact representation of a number in Mathematica. You can get numeric approximations using N[]
. However, Mathematica is a bit less eager to automatically reduce expressions containing these: arithmetic on these is much more expensive than adding 2+2
. But you can say "pretty please" with RootReduce[]
.
Once you're used to these, they are liberating. Problems unsolvable with the traditional algebra of radicals gain solutions.
Root
expression. Because it knows the exact solution, you can specify any desired working precision with N
, e.g., N[#, 100]&
$\endgroup$
Commented
Mar 26, 2020 at 17:51
poly = x^5 + 2 x + 1; sol = Solve[poly == 0, x]; Table[poly /. (sol // N[#, wp] &), {wp, 50, 110, 20}]
$\endgroup$
Commented
Mar 26, 2020 at 18:05
Root
expressions are well-defined numbers, just like Sqrt[2]
is.
$\endgroup$
Commented
Mar 26, 2020 at 19:45
Sqrt[2]
: if you want an approximate numeric representation, you need an algorithm. But yes, there is the issue that the algorithms for approximating Root
objects are more complex and less well known. So, if you need approximate numeric representation, use Mathematica to obtain it.
$\endgroup$
Commented
Mar 26, 2020 at 23:52