Ask Your Question
1

Check if function is symmetric

asked 3 years ago

convergency gravatar image

updated 3 years ago

FrédéricC gravatar image

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

Can someone please help?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
0

answered 3 years ago

tmonteil gravatar image

updated 3 years ago

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
Preview: (hide)
link

Comments

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?

convergency gravatar imageconvergency ( 3 years ago )

I can not reproduce your error:

sage: R.<x1,x2,x3>=PolynomialRing(QQ,3)
sage: f=x1+x2+x3
sage: f.is_symmetric()
True
tmonteil gravatar imagetmonteil ( 3 years ago )
0

answered 3 years ago

Max Alekseyev gravatar image

updated 3 years ago

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')
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 3 years ago

Seen: 477 times

Last updated: Sep 01 '21