ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 07 Nov 2017 12:55:05 +0100how to make an Macaulay matrix from polynoms over GF(2)https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/I have a `PolynomialRing(GF(2),'x1,x2,x3')` and over it two polynomials `x1*x2 + x1*x3 + x1`, `x1+x2+1` and I would like to rewrite it in Macaulay matrix in order `x1x1`, `x1x2`, `x2x2`, `x1x3`, `x2x3`, `x3x3`,`x1`,`x2`,`x3`, absolute term
so it should be
0 1 0 1 0 0 1 0 0 0
0 0 0 0 0 0 1 1 0 1
Is there something in sage ?Sun, 05 Nov 2017 13:57:50 +0100https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/Comment by B r u n o for <p>I have a <code>PolynomialRing(GF(2),'x1,x2,x3')</code> and over it two polynomials <code>x1*x2 + x1*x3 + x1</code>, <code>x1+x2+1</code> and I would like to rewrite it in Macaulay matrix in order <code>x1x1</code>, <code>x1x2</code>, <code>x2x2</code>, <code>x1x3</code>, <code>x2x3</code>, <code>x3x3</code>,<code>x1</code>,<code>x2</code>,<code>x3</code>, absolute term
so it should be </p>
<pre><code>0 1 0 1 0 0 1 0 0 0
0 0 0 0 0 0 1 1 0 1
</code></pre>
<p>Is there something in sage ?</p>
https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/?comment=39398#post-id-39398It seems that the only related function is `R.macaulay_resultant(...)` if `R` is your polynomial ring, that takes a list of $n$ homogeneous polynomials (if $n$ is the number of variable) and computes their Macaulay resultant. You can inspect the code (using for instance `R.macaulay_resultant??`) and copy the parts that are useful for your needs.Mon, 06 Nov 2017 14:12:42 +0100https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/?comment=39398#post-id-39398Answer by dan_fulea for <p>I have a <code>PolynomialRing(GF(2),'x1,x2,x3')</code> and over it two polynomials <code>x1*x2 + x1*x3 + x1</code>, <code>x1+x2+1</code> and I would like to rewrite it in Macaulay matrix in order <code>x1x1</code>, <code>x1x2</code>, <code>x2x2</code>, <code>x1x3</code>, <code>x2x3</code>, <code>x3x3</code>,<code>x1</code>,<code>x2</code>,<code>x3</code>, absolute term
so it should be </p>
<pre><code>0 1 0 1 0 0 1 0 0 0
0 0 0 0 0 0 1 1 0 1
</code></pre>
<p>Is there something in sage ?</p>
https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/?answer=39417#post-id-39417I suppose that the question wants to build the corresponding matrix in the peculiar order of all monomials of degree $\le 2$ given above, that works for all (not so many) possible polynomials of degree $\le 2$ in the given ring. The hint MacCaulay was actively ignored in my following answer / sample code, since i considered the task as a task of identifying coefficients of polynomials.
F = GF(2)
R.<x1,x2,x3> = PolynomialRing( F )
p, q = x1*x2 + x1*x3 + x1, x1 + x2 + 1
degrees = ( (2,0,0),
(1,1,0),
(0,2,0),
(1,0,1),
(0,1,1),
(0,0,2),
(1,0,0),
(0,1,0),
(0,0,1),
(0,0,0), )
d = len(degrees)
print matrix( F, 2, d, [ [ pol.coefficient( dict( zip( (x1,x2,x3) , degtuple ) ) )
for degtuple in degrees ]
for pol in ( p, q ) ] )
This gives:
[0 1 0 1 0 0 1 0 0 0]
[0 0 0 0 0 0 1 1 0 1]
Tue, 07 Nov 2017 12:55:05 +0100https://ask.sagemath.org/question/39392/how-to-make-an-macaulay-matrix-from-polynoms-over-gf2/?answer=39417#post-id-39417