Read-only forum archive

Moving a polynomial from one ring to another

Moving a polynomial from one ring to another

alec · Fri May 01, 2020 1:00 pm

I'd like to find the number of real roots of a polynomial f obtained as a resultant using mp_res_mat(). To do this, I write:
LIB "solve.lib";
LIB "rootsur.lib";
ring r = (0,x),(y),dp;
poly p1 = 2*(1+x^2)^2*(1+y^2)*(x^5-x+y)-y^4*x*(1+y^2)-2*x^3*(1+x^2)^2;
poly p2 = 2*(1+y^2)^2*(1+x^2)*(y^5-y-x)-x^4*y*(1+x^2)-2*y^3*(1+y^2)^2;
ideal i = p1,p2;
poly f = det(mp_res_mat(i));

I would now like to invoke nrroots(f), but x is a parameter in the ring r, not a variable, so this doesn't work. How can I take f to a new ring s = 0,x,dp and then invoke nrroots(f)?

Thanks in advance! :)

Re: Moving a polynomial from one ring to another

hannes · Tue May 05, 2020 2:56 pm

Use imap:
imap maps variables and paramaters of the source ring to the variables and paramters with the same name in the current ring.

Re: Moving a polynomial from one ring to another

alec · Tue May 05, 2020 8:18 pm

Perfect! Thank you, I'm very grateful for your help.