> > 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.
Similarly, i think a coercion from QQbar and polynomials over QQbar to
the Symbolic Ring would be useful. At least it is in my work. What
do you all think? As it stands Sage gives the error below.
Alex
----------------------------------------------------------------------
| Sage Version 3.3, Release Date: 2009-02-21 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: var('t')
t
sage: QQbar(2)*t
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/Users/arai021/<ipython console> in <module>()
/Applications/sage-3.3/local/lib/python2.5/site-packages/sage/
structure/element.so in sage.structure.element.RingElement.__mul__
(sage/structure/element.c:8632)()
/Applications/sage-3.3/local/lib/python2.5/site-packages/sage/
structure/coerce.so in
sage.structure.coerce.CoercionModel_cache_maps.bin_op (sage/structure/
coerce.c:5847)()
TypeError: unsupported operand parent(s) for '*': 'Algebraic Field'
and 'Symbolic Ring'
On Mar 11, 5:01 pm, Robert Bradshaw <[email protected]>
wrote:
> On Mar 10, 2009, at 8:57 PM, Carl Witty wrote:
>
>
>
> > 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.
>
> That may actually already be fixed inhttp://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 [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
-~----------~----~----~----~------~----~------~--~---