2007/10/12, Joel B. Mohler <[EMAIL PROTECTED]>:
>
> 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

+1.

Interestingly enough, Maple has the same limitation when you pass the
exponent to it directly:
> coeff(f,y^0);
Error, invalid input: coeff received 1, which is not valid for its 2nd
argument, x

But:
> coeff(f,y,0);
                                              x + 1

returns the right answer

Actually I like Maple's notation better here over the dictionary
notation you proposed: it is as intuitive and I have to type less
curly braces to get the same result :)

didier

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to