#C18.txt, Nov. 7, 2016, Dr. Z.'s Experimental Mathematics Class, Bases of Symmetric Polynomials Help:=proc(): print(` Toe(f,x,n,e), ToE(f,x,n,E), Andrew(F,x,n), mToe(n) `): end: with(linalg): #Stuff from C15.txt ################## #C15.txt: ExpMath, Rutgers, Oct. 27, 2016, Bases of the alg. of Symmetric Polynomials Help15:=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), eTom(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: 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: 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: #eTom(n): code by JinYoung Park eTom:=proc(n) local Pn,k,A,B,M,i,M1,j,x: Pn:=P(n): k:=nops(Pn): A:=[seq(M[Pn[i]],i=1..k)]: B:=[seq(ToM(expand(eL(x,Pn[i],n)),x,n,M),i=1..k)]: M:=[]: for i from 1 to nops(A) do M1:=[seq(coeff(B[i],A[j]),j=1..nops(A))]: M:=[op(M),M1]: od: end: ######Code from previou classes #mToe(n): the transition matrix from the m-basis to the e-basis mToe:=proc(n) inverse(eTom(n)): end: #Andrew(F,x,n): inputs a symmetric polynomial F, in x[1],..., x[n] abd ouputs the vector of coefficients Andrew:=proc(F,x,n) local A,Pars,M,i: A:=ToM(expand(F),x,n,M): Pars:=P(n): [seq(coeff(A,M[Pars[i]],1),i=1..nops(Pars))]: end: #ToE(f,x,n,E): inputs a symmetric function f, homog. of total degree n, of x[1]. ..., x[n] #and a positive integer n, and a symbol E, expresses it as a linear combination of #the E-basis, where E[L] means e_L[1]*...e_L[nops(L)] ToE:=proc(f,x,n,E) local v,Pars,i: v:=multiply(Andrew(f,x,n),mToe(n)): Pars:=P(n): add(v[i]*E[Pars[i]],i=1..nops(Pars)): end: #Toe(f,x,n,e): inputs a symmetric function f, homog. of total degree n, of x[1]. ..., x[n] #and a positive integer n, and a symbol e, expresses it as polynomial expression in e[1],e[2],...,e[n] #thereby confirming the fundamental theorem of Symmetric Functions that any summetric polynomial #in x[1],..,x[n] of degree<=n can be thus expressed Toe:=proc(f,x,n,e) local v,Pars,i,j: v:=multiply(Andrew(f,x,n),mToe(n)): Pars:=P(n): add(v[i]*mul(e[Pars[i][j]],j=1..nops(Pars[i])),i=1..nops(Pars)): end: