I have a list of polynomials polys.
I want a set of $f(x) \in$ polys which have roots strictly in $\{S^1,0\}$, with $S^1$ being the unit sphere.
They are all degree $n$, so I have crudely picked out those $f(x)$ such that the sum of the norms of the roots of $f$ is $\leq n$.
rts = Table[Values[{ToRules[Roots[Part[polys, i] == 0, x]]}], {i, 1, Length[polys]}] rtsAbsSum = Flatten[Table[Sum[Abs[Part[Part[rts, i], j]], {j, 1, Length[Part[rts, i]]}], {i, 1, Length[polys]}]] parts = Select[Range[Length[polys]], Part[rtsAbsSum, #] <= n &] polysIWant = Table[Part[polys, i], {i, parts}] Now the list polysIWant contains the polynomials I want. However, it also contains many false positives.
This code is crude. What its doing:
- Takes each polynomial of
polysand replaces it with a list of its roots (multiplicity not counted.) - Adds together the
Absof the elements of each list. - Finds the polynomials whose sum of root norms is $\leq n$.
Is there an easier way? ie. Instead of summing roots, checking the inequality, etc., how can I write a program that tosses out the polynomials in polys with a root whose norm is neither $0$ nor $1$, and keeps the rest?
rootsthat gets the roots of a polynomial into a list form of consistent dimension, then why not something like:Select[polys, Not[0!=Norm[roots[#]]!=1] &]$\endgroup$