<?xml version="1.0" encoding="utf-8" ?> <!-- for emacs: -*- coding: utf-8 -*- --> <!-- Apache may like this line in the file .htaccess: AddCharset utf-8 .html --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg-flat.dtd" > <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head><title>coefficients -- monomials and their coefficients</title> <link rel="stylesheet" type="text/css" href="../../../../Macaulay2/Style/doc.css"/> </head> <body> <table class="buttons"> <tr> <td><div><a href="_coefficients_lp..._cm_sp__Monomials_sp_eq_gt_sp..._rp.html">next</a> | <a href="_coefficient__Ring.html">previous</a> | <a href="_coefficients_lp..._cm_sp__Monomials_sp_eq_gt_sp..._rp.html">forward</a> | <a href="_coefficient__Ring.html">backward</a> | up | <a href="index.html">top</a> | <a href="master.html">index</a> | <a href="toc.html">toc</a> | <a href="http://www.math.uiuc.edu/Macaulay2/">Macaulay2 web site</a></div> </td> </tr> </table> <hr/> <div><h1>coefficients -- monomials and their coefficients</h1> <div class="single"><h2>Synopsis</h2> <ul><li><div class="list"><dl class="element"><dt class="heading">Usage: </dt><dd class="value"><div><tt>(monoms,coeffs) = coefficients(f,Variables=>v,Monomials=>m)</tt></div> </dd></dl> </div> </li> <li><div class="single">Inputs:<ul><li><span><tt>f</tt>, either a one row <a href="___Matrix.html" title="the class of all matrices">Matrix</a> or a <a href="___Ring__Element.html" title="the class of all ring elements handled by the engine">RingElement</a></span></li> <li><span><tt>v</tt>, <span>a <a href="___List.html">list</a></span>, of variables</span></li> <li><span><tt>m</tt>, either a list of monomials, or a one row matrix of monomials</span></li> </ul> </div> </li> <li><div class="single">Outputs:<ul><li><span><tt>monoms</tt>, <span>a <a href="___Matrix.html">matrix</a></span>, a one row matrix of the monomials appearing in <tt>f</tt></span></li> <li><span><tt>coeffs</tt>, <span>a <a href="___Matrix.html">matrix</a></span>, a matrix with the coefficients of <tt>monoms</tt> appearing in <tt>f</tt></span></li> </ul> </div> </li> <li><div class="single"><a href="_using_spfunctions_spwith_spoptional_spinputs.html">Optional inputs</a>:<ul><li><span><a href="_coefficients_lp..._cm_sp__Monomials_sp_eq_gt_sp..._rp.html">Monomials => ...</a>, -- specify monomials</span></li> <li><span><a href="_coefficients_lp..._cm_sp__Variables_sp_eq_gt_sp..._rp.html">Variables => ...</a>, -- take coefficients using these variables</span></li> </ul> </div> </li> </ul> </div> <div class="single"><h2>Description</h2> <div>If the optional argument <tt>Variables=>v</tt> is given, then the monomials will only involve these variables, and the coefficients will involve only the other variables.<p/> If the optional argument <tt>Monomials=>m</tt> is not given, then the set of monomials appearing in <tt>f</tt> is calculated using <a href="_monomials.html" title="matrix of monomials in a ring element or matrix">monomials</a>.<table class="examples"><tr><td><pre>i1 : R = QQ[x,y,a,b,c,d,e,f];</pre> </td></tr> <tr><td><pre>i2 : F = a*x^2+b*x*y+c*y^2 2 2 o2 = x a + x*y*b + y c o2 : R</pre> </td></tr> <tr><td><pre>i3 : (M,C) = coefficients(F, Variables=>{x,y}) o3 = (| x2 xy y2 |, {2} | a |) {2} | b | {2} | c | o3 : Sequence</pre> </td></tr> </table> The resulting matrices have the following property.<table class="examples"><tr><td><pre>i4 : M*C == matrix{{F}} o4 = true</pre> </td></tr> </table> <p/> The Sylvester matrix of two generic quadratic forms.<table class="examples"><tr><td><pre>i5 : G = d*x^2+e*x*y+f*y^2 2 2 o5 = x d + x*y*e + y f o5 : R</pre> </td></tr> <tr><td><pre>i6 : P = matrix{{x*F,y*F,x*G,y*G}} o6 = | x3a+x2yb+xy2c x2ya+xy2b+y3c x3d+x2ye+xy2f x2yd+xy2e+y3f | 1 4 o6 : Matrix R <--- R</pre> </td></tr> <tr><td><pre>i7 : (M,C) = coefficients(P, Variables=>{x,y}) o7 = (| x3 x2y xy2 y3 |, {3} | a 0 d 0 |) {3} | b a e d | {3} | c b f e | {3} | 0 c 0 f | o7 : Sequence</pre> </td></tr> <tr><td><pre>i8 : M*C == P o8 = true</pre> </td></tr> </table> 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.<table class="examples"><tr><td><pre>i9 : (M,C) = coefficients(P, Variables=>{x,y}, Monomials=>{x^3,y^3,x^2*y,x*y^2}) o9 = (| x3 y3 x2y xy2 |, {3} | a 0 d 0 |) {3} | 0 c 0 f | {3} | b a e d | {3} | c b f e | o9 : Sequence</pre> </td></tr> </table> If not all of the monomials are used, then <tt>M*C == P</tt> no longer holds.<table class="examples"><tr><td><pre>i10 : (M,C) = coefficients(P, Variables=>{x,y}, Monomials=>{x^3,y^3}) o10 = (| x3 y3 |, {3} | a 0 d 0 |) {3} | 0 c 0 f | o10 : Sequence</pre> </td></tr> <tr><td><pre>i11 : M*C == P o11 = false</pre> </td></tr> </table> </div> </div> <div class="single"><h2>Caveat</h2> <div>Currently, the matrix <tt>f</tt> must have only one row. This restriction will hopefully be lifted in the future.</div> </div> <div class="single"><h2>See also</h2> <ul><li><span><a href="_monomials.html" title="matrix of monomials in a ring element or matrix">monomials</a> -- matrix of monomials in a ring element or matrix</span></li> </ul> </div> <div class="waystouse"><h2>Ways to use <tt>coefficients</tt> :</h2> <ul><li>coefficients(Matrix)</li> <li>coefficients(RingElement)</li> </ul> </div> </div> </body> </html>