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?
In Sage, how to extract coefficient of a polynomial in a ring
1
$\begingroup$
math-software
sagemath
-
0By the way, there http://ask.sagemath.org/ for sage. In case you have more specific questions in the future. – 2012-06-30
1 Answers
4
Simply use f.coefficient(x^2)
, as in this example:
sage: R. = CC[] sage: f = x^2 * y^2 + 1 sage: f.coefficient(x^2) y^2