On May 14, 6:40 am, Martin Albrecht <[EMAIL PROTECTED]>
wrote:
> Please excuse my ignorance, but is this definition well known or should it be
> given in the docstring? Also, how did the idea came up that SAGE needs this
> method? I am just curious and trying to learn what people use MPolynomials
> for.

I was confused when I first tried to read that docstring; that's not
what I would have expected "exactly divisible by" to mean.

I used coefficient() in a routine that translates from (for example)
QQ['x','y'] to QQ['x']['y'] (or, actually, QQ['x','y']['y']).  Note
that coefficient() is almost but not quite right for this job: you can
get the coefficient of the y term, the y^2 term, etc., up to
y^(p.degree(y)); but you can't use coefficient() for the y^0 term.

I would be happy to lose the current version of the coefficient()
method in favor of something like:

  p.coefficient(x=3, y=2) would give all monomials in the polynomial
where the exponent of x is 3 and the exponent of y is 2.  You can give
as many or as few keyword/argument pairs as you like; p.coefficient()
is just p.

I'm not sure that's actually a good API; one problem is that you can't
use it if the name of your polynomial variable is a Python keyword.
Thus, with my proposed specification, if you tried to do:
sage: (def_, class_) = QQ['def','class'].gens()
sage: def_.coefficient(def=1)
you would get a syntax error, although you could still do:
sage: def_.coefficient(**{'def': 1})

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