On 5/18/07, David Harvey <[EMAIL PROTECTED]> wrote:
> On May 18, 2007, at 10:43 AM, Michel wrote:
> > Look at
> >
> > sage: Q=FractionField(QQ['x'])
> > sage: x=Q.gen()
> > sage: V=Q['z']
> > sage: z=V.gen()
> > sage: x+z
> > 2*z
> >
> > Any explanations for this?

The attached patch fixes this.  The problem was that the method
for coercing into polynomial rings "if at all possible" didn't handle optimally
the case when the element being coerced in was already in the base
ring of the polynomial ring.  The canonical coercion code, on the other
hand, assumed that this case was handled correctly.

There have recently been a few comments that some abstract
nonsense is going to magically fix coercion in SAGE.  I am pessimistic.
The commutative diagram proposal is going to make
SAGE more powerful, flexible, and *more complicated*.
Automatic coercion in the context of
a complicated system of types is, well, complicated. It takes a lot of work,
examples, debugging, etc., to get it right.   It doesn't matter how
good the design is: when you have hundreds of different rings
and you want to automatically do coercions and arithmetic with them,
there is going to be a lot of nontrivial code that implements said coercions,
and it won't work perfectly the first time.

-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://www.williamstein.org

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---

Attachment: 4432.patch
Description: Binary data

Reply via email to