On Nov 2, 2006, at 8:28 PM, David Harvey wrote:

> On Nov 2, 2006, at 11:11 PM, Robert Bradshaw 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
>>>
>>> ??
>>>
>>> David
>>
>> Now you could return that as an element of ZZ['x', 'y'], but I'm not
>> sure that would be a good idea. (non-common parents could be good
>> runtime indicators that something could be wrong, and efficiency
>> could really drop...)
>
> Hmmm... it sounds like what you're asking for is the following.
>
> If x is in R, and y is in S, and there is a natural coercion from R
> to T and a natural coercion from S to T, then
>
> sage: x * y
>
> should be smart enough to coerce both into T, and perform the
> multiplication there. (I've left out complications involving scalar
> multiplications...)
>
> Also, I guess you want T to be minimal in some sense.

Yes, that's what I'm saying, though I don't know how feasible it  
would be in general. In terms of scalar multiplications, that's  
actually what my original motivation was.

> 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

Yes, it already goes on with division. I think being inefficient is  
better than throwing an error (and for those interested in speed they  
should be doing everything over the same ring...)

I have to admit that this specific example bothers me...I can see  
where it comes from but I _want_ it to be an element of Univariate  
Polynomial Ring in x over Rational Field, i.e. x/2 = 1/2 * x.

>
> Must sleep now.
>
> David
>
>
> 

--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to