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, 24 May 2013 14:28:59 +0200How do you factor Schubert Polynomials in Sage?https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/I am interested in factoring (sums of) Schubert polynomials using Sage (which uses Singular). Here's my input attempt:
\> X = SchubertPolynomialRing(QQ)
\> f = X([5,4,2,6,1,3]).expand(); f
\> f.factor()
However, while the second line gives a correct output, x0^4\*x1^3\*x2^2\*x3 + x0^4\*x1^3\*x2\*x3^2, when I try to factor this output, I get the following error message: "NotImplementedError: Factorization of multivariate polynomials over non-fields is not implemented."
I don't know how to get Sage to recognize a SchubertPolynomialRing as being over a field. Any suggestions?Fri, 15 Mar 2013 17:18:37 +0100https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/Answer by FrédéricC for <p>I am interested in factoring (sums of) Schubert polynomials using Sage (which uses Singular). Here's my input attempt:</p>
<p>> X = SchubertPolynomialRing(QQ)</p>
<p>> f = X([5,4,2,6,1,3]).expand(); f</p>
<p>> f.factor()</p>
<p>However, while the second line gives a correct output, x0^4*x1^3*x2^2*x3 + x0^4*x1^3*x2*x3^2, when I try to factor this output, I get the following error message: "NotImplementedError: Factorization of multivariate polynomials over non-fields is not implemented."</p>
<p>I don't know how to get Sage to recognize a SchubertPolynomialRing as being over a field. Any suggestions?</p>
https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/?answer=14673#post-id-14673This is because the defaut base ring is ZZ and not QQ.
sage: X = SchubertPolynomialRing(QQ)
sage: f = X([5,4,2,6,1,3]).expand(); f
x0^4*x1^3*x2^2*x3 + x0^4*x1^3*x2*x3^2
sage: f.parent()
Multivariate Polynomial Ring in x0, x1, x2, x3, x4, x5 over Integer Ring
sage: f.change_ring(QQ)
x0^4*x1^3*x2^2*x3 + x0^4*x1^3*x2*x3^2
sage: f.change_ring(QQ).factor()
x3 * x2 * (x2 + x3) * x1^3 * x0^4
sage:
Fri, 22 Mar 2013 11:51:06 +0100https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/?answer=14673#post-id-14673Comment by mjoyce for <p>This is because the defaut base ring is ZZ and not QQ.</p>
<pre><code>sage: X = SchubertPolynomialRing(QQ)
sage: f = X([5,4,2,6,1,3]).expand(); f
x0^4*x1^3*x2^2*x3 + x0^4*x1^3*x2*x3^2
sage: f.parent()
Multivariate Polynomial Ring in x0, x1, x2, x3, x4, x5 over Integer Ring
sage: f.change_ring(QQ)
x0^4*x1^3*x2^2*x3 + x0^4*x1^3*x2*x3^2
sage: f.change_ring(QQ).factor()
x3 * x2 * (x2 + x3) * x1^3 * x0^4
sage:
</code></pre>
https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/?comment=17646#post-id-17646Thank you -- this helped a lot!Fri, 24 May 2013 14:28:59 +0200https://ask.sagemath.org/question/9917/how-do-you-factor-schubert-polynomials-in-sage/?comment=17646#post-id-17646