Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

For instance, $f=x^2y^2+1$ is an element of $\mathbb{C}[x,y]$, I want to extract the coefficient of $x^2$, which is $y^2$. However "f.coefficient(x,2)" only works for symbolic expressions, are there similar functions for ring elements?

share|improve this question
    
I don't know anything about Sage, but perhaps you could tell it to find $\dfrac{1}{2}\dfrac{\partial^2 f}{\partial x^2}(0,y)$? –  Jonas Meyer Jun 30 '12 at 7:51
    
By the way, there ask.sagemath.org for sage. In case you have more specific questions in the future. –  Jernej Jun 30 '12 at 8:59
add comment

1 Answer

Simply use f.coefficient(x^2), as in this example:

sage: R.<x,y> = CC[]
sage: f = x^2 *  y^2 + 1
sage: f.coefficient(x^2)
y^2
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.