On Friday 22 May 2009, simon.k...@uni-jena.de wrote: > Hi, > > On 22 Mai, 02:29, Kwankyu <ekwan...@gmail.com> wrote: > ... > > > This seems to me a bug. Isn't it? I am using Sage 3.4.2. > > Or at least: It is a very nasty inconsistency -- and note that the > inconsistent behaviour apparently is intended. > At least, it is doc tested: > In the univariate case, we have the doc test > sage: R.<x> = QQ[] > sage: R(0).degree() > -1 > and in the multivariate case, we have the doc test > sage: P.<x, y> = QQ[] > sage: P(0).degree(x) > 0 > sage: P(1).degree(x) > 0
This is just me being stupid (or at least I was stupid when I wrote this). It should definitely be -1. Note that I hardcoded the zero: if self._poly == NULL: return 0 I'll open a ticket and provide a fix. > I think that it is quite usual to say that the zero polynomial has > *no* degree, while all other constant polynomials have degree 0. And > "no degree" is often accomplished by returning -1. This is done, e.g., > > in Singular: > > ring R = 0, (x,y), dp; > > deg(0); > > -1 > > My vote: > +1 for -1 > > > While we are at it: > sage: Q=singular.ring(0,'(x,y)','dp') > sage: Q(0) > -> boom > > I think the __call__ method of *all* rings (including those rings > defined via some interface) should do essentially the same: Try to > interprete the arguments as a ring element. We just don't have any special code for Singular rings so all that is needed is a patch which adds it ;) Martin -- name: Martin Albrecht _pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF _www: http://www.informatik.uni-bremen.de/~malb _jab: martinralbre...@jabber.ccc.de --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---