next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: coefficient

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                               
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

See also