On Mar 10, 6:47 pm, Alex Raichev <[email protected]> wrote:
> Does anyone know what's up with this weird error?  Sage can multiply a
> symbolic variable and a constant of a polynomial ring R but not a
> symbolic variable and an element of R.base_ring().
>
> Alex
>
> sage: var('t')
> t
> sage: K.<a>= NumberField(t^2+2,'a')
> sage: R.<x>= PolynomialRing(K)
> sage: t*R(a)
> a*t
> sage: t*a
> ---------------------------------------------------------------------------
> TypeError                                 Traceback (most recent call
> last)

Well, I think I can explain what's happening.  There's a coercion from
arbitrary polynomials into the Symbolic Ring; this is useful, because
it lets you deal with polynomials over the rationals, etc.  There's no
coercion from number fields into the Symbolic Ring, because the
Symbolic Ring can't do anything useful with them.

When you do t*R(a), that's exactly equivalent to var('a,t'); t*a.  The
fact that a is a number field generator is lost, and it just becomes a
symbolic variable.  (In particular, you'll notice that t*R(a)^2
doesn't reduce the a^2.)

Since t*R(a) is so useless, it would be better if it didn't work; I'm
not sure how hard it would be to change the coercion setup there,
though.

Carl
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to