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.Fri, 04 Sep 2020 01:47:11 +0200Rewriting linear combination of Groebner basis in terms of original termshttps://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/ Let assume I have an ideal given by
x,y,z = QQ['x,y,z'].gens()
I = ideal(f1,f2,f3)
B = I.groebner_basis()
where f1,f2,f3 are just polynomials in variables x,y,z. Let's say B=(g1,g2).
Let's assume I happen to take a polynomial,h, that is in my ideal I. Then doing polynomial division, I can write
h=h1*g1+h2*g2
Basically I can write h as a linear combination of the elements in my Groebner basis. Is there a function that converts a linear combination in terms of Groebner to linear combination of terms in my ideal I? i.e.I can write
h=q1*f1+q2*f2+q3*f3
Wed, 02 Sep 2020 23:41:22 +0200https://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/Answer by dan_fulea for <p>Let assume I have an ideal given by </p>
<pre><code>x,y,z = QQ['x,y,z'].gens()
I = ideal(f1,f2,f3)
B = I.groebner_basis()
</code></pre>
<p>where f1,f2,f3 are just polynomials in variables x,y,z. Let's say B=(g1,g2). </p>
<p>Let's assume I happen to take a polynomial,h, that is in my ideal I. Then doing polynomial division, I can write </p>
<pre><code>h=h1*g1+h2*g2
</code></pre>
<p>Basically I can write h as a linear combination of the elements in my Groebner basis. Is there a function that converts a linear combination in terms of Groebner to linear combination of terms in my ideal I? i.e.I can write</p>
<pre><code>h=q1*f1+q2*f2+q3*f3
</code></pre>
https://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/?answer=53272#post-id-53272This answer ignores completely the Groebner basis. Just "lift" the corresponding element.
In an example:
R.<x,y,z> = QQ[]
f1, f2, f3 = (x + y + z)^2, x*y + y*z + z*x, x^3 + y^3 + z^3
J = R.ideal([f1, f2, f3])
h = x*y*z
print("Is h in J? {}".format(h in J))
q1, q2, q3 = h.lift(J)
print(f"q1 = {q1}\nq2 = {q2}\nq3 = {q3}")
This gives:
Is h in J? True
q1 = -1/3*x - 1/3*y - 1/3*z
q2 = x + y + z
q3 = 1/3
We have
sage: h == f1*q1 + f2*q2 + f3*q3
True
The line answering the question is `q1, q2, q3 = h.lift(J)`.
Thu, 03 Sep 2020 06:38:33 +0200https://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/?answer=53272#post-id-53272Comment by whatupmatt for <p>This answer ignores completely the Groebner basis. Just "lift" the corresponding element.</p>
<p>In an example:</p>
<pre><code>R.<x,y,z> = QQ[]
f1, f2, f3 = (x + y + z)^2, x*y + y*z + z*x, x^3 + y^3 + z^3
J = R.ideal([f1, f2, f3])
h = x*y*z
print("Is h in J? {}".format(h in J))
q1, q2, q3 = h.lift(J)
print(f"q1 = {q1}\nq2 = {q2}\nq3 = {q3}")
</code></pre>
<p>This gives:</p>
<pre><code>Is h in J? True
q1 = -1/3*x - 1/3*y - 1/3*z
q2 = x + y + z
q3 = 1/3
</code></pre>
<p>We have</p>
<pre><code>sage: h == f1*q1 + f2*q2 + f3*q3
True
</code></pre>
<p>The line answering the question is <code>q1, q2, q3 = h.lift(J)</code>.</p>
https://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/?comment=53289#post-id-53289This might be a harder question but what if I have something that is not in the Ideal? Is there a function that extracts the Ideal part? I believe I will need Groebner basis for that. Basically, the ideal part is when I divide out by the Groebner basis and the remainder is the non-Ideal part. Just wondering if there was a function that immediately does this.Fri, 04 Sep 2020 01:47:11 +0200https://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/?comment=53289#post-id-53289