Robert Bradshaw wrote: > > On Jul 30, 2007, at 12:26 PM, didier deshommes wrote: > >> 2007/7/30, Carl Witty <[EMAIL PROTECTED]>: >>> It seems pretty strange to me, mostly because you lose too much >>> information by eliding zeroes. As far as I can tell, given >>> MPolynomialRing(QQ,2,order='lex'), all of the following polynomials: >>> >>> 3*x^2 + 1 >>> 3*x^5 + x >>> 3*y^7 + 1 >>> 3*y + 1 >>> >>> would have a coefficients() list of [3, 1]. Is that true, and if so, >>> is this really a useful function?
I would think that [3, 1] is the only useful output in all 3 cases. After all, there are infinitely many zeros between the 3 and the 1 in some cases: for example, all the powers of x come between 3*y and 1. So what representation that includes zeros would you use? To keep track of things, you probably want both a function coefficients() that returns [3, 1] and a function monomials() that returns [y, 1]. >> For me it makes sense because I just need a method that iterates over >> the coefficients of a polynomial. Having the ordering respected is a >> little extra that I think helps the user. I could put the zeros in >> there, but her are my own subjective reasons not to: >> - I think of multivariate polynomials as sparse polynomials, so I >> think coefficients() with the 0s omitted is OK. >> - Maple does the same thing :) (I know, I know: not an argument...) >> - Putting these zeros involves generating all the degree exponents, >> which is slower. It can be done, but generating all the coefficients >> this way for something like >> f = x^6*y^12*z^2 >> makes a big list made mostly of zeros. >> >> Here's a compromise: a paramater, (say all_coefficients) could be >> specified to have an explicit list. Thoughts? > > Maybe it should be called coefficient_set to make it clear that the > order does not preserve (much) information. > > > > > --~--~---------~--~----~------------~-------~--~----~ 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://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---