On Mar 10, 2009, at 8:57 PM, Carl Witty wrote:

> On Mar 10, 6:47 pm, Alex Raichev <tortoise.s...@gmail.com> 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.

That may actually already be fixed in http://trac.sagemath.org/ 
sage_trac/attachment/ticket/5423/trac_5423.patch . (It tests to see  
if there's a coercion from the basering before allowing coercion of  
the polynomial ring.)

- Robert

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

Reply via email to