There are 3 conventions for the degree of the 0 polynomial, none of which is 0:
(1) None (a bit lazy and hard to work with in most non-python languages) (2) -1 (rather arbitrary, I think, it just has the useful property of being strictly less than any other degree) (3) -Infinity (less arbitrary, also less then any other degree, makes formulas like deg(fg)=deg(f)+deg(g) work in all cases, and fits in best with more highbrow concepts such as valuations). So I would choose -Infinity (since we can!), though I bet there will be dissenters.... John 2009/5/22 <simon.k...@uni-jena.de>: > > 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 > > 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. > > Cheers, > Simon > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---