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.Wed, 25 Jul 2018 17:23:16 -0500Elements of the Stanley-Reisner ringhttp://ask.sagemath.org/question/43156/elements-of-the-stanley-reisner-ring/I have a simplicial complex, and I'm trying to manipulate the Stanley-Reisner ring of that simplicial complex. This is just a quotient of a polynomial ring. The generators of the quotient ring are called (according to R.gens()) x0bar, x1bar, x2bar, x3bar. However, when I try to refer to elements of the ring in this way (for example, to create an ideal containing certain elements), I get an error. For example:
sage: X = SimplicialComplex([[1,2,3], [0,2,3], [0,1,3]])
sage: R = X.stanley_reisner_ring()
sage: R(x0bar)
This gives me the following error:
NameError Traceback (most recent call last)
<ipython-input-3-b65205a640d6> in <module>()
----> 1 R(x0bar)
NameError: name 'x0bar' is not defined
Wed, 25 Jul 2018 16:00:44 -0500http://ask.sagemath.org/question/43156/elements-of-the-stanley-reisner-ring/Answer by rburing for <p>I have a simplicial complex, and I'm trying to manipulate the Stanley-Reisner ring of that simplicial complex. This is just a quotient of a polynomial ring. The generators of the quotient ring are called (according to R.gens()) x0bar, x1bar, x2bar, x3bar. However, when I try to refer to elements of the ring in this way (for example, to create an ideal containing certain elements), I get an error. For example:</p>
<pre><code>sage: X = SimplicialComplex([[1,2,3], [0,2,3], [0,1,3]])
sage: R = X.stanley_reisner_ring()
sage: R(x0bar)
</code></pre>
<p>This gives me the following error:</p>
<pre><code>NameError Traceback (most recent call last)
<ipython-input-3-b65205a640d6> in <module>()
----> 1 R(x0bar)
NameError: name 'x0bar' is not defined
</code></pre>
http://ask.sagemath.org/question/43156/elements-of-the-stanley-reisner-ring/?answer=43157#post-id-43157You can define e.g.
xbar = R.gens()
Then `xbar[0]` will be the first generator, namely `x0bar`, etc.
You can also do
R.inject_variables()
which defines the variable `x0bar` to be the corresponding generator (etc.), if you insist.
The first approach seems cleaner to me. The second one could be convenient in an interactive session.Wed, 25 Jul 2018 17:23:16 -0500http://ask.sagemath.org/question/43156/elements-of-the-stanley-reisner-ring/?answer=43157#post-id-43157