On Thu, 02 Nov 2006 20:06:34 -0800, David Harvey <[EMAIL PROTECTED]> wrote: > This is much harder. I agree it would be nice, but how would you > handle something like > > sage: R.<x> = ZZ["x"] > sage: S.<y> = ZZ["y"] > sage: x*y
The result would be in either ZZ['x,y'] or ZZ['y,x'], or even jn the noncommutative ring FreeAlgebra(ZZ,2,'x,y'), These are three different rings in SAGE, and the produce makes sense naturally in all three. The problem with chosing a ring for the product of two elements, when it isn't either parent is that the choice is way too arbitrary. Even in mathematics this would be very confusing. If I defined two polynomial rings R = ZZ[x] and S = ZZ[y] in a math paper and considered f = x^2 + y^3 - 1, you might complain. And if I wrote g = x*y - y*x, you would probably complain even more. Robert said: > Right now something like > sage: R.<x> = ZZ['x'] > sage: (1/2) * (x^2-x) > throws an "unable to find a common parent" type error. I am wondering if > there are any (many) other cases where there is an unambiguous common > parent that is not the parent of either "sibling." I think I've been refusing to think about this problem in order to have a coercion system that can be understand and 100% remembered by mere mortals. For the record, the latest version of MAGMA also doesn't do anything with the above: sage: magma.eval('R<x> := PolynomialRing(Integers());') '' sage: magma.eval('(1/2)*(x^2 + 1)') error... >> (1/2)*(x^2 + 1); ^ Runtime error in '*': Bad argument types Argument types given: FldRatElt, RngUPolElt[RngInt] --- Even if we do decide to define (1/2) * (x^2-2), the definition could be ambiguous in that it could depend on time. E.g., today the best choice for the product is QQ[x]. But in a month maybe somebody will implement ZZ[1/2] and the best choice becomes (ZZ[1/2])[x]. So it's a slippery slope. With the coercion rules we've agreed on so far, things on much clearer. > Also, I guess you want T to be minimal in some sense. Except that there is no good notation of minimality on the set of all rings. There are lots of minimal rings containing any two rings, especially if you allow non-commutative rings, which we certainly should do. > One thing I definitely don't like about this is that the multiplication > operator has to conjure up a whole new ring. But I guess this already > happens for things like this: > sage: R.<x> = PolynomialRing(ZZ) > sage: (x/2).parent() > Fraction Field of Univariate Polynomial Ring in x over Integer Ring Divides is a constructor for elements of the fraction field of the unique canonical ring associated to the numerator and denominator, and Frac(R) is well defined. -- William --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---