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.Tue, 27 Mar 2012 09:52:37 +0200Find specific linear combination in multivariate polynomial ringhttps://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/Assume that I have given a sequence of polynomials $f_1,\dotsc,f_s$ in a multivariate polynomial ring (over $\mathbb{Z}$, if that matters) and want to decide whether a given polynomial $g$ can be written as $g = \lambda_1 f_1 + \dotsc + \lambda_s f_s$. Then in Sage I just let
I = Ideal([f_1,...,f_s])
and test with
g in I
If this returns True, how can I get Sage to display some possible $\lambda_1,\dotsc,\lambda_s$?
As for my specific problem, I have already tried it by hand, but this is hard: My polynomial ring has $15$ indeterminates and there are $s = 250$ polynomials.Sun, 25 Mar 2012 08:53:55 +0200https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/Comment by Martin Brandenburg for <p>Assume that I have given a sequence of polynomials $f_1,\dotsc,f_s$ in a multivariate polynomial ring (over $\mathbb{Z}$, if that matters) and want to decide whether a given polynomial $g$ can be written as $g = \lambda_1 f_1 + \dotsc + \lambda_s f_s$. Then in Sage I just let</p>
<pre><code>I = Ideal([f_1,...,f_s])
</code></pre>
<p>and test with</p>
<pre><code>g in I
</code></pre>
<p>If this returns True, how can I get Sage to display some possible $\lambda_1,\dotsc,\lambda_s$?</p>
<p>As for my specific problem, I have already tried it by hand, but this is hard: My polynomial ring has $15$ indeterminates and there are $s = 250$ polynomials.</p>
https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20053#post-id-20053There is a related question http://ask.sagemath.org/question/1064/explicit-representation-of-element-of-ideal which answers my question if the base ring was a field.Sun, 25 Mar 2012 08:59:30 +0200https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20053#post-id-20053Comment by Martin Brandenburg for <p>Assume that I have given a sequence of polynomials $f_1,\dotsc,f_s$ in a multivariate polynomial ring (over $\mathbb{Z}$, if that matters) and want to decide whether a given polynomial $g$ can be written as $g = \lambda_1 f_1 + \dotsc + \lambda_s f_s$. Then in Sage I just let</p>
<pre><code>I = Ideal([f_1,...,f_s])
</code></pre>
<p>and test with</p>
<pre><code>g in I
</code></pre>
<p>If this returns True, how can I get Sage to display some possible $\lambda_1,\dotsc,\lambda_s$?</p>
<p>As for my specific problem, I have already tried it by hand, but this is hard: My polynomial ring has $15$ indeterminates and there are $s = 250$ polynomials.</p>
https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20052#post-id-20052I could solve my problem by feeding sage with base fields such as $\mathbb{Q}$ and $\mathbb{F}_2$ and experimental comparing of the results, to get a correct linear combination over the base ring $\mathbb{Z}$. But I think it is interesting whether there is a general method implemented.Sun, 25 Mar 2012 12:01:23 +0200https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20052#post-id-20052Answer by burcin for <p>Assume that I have given a sequence of polynomials $f_1,\dotsc,f_s$ in a multivariate polynomial ring (over $\mathbb{Z}$, if that matters) and want to decide whether a given polynomial $g$ can be written as $g = \lambda_1 f_1 + \dotsc + \lambda_s f_s$. Then in Sage I just let</p>
<pre><code>I = Ideal([f_1,...,f_s])
</code></pre>
<p>and test with</p>
<pre><code>g in I
</code></pre>
<p>If this returns True, how can I get Sage to display some possible $\lambda_1,\dotsc,\lambda_s$?</p>
<p>As for my specific problem, I have already tried it by hand, but this is hard: My polynomial ring has $15$ indeterminates and there are $s = 250$ polynomials.</p>
https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?answer=13393#post-id-13393AFAIK, Singular can handle this case but the Sage wrappers restrict the coefficient domain to a field. You can work around this with the magical Singular function interface. Using the example from the previous question linked above:
sage: R.<x,y,z,t> = ZZ[]
sage: C1= 17*x^2 + 7*y^2 - 26*y*z + 7*z^2
sage: C2= 13*y^2 - 7*y*z + 13*z^2 - 51*t^2
sage: I = (C1, C2)*R
sage: f in I
False
sage: 221*f in I
True
sage: lift = sage.libs.singular.ff.lift
sage: lift(I, 221*f)
[ 13*x^2 + 17*y*z - 21*t^2]
[-7*x^2 + 17*y^2 + 17*z^2 + 78*t^2]
sage: (13*x^2 + 17*y*z - 21*t^2)*C1 + (-7*x^2 + 17*y^2 + 17*z^2 + 78*t^2)*C2
221*x^4 + 221*y^4 + 221*z^4 - 3978*t^4
sage: f
x^4 + y^4 + z^4 - 18*t^4
Sun, 25 Mar 2012 18:28:22 +0200https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?answer=13393#post-id-13393Comment by Martin Brandenburg for <p>AFAIK, Singular can handle this case but the Sage wrappers restrict the coefficient domain to a field. You can work around this with the magical Singular function interface. Using the example from the previous question linked above:</p>
<pre><code>sage: R.<x,y,z,t> = ZZ[]
sage: C1= 17*x^2 + 7*y^2 - 26*y*z + 7*z^2
sage: C2= 13*y^2 - 7*y*z + 13*z^2 - 51*t^2
sage: I = (C1, C2)*R
sage: f in I
False
sage: 221*f in I
True
sage: lift = sage.libs.singular.ff.lift
sage: lift(I, 221*f)
[ 13*x^2 + 17*y*z - 21*t^2]
[-7*x^2 + 17*y^2 + 17*z^2 + 78*t^2]
sage: (13*x^2 + 17*y*z - 21*t^2)*C1 + (-7*x^2 + 17*y^2 + 17*z^2 + 78*t^2)*C2
221*x^4 + 221*y^4 + 221*z^4 - 3978*t^4
sage: f
x^4 + y^4 + z^4 - 18*t^4
</code></pre>
https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20042#post-id-20042Thanks! Tue, 27 Mar 2012 09:52:37 +0200https://ask.sagemath.org/question/8827/find-specific-linear-combination-in-multivariate-polynomial-ring/?comment=20042#post-id-20042