On Jul 30, 12:26 pm, "didier deshommes" <[EMAIL PROTECTED]> 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?
>
> 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.

OK, that all makes sense.  I guess I just had a failure of
imagination...in my code (dealing with univariate polynomials), when I
want the coefficients of a polynomial, I expect this coefficient list
(which I extract with list(P)) to have all the information from the
original polynomial, and I couldn't think of any uses for just the non-
zero coefficients.

> Here's a compromise: a paramater, (say all_coefficients) could be
> specified to have an explicit list. Thoughts?

This could be done for degrevlex ordering, but usually not for lex
ordering...you'd need to insert an infinite number of zeroes.
Probably it's best to just go with your original specification.

Carl


--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to