Ask Your Question

Revision history [back]

checking whether the polynomial has a rational root

Hello there,

I have a polynomial $f$ which has all its roots purely imaginary, that is, if $f(z)=0$, then $z=ix$ for some real number $x$. I'm using the following command to check whether all the roots.

f.roots(ring=CC)

Now I define $g(x) = f(ix)$. Then, all the roots of $g(x)$ are real. I want to print only the rational roots of $g$. So I tried:

g.roots(ring=QQ)

But I'm getting the following error:

Unable to coerce I to a rational

How to fix this?

checking whether the polynomial has a rational root

Hello there,

I have a polynomial $f$ which has all its roots purely imaginary, that is, if $f(z)=0$, then $z=ix$ for some real number $x$. I'm using the following command to check whether all the roots.

f.roots(ring=CC)

Now I define $g(x) = f(ix)$. Then, all the roots of $g(x)$ are real. I want to print only the rational roots of $g$. So I tried:

g.roots(ring=QQ)

But I'm getting the following error:

Unable to coerce I to a rational

How to fix this? this?