Mathematica How to distinguish exact roots using Solve?

  • Thread starter Thread starter aheight
  • Start date Start date
  • Tags Tags
    Roots
Click For Summary
SUMMARY

This discussion focuses on distinguishing between exact solutions and Root objects when using the Solve function in Mathematica for polynomial equations. The example provided illustrates that Solve returns Root objects for polynomials that cannot be solved in terms of radicals, while it returns exact solutions when radicals are applicable. Users can utilize pattern matching with "_Root" or the Head function to identify the type of solution returned by Solve. The discussion emphasizes the importance of understanding these distinctions for effective problem-solving in Mathematica.

PREREQUISITES
  • Familiarity with Mathematica programming language
  • Understanding of polynomial equations and their solutions
  • Knowledge of pattern matching in Mathematica
  • Experience with the Solve function in Mathematica
NEXT STEPS
  • Explore the use of the Head function in Mathematica for expression analysis
  • Learn about the ToRadicals function for converting Root objects to radical form
  • Study advanced pattern matching techniques in Mathematica
  • Investigate the implications of using N for numerical approximations of Root objects
USEFUL FOR

Mathematica users, mathematicians, and researchers dealing with polynomial equations who need to understand the distinction between exact solutions and Root objects for effective computation and analysis.

aheight
Messages
318
Reaction score
108
Can someone help me distinguish when Solve[polynomial==0,x] returns exact solutions as opposed to solutions in terms of Roots? For example, if I code:

myroots = x /. Solve[1/2 + 1/5 x + 9/10 x^2 + 2/3 x^3 - 1/5 x^4 + 3/11 x^5 == 0, x]

this cannot be solved in terms of radicals so Solve returns Root objects:

{Root[165+66 #1+297 #1^2+220 #1^3-66 #1^4+90 #1^5&,1],
Root[165+66 #1+297 #1^2+220 #1^3-66 #1^4+90 #1^5&,2],
Root[165+66 #1+297 #1^2+220 #1^3-66 #1^4+90 #1^5&,3],
Root[165+66 #1+297 #1^2+220 #1^3-66 #1^4+90 #1^5&,4],
Root[165+66 #1+297 #1^2+220 #1^3-66 #1^4+90 #1^5&,5]}

but
myroots = x /. Solve[1/2 + 1/5 x + 9/10 x^2 + 2/3 x^3 - 1/5 x^4 == 0, x]

returns exact solutions in terms of radicals. I can't figure out how to distinguish the two as in:

If[solve returns exact solutions,
do this;
,
else if Roots are returned do this
]

Can someone help me do this?
 
Physics news on Phys.org
A Root is an exact numeric quantity. You can use N on it to get an approximate value to any degree of precision needed. You can also use ToRadicals on it if needed.
 
You should read the help files on pattern matching. The pattern which matches a Root object is "_Root". Or you can use Head, which returns the head of an expression:

Code:
If[Head[expr]===Root, ...]
 
  • Like
Likes aheight

Similar threads

Replies
10
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
5K
Replies
9
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 6 ·
Replies
6
Views
4K