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.Thu, 13 Aug 2020 10:55:15 +0200How to make Sage know that a set is an idealhttps://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/I have constructed the following ideal
J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
in the ring
$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$
where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing
B = J.groebner_basis(),
but Sage returns
TypeError: R must be a commutative ring.
This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!
I must first construct the ideal
H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
and then compute
B = H.groebner_basis().
That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!
Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?Wed, 12 Aug 2020 13:02:53 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52968#post-id-52968I have updatet the question because it contained some syntax errorsWed, 12 Aug 2020 16:23:31 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52968#post-id-52968Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52969#post-id-52969The computation
B=H.groebner_basis()
answers my preeceding question "Does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?". The answer is "YES".Wed, 12 Aug 2020 16:35:10 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52969#post-id-52969Comment by slelievre for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52975#post-id-52975Please provide enough code for anyone to reproduce in a fresh Sage session. For instance what is `F`?
If the question is not self-contained, at least provide an explicit reference to a previous question where things are defined.Thu, 13 Aug 2020 02:49:05 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52975#post-id-52975Comment by slelievre for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52976#post-id-52976From your previous questions it would seem this is the context.
Construct a finite field, a multivariate polynomial ring over it,
and the quotient by the ideal generated by three polynomials:
sage: F = GF(3)
sage: FXYZ.<X, Y, Z> = F[]
sage: R.<x, y, z> = FXYZ.quo([X^2 - 1, Y^2 - 1, Z^2 - 1])
Check what we have so far:
sage: R
Quotient of Multivariate Polynomial Ring in X, Y, Z
over Finite Field of size 3 by the ideal (X^2 - 1, Y^2 - 1, Z^2 - 1)
sage: R.gens()
(x, y, z)
sage: x^2, y^2, z^2
(1, 1, 1)
Now how do you construct the ideal `J`?Thu, 13 Aug 2020 02:49:53 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52976#post-id-52976Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52977#post-id-52977Thank for your remarks, the set $F$ is the finite field $GF(3)$ as you knew. The ideal $J$ is a "multicyclic code" of dimension $3$, and is equal the set of polynomials of $R$ which vanishes on a finite subset of $F^3$. Here is the code :
def code(POLS,ZER):
C=Set({})
for f in ENS:
V={f.lift()(c) for c in POLS}
if V=={0}:
C=C+Set({f})
return C
In my case, POLS is the set of polynomials of $R$ ( of degree $\leqslant (1,1)$, using the lexicographical order) and ZER a subset of $F^3$ consisting of a unique element. More time is needed to provide the codes for constructing POLS, I will provide these latter on.Thu, 13 Aug 2020 06:45:00 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52977#post-id-52977Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52980#post-id-52980For the construction of the POLS, I used the following program :
def vect2pol(c,Vars):
n=len(c)
po=0
for i in range(n):
po=po+c[i]*Vars[i]
return po
where :
c is a tuple of an element from a finite field
Vars a list of monomials with the same length as c
for example
list2pol((1, 2, 1, 2, 0, 0, 1, 1),[1, z, y, y*z, x, x*z, x*y, x*y*z])
produces
x*y*z + x*y - y*z + y - z + 1.
In my case, POLS is the list of elements of $R$. I first construct the cartesian product $F3^8$ :
S=Set(list(cartesian_product([F3]*8))).
Then I apply the function vect2pol to the elements of S, with Vars =[1, z, y, y*z, x, x*z, x*y, x*y*z]:
POLS={vect2pol(c,Vars) for c in S}.
finally, I apply the fonction code :
J=code(POLS,{(1,2,1)}).Thu, 13 Aug 2020 09:55:22 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52980#post-id-52980Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52981#post-id-52981The set $J$ is then those of the polynomials of $R$ which vanishes on $\{(1,2,1)\}$ (It may be not be equal to the initial $J$ in my question), but that doesn't matter, it also contains 2187 elements). Using the command nbruin gave below, I entered
J1=ideal(*J);J1
B=J1.groebner_basis();B
and Sage returned
[x - 1, y + 1, z - 1].
The problem is solved : $J1$ is the ideal whose elements are the same as those of $J$ and no copy and paste were needeed!Thu, 13 Aug 2020 10:35:49 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52981#post-id-52981Comment by andriam for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52983#post-id-52983Strangely, when I write the Sage programs in the text editor of Asksage, the line containing "def" (for example def vect2pol(c,Vars in the preceeding code) is outside of the box containing the remaining part of the program. Can you explain how to correct it ?Thu, 13 Aug 2020 10:55:15 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52983#post-id-52983Answer by nbruin for <p>I have constructed the following ideal</p>
<pre><code>J = {0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....}
</code></pre>
<p>in the ring </p>
<p>$$
R = F[X,Y,Z]/(X^2-1,Y^2-1,Z^2-1)
$$</p>
<p>where $F=GF(3)$ and $x$ (resp; $y$, $z$) is the residue class of $X$ (resp. $Y$, $Z$)
modulo the ideal $(X^2-1, Y^2-1, Z^2-1)$. By its
construction, the set $J$ is indeed an ideal, containing 2187 elements,
so it is hard to write or copy all its elements.
I want to find a Groebner basis of $J$, by writing</p>
<pre><code>B = J.groebner_basis(),
</code></pre>
<p>but Sage returns</p>
<pre><code>TypeError: R must be a commutative ring.
</code></pre>
<p>This error seems to mean that Sage doesn' t remember that $J$ is the above set anymore and consider $J$ as an inappropriate new objet of a new ring $R$!</p>
<p>I must first construct the ideal</p>
<pre><code>H = ideal(0, x*y*z - x*y - x*z + y*z - x + y - z, x*z - y*z - x + y - 1, x*y*z + x*y + x*z + y*z - z - 1, x*y + x*z + x - y + z, -x*y*z - x*y + x*z - y*z - x - y - z, ....)
</code></pre>
<p>and then compute</p>
<pre><code>B = H.groebner_basis().
</code></pre>
<p>That works, but, as I previously said, it is not easy to construct
the ideal $H$ because that needs copy and paste 2187 elements!</p>
<p>Therefore I'd like to know whether there is another way to the task,
without copying and pasting all of the elements of $J$, and declaring
the ideal of these elements, is there a way to convert a set of elements
in a ring (which is already an ideal) to the underlying ideal?</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?answer=52978#post-id-52978Try:
ideal(*J)
This is standard python syntax: `f(*[a1,a2,a3])` does the same thing as `f(a1,a2,a3)`.
Incidentally, I think you've hidden some of the commands. The code you suggest should produce:
sage: J.groebner_basis()
AttributeError: 'set' object has no attribute 'groebner_basis'
Finally, it seems you want to compute a Groebner basis of an ideal in a quotient ring. There is no such thing! Groebner bases are for ideals of polynomial rings. You should take the inverse image of that ideal in the polynomial ring (that's easy to do: just lift the generators and add the generators of the quotienting ideal to it) and compute a Groebner basis of that.Thu, 13 Aug 2020 07:59:46 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?answer=52978#post-id-52978Comment by andriam for <p>Try:</p>
<pre><code>ideal(*J)
</code></pre>
<p>This is standard python syntax: <code>f(*[a1,a2,a3])</code> does the same thing as <code>f(a1,a2,a3)</code>.</p>
<p>Incidentally, I think you've hidden some of the commands. The code you suggest should produce:</p>
<pre><code>sage: J.groebner_basis()
AttributeError: 'set' object has no attribute 'groebner_basis'
</code></pre>
<p>Finally, it seems you want to compute a Groebner basis of an ideal in a quotient ring. There is no such thing! Groebner bases are for ideals of polynomial rings. You should take the inverse image of that ideal in the polynomial ring (that's easy to do: just lift the generators and add the generators of the quotienting ideal to it) and compute a Groebner basis of that.</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52979#post-id-52979Thank you very much, the command you give works : using the ideal $J$ from above, I write
H=ideal(*J)
then
B =H.groebner_basis()
and Sage return the result! No copy and paste of the elements of $J$ are needed, wonderful !Thu, 13 Aug 2020 09:30:05 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52979#post-id-52979Comment by andriam for <p>Try:</p>
<pre><code>ideal(*J)
</code></pre>
<p>This is standard python syntax: <code>f(*[a1,a2,a3])</code> does the same thing as <code>f(a1,a2,a3)</code>.</p>
<p>Incidentally, I think you've hidden some of the commands. The code you suggest should produce:</p>
<pre><code>sage: J.groebner_basis()
AttributeError: 'set' object has no attribute 'groebner_basis'
</code></pre>
<p>Finally, it seems you want to compute a Groebner basis of an ideal in a quotient ring. There is no such thing! Groebner bases are for ideals of polynomial rings. You should take the inverse image of that ideal in the polynomial ring (that's easy to do: just lift the generators and add the generators of the quotienting ideal to it) and compute a Groebner basis of that.</p>
https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52982#post-id-52982Strangely, the method groebner_basis() works for an ideal in the quotient ring R (see the above example, in the comments in response to slelievre). Perhaps, as you have said, Sage use the lift() method to compute a GrÃ¶bner basis in $F3[X,Y,Z]$ and the returned to $R$. I was confused when I first used this for ideals in quotient ring, this is why I asked the question "Does sage allow computation of a groebner basis of an ideal J in the quotient ring Z/pZ[X_1,...X_r]/I?Thu, 13 Aug 2020 10:45:33 +0200https://ask.sagemath.org/question/52966/how-to-make-sage-know-that-a-set-is-an-ideal/?comment=52982#post-id-52982