[sage-devel] Re: I > 0 is true
comparing I>0 you could coerce 0 to complex and then use some ordering imposed on some measure of complex, like abs(). To halt a computation as meaningless might not be the most useful default. Example for this guy... A converging iteration x[i] that is halted when sqrt(x[i])< 1.0e-16. As a result of a rounding error, x[i] comes out very slightly negative. Bam, error. [yes,it would be better to compute abs(x[i])< 1.0e-8.. here. but you get the idea.] On Saturday, October 17, 2015 at 6:10:38 AM UTC-7, mmarco wrote: > > >> It certainly is an ordering. Does Python assume that an ordering for >> instances of a type is compatible with the algebraic structure that this >> type represents? I guess not. >> >> > We certainly don't always assume that the ordering is compatible with the > algebraic structure: > > sage: F = Zmod(6) > sage: a = F(4) > sage: b = F(2) > sage: a < b > False > sage: a > b > True > sage: (a+2) > (b+2) > False > sage: (a+2) < (b+2) > True > > > Even if it is not compatible with the algebraic structure, this particular > ordering seems quite natural to me. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
> > > It certainly is an ordering. Does Python assume that an ordering for > instances of a type is compatible with the algebraic structure that this > type represents? I guess not. > > We certainly don't always assume that the ordering is compatible with the algebraic structure: sage: F = Zmod(6) sage: a = F(4) sage: b = F(2) sage: a < b False sage: a > b True sage: (a+2) > (b+2) False sage: (a+2) < (b+2) True Even if it is not compatible with the algebraic structure, this particular ordering seems quite natural to me. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
Hi Volker, On 2015-10-17, Volker Braun wrote: > We could let comparison raise and include sort key functions of interest, > e.g. > > sage: sorted([CC(0,1), CC(1,0)], key=CC.key.lexicographic) Yes, that makes much sense to me: If there is no inherent ordering, then better be explicit. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
We could let comparison raise and include sort key functions of interest, e.g. sage: sorted([CC(0,1), CC(1,0)], key=CC.key.lexicographic) On Saturday, October 17, 2015 at 2:00:39 PM UTC+2, Simon King wrote: > > >>> L = [complex(0,1), complex(1,0),0] > >>> L.sort() > Traceback (most recent call last): > File "", line 1, in > TypeError: unorderable types: complex() < complex() > > I don't like that behaviour. Very often, it is possible to order things > conveniently, even when the ordering isn't compatible with algebraic > operations. Sorting a list should work in that situation. I believe Sage > should NOT follow Python3 in that regard. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
>From the point of view of teaching maths with sage, I would prefer I not to be comparable with 0. IMHO, these discussions of what is nicer for those programming should be set behind what the average mathematician expects sage to do. By the way, I still object to the idea that I is by default a symbolic expression in sage, see ticket http://trac.sagemath.org/ticket/18036. As I^2 is currently not an integer. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
On Saturday, October 17, 2015 at 1:39:17 PM UTC+2, Simon King wrote: > > Would it be feasible to distinguish < and cmp at that point? That distinction is gone in Python 3, so we certainly shouldn't rely on that kind of hack. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
On 2015-10-17, Simon King wrote: > PS: > > On 2015-10-17, Simon King wrote: >> It certainly is an ordering. Does Python assume that an ordering for >> instances of a type is compatible with the algebraic structure that this >> type represents? I guess not. > > As was pointed out, Python3 does take care about the fact that the > complex field is not an ordered field. So, what does Python3 do if one > tries to sort a list of complex numbers? Ouch. >>> L = [complex(0,1), complex(1,0),0] >>> L.sort() Traceback (most recent call last): File "", line 1, in TypeError: unorderable types: complex() < complex() I don't like that behaviour. Very often, it is possible to order things conveniently, even when the ordering isn't compatible with algebraic operations. Sorting a list should work in that situation. I believe Sage should NOT follow Python3 in that regard. Best regards, Simon -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
PS: On 2015-10-17, Simon King wrote: > It certainly is an ordering. Does Python assume that an ordering for > instances of a type is compatible with the algebraic structure that this > type represents? I guess not. As was pointed out, Python3 does take care about the fact that the complex field is not an ordered field. So, what does Python3 do if one tries to sort a list of complex numbers? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
Hi! On 2015-10-17, mmarco wrote: > Maybe the lexicographic order is not very sensible in an algebraic setting, > but it makes perfect sense from a geometrical point of view. It certainly is an ordering. Does Python assume that an ordering for instances of a type is compatible with the algebraic structure that this type represents? I guess not. The question from my perspective is: Should Sage take care that an ordering for elements of a parent is compatible with the algebraic structure of the parent? To some extent, we do already: Before xhttp://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] Re: I > 0 is true
On Friday, October 16, 2015 at 4:52:20 PM UTC+2, Daniel Krenn wrote: > > sage: bool(I>0) > True > > Is there a ticket for this on trac? > http://trac.sagemath.org/ticket/17700 which practically depends on http://trac.sagemath.org/ticket/19312 Note that with the latter comes ex.holds() so you could in the future get an exception from bool(I>0) but the result Undefined/Undecidable from (I>0).holds() Also, this has nothing to do with CC because sage: type(I) Best, -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.