So, I think I was the one to rework infinity most recently. I don't really have time today to expand at length on the issues you brought up, but I agree with them to some extent. I will note that a coercion is "a natural map into the object," which is why your first example failed, but the __call__ in the second example asks to "create an element of the infinity ring if at all possible", which is why the second does work.
It is possible to have an algebraic infinity in the case of an arbitrary field k by looking defining P^1(k), though of course this isn't an ordered field (it's actually not even a field at all!). Anyway, I'd be happy to help think about ways to make infinity in Sage more mathematically rigorous while keeping it useful. But this evening I have a take home final to finish. :-) David On Tue, May 13, 2008 at 3:23 PM, John H Palmieri <[EMAIL PROTECTED]> wrote: > > I've been looking at some of the trac tickets. Two of them caught my > eye, and I'm curious about them: > > http://trac.sagemath.org/sage_trac/ticket/2515 > > http://trac.sagemath.org/sage_trac/ticket/1915 > > Both of them deal with Infinity. In the first one, someone suggests > doing away with ExtendedRationalField and ExtendedIntegerRing, because > Infinity should be handled by the code in sage.rings/infinity.py. In > the second one, it is pointed out that evaluating 1/Infinity yields > "Zero" in the "infinity ring", whereas maybe it should yield the > element 0 in some "numeric domain". > > The documentation in infinity.py says that in the infinity ring > > > The rules for arithmetic are that the unsigned infinity ring does not > canonically > > coerce to any other ring, and all other rings canonically coerce to > > the unsigned infinity ring, sending all elements to the single element > > ``a number less than infinity'' of the unsigned infinity ring. > > I have two issues with this: first, things don't quite behave as > expected: > > sage: a=GF(2)(1) > sage: a/Infinity # expect this to give Zero, or maybe "A number less > than infinity" > Traceback (click to the left for traceback) > ... > TypeError: unsupported operand parent(s) for '/': 'Finite Field of > size > 2' and 'The Infinity Ring' > > However, this does work: > > sage: UnsignedInfinityRing(a) > A number less than infinity > > Second, I disagree with the mathematics described in the documentation > (and I agree more or less with the first aspect above of Sage's > behavior): I don't think there is any good notion of infinity > associated to, say, a finite field. I object to elements of a finite > field being coerced to something *less* than infinity, since there is > no intrinsic ordering on them. I also object to elements of, say, a > finite field of order 4, or a polynomial ring, being coerced to > something called "a number". Thus I'm happy with a/Infinity being > undefined if a is an element of GF(2). > > I don't know anything about coercion, so I don't know if this makes > sense, but it seems to me that any ring R could have a method > R.has_infinity() (or R.is_extended() or something like that), which is > True if there is a good notion of infinity associated to that ring, > False otherwise. Then if R.has_infinity() is True and if > r is an element of R, evaluating r / Infinity would yield the zero > element of R. Other arithmetic, like r * Infinity, would coerce to > Infinity in the unsigned infinity ring. You could also have > R.has_signed_infinity(). > For example, if R is the complex numbers, then R.has_infinity() would > be True but R.has_signed_infinity() would be false, while if R is the > integers, then R.has_signed_infinity() would be True. Having this in > place would let you replace some of the coercion code for the > InfinityRing_class, say converting > > elif isinstance(x, (sage.rings.integer.Integer, > sage.rings.rational.Rational, > sage.rings.real_double.RealDoubleElement, > sage.rings.real_mpfr.RealNumber)) or isinstance(x, (int,long,float)) > > into something like > > elif x.parent().has_signed_infinity() or isinstance(x, > (int,long,float)): > > Among my many questions about this: > > 1. Does this make any sense? > 1a. If so, is it feasible to implement? > > 2. Why does Sage behave the way it does with > a=GF(2)(1); a/Infinity > > I guess the issue is that Infinity is an element of InfinityRing, not > UnsignedInfinityRing, and there is no coercion taking place. Doing 'a/ > UnsignedInfinityRing(Infinity)' returns 'A number less than infinity', > though. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---