Dear Julian, Thank you very much for your help. It seems like an error to me too. I am using your solution in my code and is working nicely.
Should we report this error in any other place? Thank you again, Rafael On Jul 25, 4:42 pm, Julian Rüth <julian.ru...@gmail.com> wrote: > Apparently, this is caused by a problem in degree() which is used in > polynomial(). In your example: > > sage: pol2.degree(q) > 0 > sage: pol2.degree(p) > 3 > > You get the expected behavior if you bring q into pol2.parent() > explicitly: > > sage: q=pol2.parent()(q) > sage: pol2.degree(q),pol2.polynomial(q) > (3, 4*q^3 + 3*q + 2) > > So, this seems like an error to me. In the implementation of degree() > the line reading > > return singular_polynomial_deg(p, (<MPolynomial_libsingular>x)._poly, r) > > should probably be changed (x is the generator passed to the method). > But maybe somebody who knows more about the singular/sage connection can > say more about this. > > cheers, > julian > > * rafaeldleon <rafaeldl...@gmail.com> [2011-07-25 12:31:29 -0700]: > > > > > > > > > Hello all, > > > I don t know if the following is an error in the implementation of the > > method polynomial > > or if I am using it in a way that is not intended, but it seems that > > the use of the method > > polynomial changes when I am in a polynomial ring with 2 or with 3 > > variables. > > > pol and pol2 are the "same" polynomial in rings with 3 or 2 variables > > resp. and > > the method pol.polynomial(q) and pol2.polynomial(q) return different > > answers. > > > sage: R.<p,q,t>=ZZ[] > > sage: pol=2+3*q+4*q^3;pol > > 4*q^3 + 3*q + 2 > > sage: parent(pol) > > Multivariate Polynomial Ring in p, q, t over Integer Ring > > sage: pol2=pol.polynomial(t).coefficients()[0];pol2 > > 4*q^3 + 3*q + 2 > > sage: parent(pol2) > > Multivariate Polynomial Ring in p, q over Integer Ring > > sage: pol2.polynomial(q) > > 2 > > sage: pol.polynomial(q) > > 4*q^3 + 3*q + 2 > > > Can anyone give me some insight about why I am getting these > > different answers? > > > Thanks! > > > Rafael > > > -- > > To post to this group, send email to sage-support@googlegroups.com > > To unsubscribe from this group, send email to > > sage-support+unsubscr...@googlegroups.com > > For more options, visit this group > > athttp://groups.google.com/group/sage-support > > URL:http://www.sagemath.org -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org