Macaulay2 » Documentation
Packages » Macaulay2Doc :: coefficients
next | previous | forward | backward | up | index | toc

coefficients -- monomials and their coefficients

Synopsis

Description

i1 : R = QQ[a,b,c,d,e,f][x,y];
i2 : F = a*x^2+b*x*y+c*y^2

        2              2
o2 = a*x  + b*x*y + c*y

o2 : R
i3 : (M,C) = coefficients F

o3 = (| x2 xy y2 |, {2, 0} | a |)
                    {2, 0} | b |
                    {2, 0} | c |

o3 : Sequence
The resulting matrices have the following property.
i4 : M*C === matrix F

o4 = true
The Sylvester matrix of two generic quadratic forms:
i5 : G = d*x^2+e*x*y+f*y^2

        2              2
o5 = d*x  + e*x*y + f*y

o5 : R
i6 : P = matrix{{x*F,y*F,x*G,y*G}}

o6 = | ax3+bx2y+cxy2 ax2y+bxy2+cy3 dx3+ex2y+fxy2 dx2y+exy2+fy3 |

             1      4
o6 : Matrix R  <-- R
i7 : (M,C) = coefficients P

o7 = (| x3 x2y xy2 y3 |, {3, 0} | a 0 d 0 |)
                         {3, 0} | b a e d |
                         {3, 0} | c b f e |
                         {3, 0} | 0 c 0 f |

o7 : Sequence
i8 : M*C === P

o8 = true
We may give the monomials directly. This is useful if we are taking coefficients of several elements or matrices, and need a consistent choice of monomials.
i9 : (M,C) = coefficients(P, Monomials=>{x^3,y^3,x^2*y,x*y^2})

o9 = (| x3 y3 x2y xy2 |, {3, 0} | a 0 d 0 |)
                         {3, 0} | 0 c 0 f |
                         {3, 0} | b a e d |
                         {3, 0} | c b f e |

o9 : Sequence
If not all of the monomials are used, no error is signaled, but M*C == P no longer holds.
i10 : (M,C) = coefficients(P, Monomials=>{x^3,y^3})

o10 = (| x3 y3 |, {3, 0} | a 0 d 0 |)
                  {3, 0} | 0 c 0 f |

o10 : Sequence
i11 : M*C == P

o11 = false

See also

Ways to use coefficients :

For the programmer

The object coefficients is a method function with options.