ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 08 Mar 2018 15:08:21 -0600Examining the quotients of a module $R\times R$ where $R$ is a finite ring.http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.
I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.
I tried to use `M=R^2` and got something that looked promising, but when I tried to use the `quotient_module` method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.
> Can someone recommend an idiomatic way to accomplish the task?
I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.
Here's what I've been trying:
k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.
Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?Wed, 07 Mar 2018 08:28:00 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/Comment by rschwieb for <p>I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.</p>
<p>I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.</p>
<p>I tried to use <code>M=R^2</code> and got something that looked promising, but when I tried to use the <code>quotient_module</code> method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.</p>
<blockquote>
<p>Can someone recommend an idiomatic way to accomplish the task? </p>
</blockquote>
<p>I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.</p>
<p>Here's what I've been trying:</p>
<pre><code>k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
</code></pre>
<p>Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.</p>
<p>Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?</p>
http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41440#post-id-41440@vdelecroix I would be happy to contribute a module to better handle finite rings and their free modules (I am a professional Python programmer), but it will be a while before I understand the conventions in the codebase. Thanks for taking the time to comment.Thu, 08 Mar 2018 09:43:03 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41440#post-id-41440Comment by vdelecroix for <p>I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.</p>
<p>I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.</p>
<p>I tried to use <code>M=R^2</code> and got something that looked promising, but when I tried to use the <code>quotient_module</code> method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.</p>
<blockquote>
<p>Can someone recommend an idiomatic way to accomplish the task? </p>
</blockquote>
<p>I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.</p>
<p>Here's what I've been trying:</p>
<pre><code>k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
</code></pre>
<p>Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.</p>
<p>Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?</p>
http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41431#post-id-41431Indeed, the class `QuotientRing_generic` that is used in your example is not intended to work well in the finite situation. It has be thought with polynomial ring over ZZ or QQ in mind. This is just a lack of interest from the current programmers of Sage. As you might know, Sage is developed by volunteers and any contribution is more than welcome, see [http://doc.sagemath.org/html/en/developer/](http://doc.sagemath.org/html/en/developer/).Thu, 08 Mar 2018 01:54:59 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41431#post-id-41431Comment by rschwieb for <p>I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.</p>
<p>I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.</p>
<p>I tried to use <code>M=R^2</code> and got something that looked promising, but when I tried to use the <code>quotient_module</code> method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.</p>
<blockquote>
<p>Can someone recommend an idiomatic way to accomplish the task? </p>
</blockquote>
<p>I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.</p>
<p>Here's what I've been trying:</p>
<pre><code>k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
</code></pre>
<p>Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.</p>
<p>Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?</p>
http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41428#post-id-41428@vdelecroix I've improved the question with more details, now that I have the thing in front of me.Wed, 07 Mar 2018 17:07:38 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41428#post-id-41428Comment by vdelecroix for <p>I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.</p>
<p>I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.</p>
<p>I tried to use <code>M=R^2</code> and got something that looked promising, but when I tried to use the <code>quotient_module</code> method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.</p>
<blockquote>
<p>Can someone recommend an idiomatic way to accomplish the task? </p>
</blockquote>
<p>I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.</p>
<p>Here's what I've been trying:</p>
<pre><code>k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
</code></pre>
<p>Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.</p>
<p>Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?</p>
http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41424#post-id-41424Indeed it would be helpful to have your example at hand.Wed, 07 Mar 2018 12:59:42 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?comment=41424#post-id-41424Answer by vdelecroix for <p>I'm new to Sage, and I've been struggling to get started with (what I thought) should be a basic construction.</p>
<p>I have an $8$-element commutative ring $R$ which is constructed as a quotient of a polynomial ring in two variables. I need to examine all of the quotient of the right $R$ module $R\times R$.</p>
<p>I tried to use <code>M=R^2</code> and got something that looked promising, but when I tried to use the <code>quotient_module</code> method, I kept getting errors. I saw in the docs for that method that quotient_module isn't fully supported, so I started looking at the CombinatorialFreeModule class too.</p>
<blockquote>
<p>Can someone recommend an idiomatic way to accomplish the task? </p>
</blockquote>
<p>I have been plagued by NotImplemented errors and a myriad of other error messages every step of the way, even when just attempting to find a method to list all elements of my $8$ element ring. All the examples I've seen really look like they stick to basic linear algebra, or free $\mathbb Z$ modules. I just want to do something similar for my small ring of $8$ elements.</p>
<p>Here's what I've been trying:</p>
<pre><code>k # <- (finite field of size 2)
R.<x,y>=PolynomialRing(k)
S = R.quotient([x^2, x*y, y^3])
list(S) # <-- NotImplementedError("object does not support iteration") I noticed it worked for the univariate case though. What's a good way to recover the elements?
M = S^2
v = M.gens()
M.quotient_module([v[0]]) # <- ValueError("unable to compute the row reduced echelon form") TypeError("self must be an integral domain.")
</code></pre>
<p>Had the same problem with a univariate polynomial ring over $F_2$ mod $(x^3)$.</p>
<p>Obviously the messages are informative enough about what they think is wrong. But this seems like such an elementary task... is there some other class that can handle such a construction?</p>
http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?answer=41449#post-id-41449As I already said in my comment, there does not seem to be anything in Sage code. Here is a simple function that can be used as a very naive workaround (and that should work for any finite rings as soon as you have access to a list of generators)
def finite_ring_list(R):
L1 = set(R.gens())
L1.add(R.one())
L1.add(R.zero())
while True:
L2 = set(a*b + c for a in L1 for b in L1 for c in L1)
if len(L1) == len(L2):
return L1
L1 = L2
On your example I got
sage: finite_ring_list(S)
{0,
1,
ybar,
ybar + 1,
xbar,
xbar + 1,
xbar + ybar,
xbar + ybar + 1,
ybar^2,
ybar^2 + 1,
ybar^2 + ybar,
ybar^2 + ybar + 1,
ybar^2 + xbar,
ybar^2 + xbar + 1,
ybar^2 + xbar + ybar,
ybar^2 + xbar + ybar + 1}
My function is too general to be efficient.
In your situation, you have a vector space and there might be some ways to take advantage of it. In particular, you can manually implement an isomorphism between the vector space `GF(2)^4` and your ring and start playing with that.Thu, 08 Mar 2018 15:08:21 -0600http://ask.sagemath.org/question/41421/examining-the-quotients-of-a-module-rtimes-r-where-r-is-a-finite-ring/?answer=41449#post-id-41449