# coefficient -- coefficient of a monomial

## Synopsis

• Usage:
coefficient(m,f)
• Inputs:
• m, , a monomial
• f, , in the same ring R as m
• Outputs:
• , the coefficient of the monomial m in f as an element of the coefficient ring of R

## Description

 i1 : R = GF(25,Variable=>a)[x,y,z]; i2 : f = ((a+1)*x+a*y+a^2*z)^2 2 2 o2 = (- 2a - 1)x + (- a + 1)x*y + (a - 2)y + 2x*z + (- 2a + 1)y*z + (2a + ------------------------------------------------------------------------ 2 2)z o2 : R i3 : coefficient(y^2,f) o3 = a - 2 o3 : GF 25
The returned value is an element of the coefficient ring, even in the case when that ring is another polynomial ring.
 i4 : S = R[r,s,t]; i5 : coefficient(r,a*x*(r+a*s)) o5 = a*x o5 : R