# Finding the absolute value of the roots of a polynomial

So I am trying to find the absolute value of the roots of a polynomial in Mathematica. I am quite new to this software and I am having a hard time how to figure out the absolute value of the roots of a polynomial. Here's what I have done.

• I defined a polynomial say P[degree_,z_]:= (*something*)
• Now I use: Solve[P[5,z]==0] This gives me the exact roots of the polynomial, but if I use Abs[Solve[P[5,z]==0]], this doesn't return the absolute values of the roots. Any help is highly appreciated.
• Perhaps z /. Solve[p[z] == 0, z] // Abs // N Jun 26 at 8:13

Since Solve[P[degree,z]] returns a set of rules, so we need to modify it a little.
Let us define data= Solve[P[degree,z]==0,z] , then use Table[z/.data[[i]],{i,1,degree}] this table gives us the value of the roots corresponding to the $$i$$th position. Now this is a number and we can apply mathematical operations here.
Using Table[Abs[z/.data[[i]]],{i,1,degree}] will return the absolute values of the roots.
Extra observation: If the polynomial have very complicated roots and mathematica returns them in not so simple form we can use NSolve as long as we are only concerned about the absolute value of roots.
• Or to leave solution (roots) as rules, roots /. (z -> root_) :> (z -> Abs[root]) Jun 26 at 14:36