Is there any reason x shouldn't be initially assigned to belong to ZZ [x], given that coercion happens naturally to QQ[x] if any of the coefficients are rational?
On Jan 21, 2007, at 4:37 PM, Timothy Clemans wrote: > ---------- Forwarded message ---------- > From: Bobby Moretti <[EMAIL PROTECTED]> > Date: Jan 21, 2007 3:59 PM > Subject: Re: [sage-devel] factor(n) reducing some polynomials over > the rationals > To: [EMAIL PROTECTED] > > > The indeterminate 'x', predefined as a polynomial ring element, gets > imported automatically: > > > ---------------------------------------------------------------------- > | SAGE Version 1.7.1, Release Date: 2007-01-18 | > | Type notebook() for the GUI, and license() for information. | > ---------------------------------------------------------------------- > Loading SAGE library. Current Mercurial branch is: calc > > sage: type(x) > <class 'sage.rings.polynomial_element.Polynomial_rational_dense'> > > So if you define any polynomials in terms of arithmetic with x, it > will assume that your polynomial is over the rationals. > > If you want a polynomial over the integers, you have to specify this > ring manually. If you do > > g.<x> = PolynomialRing(ZZ) > > Then it overloads x, and x becomes an indeterminate for polynomials > over the integers. > > sage: g.<x> = PolynomialRing(ZZ) > sage: type(x) > <class 'sage.rings.polynomial_element.Polynomial_integer_dense'> > sage: factor(2*x^2+1) > 2*x^2 + 1 > > > On 1/21/07, Timothy Clemans <[EMAIL PROTECTED]> wrote: >> >> "sage: factor(n)" should only reduce input over the integers. >> >> sage: factor(2*x^2 + x + 1) >> (2) * (x^2 + 1/2*x + 1/2) >> sage: factor(2*x^2 + x + 2) >> (2) * (x^2 + 1/2*x + 1) >> sage: factor(2*x^2 + x + 3) >> (2) * (x^2 + 1/2*x + 3/2) >> sage: factor(2*x^2 + x + 4) >> (2) * (x^2 + 1/2*x + 2) >> >> Is there a function in SAGE or one of the components that reduces >> polynomials only over the integers? >> >> >>> >> > > > > -- > Bobby Moretti > [EMAIL PROTECTED] > > --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---
