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, 20 Oct 2022 18:50:45 +0200Express Groebner basis in terms of original basishttps://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/Working with a polynomial ring $R$, if I have an ideal generated by a set of polynomials $f_i$ (taking two for concreteness), I can obtain a Groebner basis $g_j$ by the commands
I = R.ideal([f1, f2])
g = I.groebner_basis()
What I want to do is express the Groebner basis in terms of the original basis, i.e. $g_j = \sum_i a_{ij} f_i$. How can I accomplish this in Sage? My understanding is that such an expression is calculated implicitly when the Groebner basis is calculated, so perhaps it is possible to recover it directly from the algorithm.Wed, 01 Apr 2020 03:07:39 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/Answer by rburing for <p>Working with a polynomial ring $R$, if I have an ideal generated by a set of polynomials $f_i$ (taking two for concreteness), I can obtain a Groebner basis $g_j$ by the commands</p>
<pre><code>I = R.ideal([f1, f2])
g = I.groebner_basis()
</code></pre>
<p>What I want to do is express the Groebner basis in terms of the original basis, i.e. $g_j = \sum_i a_{ij} f_i$. How can I accomplish this in Sage? My understanding is that such an expression is calculated implicitly when the Groebner basis is calculated, so perhaps it is possible to recover it directly from the algorithm.</p>
https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?answer=50456#post-id-50456The simplest way is to do it during the Gröbner basis computation, e.g. in Buchberger's algorithm. It's possible to implement this in a few lines in SageMath.
As an alternative you can use the `lift` method on a polynomial, passing it a list of generators or an ideal:
sage: R.<x,y> = QQ[]
sage: f = x^2 - y^2
sage: f.lift(R.ideal([x, y]))
[x, -y]
Keep in mind that the solution is generally not unique due to the existence of syzygies between the generators.Thu, 02 Apr 2020 00:28:36 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?answer=50456#post-id-50456Comment by jane for <p>The simplest way is to do it during the Gröbner basis computation, e.g. in Buchberger's algorithm. It's possible to implement this in a few lines in SageMath.</p>
<p>As an alternative you can use the <code>lift</code> method on a polynomial, passing it a list of generators or an ideal:</p>
<pre><code>sage: R.<x,y> = QQ[]
sage: f = x^2 - y^2
sage: f.lift(R.ideal([x, y]))
[x, -y]
</code></pre>
<p>Keep in mind that the solution is generally not unique due to the existence of syzygies between the generators.</p>
https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=64536#post-id-64536Hi! May I ask how to implement it during groebner basis computation as you said? since in my case, the function .lift() took too much time...Thu, 20 Oct 2022 18:50:45 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=64536#post-id-64536Answer by nbruin for <p>Working with a polynomial ring $R$, if I have an ideal generated by a set of polynomials $f_i$ (taking two for concreteness), I can obtain a Groebner basis $g_j$ by the commands</p>
<pre><code>I = R.ideal([f1, f2])
g = I.groebner_basis()
</code></pre>
<p>What I want to do is express the Groebner basis in terms of the original basis, i.e. $g_j = \sum_i a_{ij} f_i$. How can I accomplish this in Sage? My understanding is that such an expression is calculated implicitly when the Groebner basis is calculated, so perhaps it is possible to recover it directly from the algorithm.</p>
https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?answer=50454#post-id-50454I think the quick way for this is to carry around marker variables, say `b1,b2` and then compute the groebner basis of the ideal `(b1-f1,b2-f2)`, making sure you have a block order that prioritizes the original variables (that occur in f1,f2). You can then see in the resulting basis from the part of the polynomials in the `b1,b2` how your original generators were combined. It's comparable to the trick of augmenting a matrix for Gaussian elimination to find the transformation that gets you there (i.e., the inverse of the matrix).Wed, 01 Apr 2020 17:47:59 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?answer=50454#post-id-50454Comment by rburing for <p>I think the quick way for this is to carry around marker variables, say <code>b1,b2</code> and then compute the groebner basis of the ideal <code>(b1-f1,b2-f2)</code>, making sure you have a block order that prioritizes the original variables (that occur in f1,f2). You can then see in the resulting basis from the part of the polynomials in the <code>b1,b2</code> how your original generators were combined. It's comparable to the trick of augmenting a matrix for Gaussian elimination to find the transformation that gets you there (i.e., the inverse of the matrix).</p>
https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=50457#post-id-50457This is usable but not very convenient when you get e.g. `b1^3` in the result; this is more suited for a subalgebra test.Thu, 02 Apr 2020 00:37:01 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=50457#post-id-50457Comment by nbruin for <p>I think the quick way for this is to carry around marker variables, say <code>b1,b2</code> and then compute the groebner basis of the ideal <code>(b1-f1,b2-f2)</code>, making sure you have a block order that prioritizes the original variables (that occur in f1,f2). You can then see in the resulting basis from the part of the polynomials in the <code>b1,b2</code> how your original generators were combined. It's comparable to the trick of augmenting a matrix for Gaussian elimination to find the transformation that gets you there (i.e., the inverse of the matrix).</p>
https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=50608#post-id-50608It may not be convenient but it does exactly reflect what happens: to obtain that relation, you'd need to take `f1^3` in terms of your original basis.Mon, 06 Apr 2020 22:21:37 +0200https://ask.sagemath.org/question/50450/express-groebner-basis-in-terms-of-original-basis/?comment=50608#post-id-50608