#C15.txt: ExpMath, Rutgers, Oct. 27, 2016, Bases of the alg. of Symmetric Polynomials Help:=proc(): print(`P(n), ApplyPi(f,x,n,pi), Sym(f,x,n), mL(x,L,n)`): print(`IsSym(f,x,n), ToM(f,x,n,M), ei(x,i,n), eL(x,L,n) `): end: with(combinat): #Rev(L): reverse of L Rev:=proc(L) local n,i: n:=nops(L): [seq(L[n-i+1],i=1..n)]: end: #P(n): the list of (integer) partitons of n in non-increasing order P:=proc(n) local S,i: S:=partition(n): Rev([seq(Rev(S[i]),i=1..nops(S))]): end: #ApplyPi(f,x,n,pi): inputs f, x, n, pi, where f is an expression in x[1],...,x[n] #pos. integer n, letter x, and a permutation pi of {1, ...,n}, applies x[i]->x[pi[i]] #to f ApplyPi:=proc(f,x,n,pi) local i: if nops(pi)<>n then RETURN(FAIL): fi: subs({seq(x[i]=x[pi[i]],i=1..n)},f): end: #Sym(f,x,n): the symmetrizer of f Sym:=proc(f,x,n) local pi,S: S:=permute(n): convert({seq(ApplyPi(f,x,n,pi), pi in S)},`+`): end: #mL(x,L,n): The monomial symmetric function m_L(x1,..., xn) where n>=nops(L) mL:=proc(x,L,n) local i: if n0 then RETURN(false): fi: od: true: end: KickZ:=proc(L) local i: for i from 1 to nops(L) while L[i]<>0 do od: [op(1..i-1,L)]: end: #ToM(f,x,n,M): inputs a symmetric polynomial f in x[1]..., x[n] #outputs it as a linear combination of M[L] ToM:=proc(f,x,n,M) local F,f1,mono,L,c,i: if not IsSym(f,x,n) then RETURN(FAIL): fi: #This part added after class if not type(f,`+`) then c:=normal(f/mul(x[i],i=1..n)): if not type(c,integer) then RETURN(FAIL): else RETURN(c*M[[1$n]]): fi: fi: #end part added after class f1:=f: F:=0: while f1<>0 do mono:=op(1,f1): L:=[seq(degree(mono,x[i]),i=1..n)]: c:=normal(mono/mul(x[i]^L[i],i=1..nops(L))): L:=KickZ(sort(L,`>`)): F:=F+c*M[L]: f1:=expand(f1-c*mL(x,L,n)): od: F: end: #ei(x,i,n): the elementary symmetric function e_i(x[1], ..., x[n]) ei:=proc(x,i,n) : if i>n then 0: else mL(x,[1$i],n): fi: end: #eL(x,L,n): the mul(e_L[i], i=1..n) eL:=proc(x,L,n) local i: mul(ei(x,L[i] ,n),i=1..nops(L)): end: