On 7/3/11 8:44 PM, robin hankin wrote:
Hi.

thank you for this.

OK, so it's "promoting" the coefficients to a more general set?

Where would a sage newcomer like me find documentation for this?

* http://wiki.sagemath.org/coercion

* http://www.sagemath.org/doc/reference/sage/structure/coerce.html

* http://sagemath.blogspot.com/2010/11/brief-history-and-motivation-behind.html

* http://www.youtube.com/watch?v=a3_fEXAXq9o


cheers

Robin


On Mon, Jul 4, 2011 at 3:25 PM, D. S. McNeil<dsm...@gmail.com>  wrote:
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 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




--
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

Reply via email to