Ask Your Question
1

Check if function is symmetric

asked 2021-08-31 22:01:49 +0200

convergency gravatar image

updated 2021-09-01 08:45:45 +0200

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?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2021-08-31 22:15:27 +0200

tmonteil gravatar image

updated 2021-08-31 22:26:47 +0200

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
edit flag offensive delete link more

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 ( 2021-08-31 23:29:02 +0200 )edit

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 ( 2021-09-01 01:30:02 +0200 )edit
0

answered 2021-08-31 22:17:22 +0200

Max Alekseyev gravatar image

updated 2021-09-01 00:18:41 +0200

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')
edit flag offensive delete link more

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: 2021-08-31 22:01:49 +0200

Seen: 241 times

Last updated: Sep 01 '21