1 | initial version |
I guess, what you want is the following
sage: G = SymmetricGroup(3)
sage: p = G.cycle_index()
sage: p.expand(2)
x0^3 + x0^2*x1 + x0*x1^2 + x1^3 + x0^2*x2 + x0*x1*x2 + x1^2*x2 + x0*x2^2 + x1*x2^2 + x2^3
It is not x,y,z but x0,x1,x2. You may have a look at the documentation of symmetric functions.
2 | No.2 Revision |
I guess, (first try) what you want is might be the following
sage: G = SymmetricGroup(3)
sage: p = G.cycle_index()
sage: p.expand(2)
x0^3 + x0^2*x1 + x0*x1^2 + x1^3 + x0^2*x2 + x0*x1*x2 + x1^2*x2 + x0*x2^2 + x1*x2^2 + x2^3
It is not x,y,z but x0,x1,x2. x0,x1,x2.
(second try) In order to obtain the same polynomial as in GAP, you may define a morphism from symmetric functions to the polynomial ring in x,y,z. Hopefully, it is not that hard as you only need to define it on the basis.
The following defines the polynomial ring as well as a function that given a partition returns the associated monomial in R
R.<x,y,z> = PolynomialRing(QQ,'x,y,z')
def partition_to_xyz(p):
e = p.to_exp_dict()
return x^e.get(1,0) * y^e.get(2,0) * z^e.get(3,0)
you can check
sage: partition_to_xyz(Partition([3]))
z
sage: partition_to_xyz(Partition([1,1,1]))
x^3
then to define the morphism, simply do
sage: Sym = SymmetricFunctions(QQ).power()
sage: phi = Sym.module_morphism(on_basis=partition_to_xyz, codomain=R)
and then
sage: G = SymmetricGroup(3)
sage: p = G.cycle_index()
sage: phi(p)
1/6*x^3 + 1/2*x*y + 1/3*z
You may have a look at the documentation of symmetric functions.