next | previous | forward | backward | up | top | index | toc | home

coefficient -- coefficient of a monomial

Synopsis

Description

i1 : R = GF(25,Variable=>a)[x,y,z];
i2 : f = ((a+1)*x+a*y+a^2*z)^2

               2                         2                            2
o2 = (- a + 2)x  + (a + 2)x*y + (2a + 1)y  + (- a + 1)x*z - y*z + 2a*z

o2 : R
i3 : coefficient(y^2,f)

o3 = 2a + 1

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

See also