It is a documented feature -- look at the docstring which says
def coefficient(self, degrees):
"""
Return the coefficient of the variables with the degrees
specified in the python dictionary \code{degrees}. Mathematically,
this is the coefficient in the base ring adjoined by the variables
of this ring not listed in \code{degrees}. However, the result
has the same parent as this polynomial.
This function contrasts with the function \code{monomial_coefficient}
which returns the coefficient in the base ring of a monomial.
I do agree that it is a strange design, and would prefer
f.coefficient() to return an element of the base ring.
John
2009/5/7 Soroosh Yazdani <[email protected]>:
> Hi,
>
> this might be a design decision, so I haven't filed a bug report for it yet.
> However, it seems that coefficient is returning the wrong type when it's
> called on multinomials. Here is an example code:
>
> sage: K.<x,y,z>=QQ[]
> sage: f = x^3+y^3+z^3
> sage: f.coefficient([3,0,0]).parent()
> Multivariate Polynomial Ring in x, y, z over Rational Field
>
> It makes more sense for the above return value to be the Rational Field.
> Similarly, f.coefficient([3,None,None]).parent(), should probably return
> "Multivariate Polynomial Ring in x, z over Rational Field".
>
> Should I file a bug for this?
> Soroosh
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---