### 11.1.7 Coefficients of a polynomial

The coeff or coeffs command finds the coefficients of a specific degree of a polynomial.

- coeff takes two mandatory and one optional argument:
  - P, the polynomial.
  - vars, the name of the variable (or the list of the names of variables).
  - Optionally, n, the degree (or the list of the degrees of the variables).
- coeff(P vars⟨,n⟩) returns the nth degree coefficient of P, or if n is not specified, the list of the coefficients of P, including 0 in the univariate dense case and excluding 0 in the multivariate sparse case.

#### Examples

coeff(-x^4+3*x*y^2+x,x,1)

3 y2+1 |  |  |  |  |  |  |  |  |  |

coeff(-x^4+3 x*y^2+x,y,2)

3 x |  |  |  |  |  |  |  |  |  |

coeff(-x^4+3 x*y^2+x,[x,y],[1,2])

3 |  |  |  |  |  |  |  |  |  |