Nils Bruin wrote:
> -1. While I agree that defaulting to matrices over QQ rather than over
> ZZ would lead to more expected behaviour for most users, I don't see
> how the rule for changing the base ring can be made both consistent
> and cheap.
> 
> Imagine R1 = QQ[x,y]/(x^2+y^2-1). Then FieldOfFractions(R1) is well-
> defined, so one would expect that
> matrix([x]) would be over the field of fractions.
> 
> If R2=Q[x,y]/( x^2-y^2), FieldOfFractions(R2) does not exist. Deciding
> whether FieldOfFractions(Ri) exists is a fairly expensive operation in
> these cases.


Good points.  In the current case, I don't think the speed issues affect 
us because apparently sage can't create the field of fractions of the 
first case, unless I'm doing this wrong:


sage: R.<x,y>=QQ['x','y']
sage: Frac(R.quo(x^2+y^2-1))
---------------------------------------------------------------------------
<type 'exceptions.NotImplementedError'>   Traceback (most recent call last)

/home/grout/<ipython console> in <module>()

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/fraction_field.py 
in FractionField(R, names)
     104     if not ring.is_Ring(R):
     105         raise TypeError, "R must be a ring"
--> 106     if not R.is_integral_domain():
     107         raise TypeError, "R must be an integral domain."
     108     return R.fraction_field()

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/quotient_ring.py 
in is_integral_domain(self)
     351
     352         """
--> 353         return self.defining_ideal().is_prime()
     354
     355     def cover_ring(self):

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/ideal.py 
in is_prime(self)
     402             NotImplementedError
     403         """
--> 404         raise NotImplementedError
     405
     406     def is_principal(self):

<type 'exceptions.NotImplementedError'>:
sage: Frac(R.quo(x^2-y^2))
---------------------------------------------------------------------------
<type 'exceptions.NotImplementedError'>   Traceback (most recent call last)

/home/grout/<ipython console> in <module>()

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/fraction_field.py 
in FractionField(R, names)
     104     if not ring.is_Ring(R):
     105         raise TypeError, "R must be a ring"
--> 106     if not R.is_integral_domain():
     107         raise TypeError, "R must be an integral domain."
     108     return R.fraction_field()

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/quotient_ring.py 
in is_integral_domain(self)
     351
     352         """
--> 353         return self.defining_ideal().is_prime()
     354
     355     def cover_ring(self):

/home/grout/sage/local/lib/python2.5/site-packages/sage/rings/ideal.py 
in is_prime(self)
     402             NotImplementedError
     403         """
--> 404         raise NotImplementedError
     405
     406     def is_principal(self):

<type 'exceptions.NotImplementedError'>:



Of course, we shouldn't rely on Sage not having functionality 
(especially if we point it out the lack of said functionality, as it is 
quite likely to be fixed soon!).

If it is too expensive in general, then maybe we can just special-case 
the ZZ->QQ conversion.  My guess is that this would take care of most 
common scenarios.

Is that special case what you are referring to below?


> 
> I think special-casing matrix([ZZ(1)]) etc. is a bad idea. You would
> need a method R.has_an_obvious_field_of_fractions() on rings to both
> deal with ZZ and avoid expensive operations for R1 and R2 above.
> --~--~---------~--~----~------------~-------~--~----~


Thanks,

Jason


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

Reply via email to