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.Sun, 19 Apr 2020 20:54:05 +0200Why is sage not recognizing symmetric polynomials as symmetric?https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/ I am trying to decompose symmetric polynomials into polynomial combinations of elementary symmetric polynomials. It has been driving me absolutely up the wall, and I would be very grateful for any help.
It works perfectly with 2 variables.
S.<x0,x1>=QQ[]
f = (x0-x1)*(x1-x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
print g
For 3 variables it fails. Sage throws a type error and says the polynomial f is not symmetric, even though it is certainly invariant under the action of the symmetric group of order 3.
S.<x0,x1,x2>=QQ[]
f = (x0-x1)*(x1-x2)*(x2-x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
print g
The type error is as folliows:
/sage/combinat/sf/sf.pyc in from_polynomial(self, f)
1372 ValueError: x0 + 2*x1 + x2 is not a symmetric polynomial
1373 """
-> 1374 return self.m().from_polynomial(f)
1375
1376 def register_isomorphism(self, morphism, only_conversion=False):
However, the following does not throw a type error, perhaps because it is a linear combination of the elementary basis rather than a polynomial one. I don't understand what is going on. Why is this type error being triggered for a valid symmetric polynomial? Thank you very much for your time.
S.<x0,x1,x2>=QQ[]
f = (x0+x1)*(x1+x2)*(x2+x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
Sun, 19 Apr 2020 05:36:04 +0200https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/Answer by FrédéricC for <p>I am trying to decompose symmetric polynomials into polynomial combinations of elementary symmetric polynomials. It has been driving me absolutely up the wall, and I would be very grateful for any help. </p>
<p>It works perfectly with 2 variables. </p>
<pre><code>S.<x0,x1>=QQ[]
f = (x0-x1)*(x1-x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
print g
</code></pre>
<p>For 3 variables it fails. Sage throws a type error and says the polynomial f is not symmetric, even though it is certainly invariant under the action of the symmetric group of order 3.</p>
<pre><code>S.<x0,x1,x2>=QQ[]
f = (x0-x1)*(x1-x2)*(x2-x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
print g
</code></pre>
<p>The type error is as folliows:</p>
<pre><code>/sage/combinat/sf/sf.pyc in from_polynomial(self, f)
1372 ValueError: x0 + 2*x1 + x2 is not a symmetric polynomial
1373 """
-> 1374 return self.m().from_polynomial(f)
1375
1376 def register_isomorphism(self, morphism, only_conversion=False):
</code></pre>
<p>However, the following does not throw a type error, perhaps because it is a linear combination of the elementary basis rather than a polynomial one. I don't understand what is going on. Why is this type error being triggered for a valid symmetric polynomial? Thank you very much for your time.</p>
<pre><code>S.<x0,x1,x2>=QQ[]
f = (x0+x1)*(x1+x2)*(x2+x0)
Sym = SymmetricFunctions(QQ)
g = Sym.from_polynomial(f)
</code></pre>
https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/?answer=50853#post-id-50853Because it is not a symmetric polynomial:
sage: f==f(x0=x1,x1=x0)
False
sage: f==-f(x0=x1,x1=x0)
True
Sun, 19 Apr 2020 07:55:32 +0200https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/?answer=50853#post-id-50853Comment by masseygirl for <p>Because it is not a symmetric polynomial:</p>
<pre><code>sage: f==f(x0=x1,x1=x0)
False
sage: f==-f(x0=x1,x1=x0)
True
</code></pre>
https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/?comment=50866#post-id-50866Ah! Thank you very much.Sun, 19 Apr 2020 20:54:05 +0200https://ask.sagemath.org/question/50852/why-is-sage-not-recognizing-symmetric-polynomials-as-symmetric/?comment=50866#post-id-50866