> My understanding was that 'x' was the indeterminate
> of the ring of polynomials over QQ, i.e. the rationals.  So how come
> the polynomial
> has coefficients which are not rational?

Because the polynomial isn't living where you think it does anymore:

sage: R.<x> = QQ['x']
sage: R
Univariate Polynomial Ring in x over Rational Field
sage: parent(x)
Univariate Polynomial Ring in x over Rational Field
sage:
sage: f = (x-sqrt(2))*(x+sqrt(2))
sage: f
(x - sqrt(2))*(x + sqrt(2))
sage: parent(f)
Symbolic Ring
sage: R(f)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[...]
TypeError: unable to convert -sqrt(2) to a rational
sage: R(expand(f))
x^2 - 2

In this case, the introduction of the sqrt terms pushed the expression
out of R and into SR.  We can convert back, but only if the expression
is in a form that Sage can recognize as belonging to R.


Doug

-- 
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-support
URL: http://www.sagemath.org

Reply via email to