# Check if function is symmetric I found the is_Symmetric() function in a tutorial, but I tried to use this with s([2,1]), which is clearly symmetric, but this is what I got

from sage.combinat.sf.sfa import is_SymmetricFunction
R.<x1,x2,x3>=PolynomialRing(QQ,3); R
s = SymmetricFunctions(QQ).schur()
f=s([2,1]).expand(3,'x1,x2,x3')
print(f)
is_SymmetricFunction(f)

x1^2*x2 + x1*x2^2 + x1^2*x3 + 2*x1*x2*x3 + x2^2*x3 + x1*x3^2 + x2*x3^2
False


edit retag close merge delete

Sort by » oldest newest most voted

You should do:

sage: f.is_symmetric()
True


Indeed, the source code of is_SymmetricFunction function is:

return isinstance(x, SymmetricFunctionAlgebra_generic.Element)


see:

sage: is_SymmetricFunction??


which means that it only tests the type of f. But f is just a polynomial:

sage: f.parent()
Multivariate Polynomial Ring in x1, x2, x3 over Rational Field

more

Hi, thank you so much for your answer. I tried an easier one, and still it didn't work

R.<x1,x2,x3>=PolynomialRing(QQ,3); R s = SymmetricFunctions(QQ).schur() f=x1+x2+x3 f.is_symmetric()

I got the error message " AttributeError: 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular' object has no attribute 'is_symmetric' "

Where did I make a mistake?

I can not reproduce your error:

sage: R.<x1,x2,x3>=PolynomialRing(QQ,3)
sage: f=x1+x2+x3
sage: f.is_symmetric()
True


I guess that's because f is a not a function but polynomial. Whether f is symmetric can be seen from whether its conversion to a symmetric function succeeds - like in the code below:

R.<x1,x2,x3>=PolynomialRing(QQ,3);
S = SymmetricFunctions(QQ)
s = S.schur();
f=s([2,1]).expand(3,'x1,x2,x3');
try:
S.from_polynomial(f)
print('f is symmetric')
except ValueError:
print('f is not symmetric')

more