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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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|cite|improve this question

closed as off-topic by Jonas Meyer, John Ma, Claude Leibovici, Macavity, TravisJ Jun 14 '15 at 6:00

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is not about mathematics, within the scope defined in the help center." – Jonas Meyer, Claude Leibovici, Macavity, TravisJ
If this question can be reworded to fit the rules in the help center, please edit the 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 for sage. In case you have more specific questions in the future. – Jernej Jun 30 '12 at 8:59

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)
share|cite|improve this answer

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