This e-mail is too long.  Here's the bottom line:  I suggest that the 
coefficient method on a multivariate polynomial ring take a dictionary 
indicating the variables and degrees that you want to restrict your attention 
to.

It seems that the multivariate polynomial coefficient function is a bit 
inflexible (and inconsistent).  I'm looking for some insight about how to 
think about the following things.

sage: P.<x,y>=ZZ[]
sage: f=x*y^2+x*y+y+x+1
sage: f.coefficient(y^2)
x
sage: f.coefficient(y^1)
x + 1
sage: f.coefficient(y^0)
1

I realize that y^0 == 1 so that the last line is returning the constant 
coefficient (and the implication that y is special to me the user is totally 
unseen by the coefficient method).  But, the logic seems a bit inconsistent.  
I'd suggest that this next line work:

sage: f.coefficient({y:0})
x + 1

Does anyone have any objection?  It actually seems like a dictionary of 
variables whose exponents you want to control would make a much better 
interface to this.  In any case, we can maintain both functionalities by 
checking the type of the parameter.

And another:

sage: P.<x,y>=QQ[]  # DIFFERENT BASE RING THAN LAST TIME
sage: f=x*y^2+x*y+y+x+1
sage: f.coefficient(y^0)  # DIFFERENT OUTPUT
x*y^2 + x*y + x + y + 1

What in the world is going on in that last line?  (Hmm, I think that it is 
getting a 1 so it is thinking that no variables are restricted -- that's 
actually consistent, but seems mighty strange.)

Does anyone else agree?  Or, have a better suggestion?

--
Joel

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