#Version of March 27, 2003 #----------------------- Help ----------------------- with(linalg): with(combinat): print(` Welcome to SF, a Symmetric Functions package written`): print(`by the brilliant students of Math 583, Spring 2003`): print(`Please send all bugs to mohamudm@math.rutgers.edu`): print(`For a list of the available procedures, type Help();`): print(`For help with a specific procdure type Help(Procedure_Name);`): Help:=proc(): print(` Version of March 27, 2003 `): if nargs=0 then print(` Welcome to SF, a Symmetric Functions package written`): print(`by the brilliant students of Math 583, Spring 2003`): print(`Please send all bugs to mohamudm@math.rutgers.edu`): print(``): print(`Contains the following procedures:`): print(` Conj , EtoM, e_lambda, h_lambda, HtoM, IsPar, m_lambda, `): print(` MtoE, MtoH, MtoP `): print(` p_lambda, Partition, PtoM, RevMM, SPtoM, Symm `): elif nargs=1 then if args[1]=Conj then print(` Conj(lam): computes the conjugate of the partition lam`): print( ` For example, try: Conj([5,3,1]); `): elif args[1]=e_lambda then print(`e_lambda(lambda,x,m): The elementary symmetric function in`): print(` x[1], ..., x[m], corresponding to the partition lambda`): print(`E.g. try: e_lambda([1,1,1],x,3); `); elif args[1]=EtoM then print(`EtoM(n): The transition matrix from the e-basis`): print(`to the m-basis for homog. symm. pol. of deg. n `): elif args[1]=MtoE then print(`MtoE(n): The transition matrix from the m-basis`): print(`to the e-basis for homog. symm. pol. of deg. n `): elif args[1]=MtoH then print(`MtoH(n): The transition matrix from the m-basis`): print(`to the h-basis for homog. symm. pol. of deg. n `): elif args[1]=MtoP then print(`MtoP(n): The transition matrix from the m-basis`): print(`to the p-basis for homog. symm. pol. of deg. n `): elif args[1]=PtoM then print(`PtoM(n): The transition matrix from the p-basis`): print(`to the m-basis for homog. symm. pol. of deg. n `): elif args[1]=HtoM then print(`HtoM(n): The transition matrix from the h-basis`): print(`to the m-basis for homog. symm. pol. of deg. n `): elif args[1]=h_lambda then print(`h_lambda(lambda,x,m): The complete homog. symmetric function in`): print(` x[1], ..., x[m], corresponding to the partition lambda`): print(`E.g. try: h_lambda([1,1,1],x,3); `); elif args[1]=IsPar then print(` IsPar(lam): returns true iff lam is a genuine partition`): print(` in weakly decreasing form `): print( ` For example, try: IsPar([5,3,1]); `): print( ` and try : IsPar([5,3,1,4]); `): elif args[1]=m_lambda then print(`m_lambda(lambda,x,m): The monomial symmetric function in`): print(` x[1], ..., x[m], corresponding to the partition lambda`): print(`E.g. try: m_lambda([1,1,1],x,3); `); elif args[1]=Partition then print(`Partition(n): The list of all partitions of a positive `): print(` integer n, i n rev. lex. order`): elif args[1]=p_lambda then print(`p_lambda(lambda,x,m): The power-sum symmetric function in`): print(` x[1], ..., x[m], corresponding to the partition lambda`): print(`E.g. try: p_lambda([1,1,1],x,3); `); elif args[1]=RevMM then print(`RevMM(List): reverses the list List, e.g. RevMM([3,5]); `): print(` should give [5,3]`): elif args[1]=SPtoM then print(`SPtoM(P,x,n,m): converts a symmetric polynomial in the x's`): print(`to the m's `): print(`For example, try; SPtoM(x[1]+x[2],x,2,m)`): elif args[1]=Symm then print(`Symm(f,x,n): The symmetrizer of the function (or expression) `): print(` f(x[1], ..., x[n]) `): print(` For example, try Symm(x[1]+x[2]^2,x,3); ` ) : else ERROR(`There is no help for `, args[1]): fi: fi: end: #help #--------------------- IsPar ----------------------- IsPar:= proc(lam)local i: #this procedure tests that lam valid if not type (lam,list) then #is lam a list? RETURN(false): fi: for i from 1 to nops(lam) do #are the list elements of lam integers? if not (type(lam[i], integer) and lam[i]>0) then RETURN(false): fi: od: for i from 1 to nops(lam) -1 do #is lam in the correct (non-increasing) order? if lam[i] - lam[i+1] < 0 then RETURN(false): fi: od: true: #if we pass the tests, then we've got it end: #IsPar #--------------------- Chop ----------------------- Chop:=proc(lam) local i: for i from 1 to nops(lam) while lam[i]>0 do od: i:=i-1: [op(1..i,lam)]: end: #Chop #--------------------- Conj ----------------------- Conj:=proc(lam) local i,lam1,Lam1,n : if lam=[] then RETURN([]): fi: if IsPar(lam) then n:=nops(lam): lam1:=Chop([ seq( lam[i]-1, i=1..n) ]): Lam1:=Conj(lam1): [n, op(Lam1)]: else ERROR(`lam must be an integer list in non-increasing order`): fi: end: #Conj #ApplyPer(f,x,pi1): Applies the permutation pi to the (n=nops(pi)) #function (or expression) f that depends on x[1], ..., x[n] ApplyPer:=proc(f,x,pi1) local i,su: su:={seq(x[i]=x[pi1[i]], i=1.. nops(pi1))}; subs(su,f); end: #Symm(f,x,n): The symmetrizer of the function (or expression) #f(x[1], ..., x[n]) Symm:=proc(f,x,n) local pers,i: pers:=permute(n): convert([seq(ApplyPer(f,x,pers[i]), i=1..nops(pers))], `+`)/nops(pers); end: RevMM:=proc(P) local i,N: N:=nops(P): [seq(P[N-i+1] , i=1..N)]: end: Partition:=proc(n) local P,i,N: P:=partition(n): N:=nops(P); RevMM([seq(RevMM(P[i]),i=1..N)]): end: Monom:=proc(lambda,x) local i: convert( [seq(x[i]^lambda[i],i=1..nops(lambda) )], `*`): end: m_lambda:=proc(lambda,x,m) local i,Perms1,lambda1: if m< nops(lambda) then ERROR(`The number of variables should be >= number of parts of lambda`): fi: lambda1:=[op(lambda), seq(0,i=1..m-nops(lambda))]: Perms1:=permute(lambda1): convert( [seq(Monom(Perms1[i],x,m) , i=1..nops(Perms1))] , `+`): end: #ei(x,i,m): The elementary symmetric function e_i(x[1], ..., x[m]) ei:=proc(x,i,m) m_lambda([ 1$i ] , x, m): end: #pi1(x,i,m): The power-sum symmetric function e_i(x[1], ..., x[m]) pi1:=proc(x,i,m) m_lambda([i] , x, m): end: #hi(x,i,m): The complete homog. symm. function of degree i in #x[1], x[2], ..., x[m] hi:=proc(x,i,m) local P,i1: P:=Partition(i): convert( [seq( m_lambda(P[i1],x,m), i1=1..nops(P))] , `+`): end: higf:=proc(x,i,m) local t,i1,P: P:= convert([seq( 1/(1- x[i1]*t), i1=1..m)], `*`): P:=taylor(P,t=0,i+1): expand(coeff(P,t,i)): end: #e_lambda(lambda,x,m): The elemnatry symmetric #function basis e_lambda(x[1], ..., x[m]) e_lambda:=proc(lambda,x,m) local i1: expand( convert( [seq(ei(x,lambda[i1],m),i1=1..nops(lambda))], `*`)): end: #h_lambda(lambda,x,m): The complete homog. symmetric #function basis h_lambda(x[1], ..., x[m]) h_lambda:=proc(lambda,x,m) local i1: expand( convert( [seq(higf(x,lambda[i1],m),i1=1..nops(lambda))], `*`)): end: #p_lambda(lambda,x,m): The power-sum symmetric #function basis p_lambda(x[1], ..., x[m]) p_lambda:=proc(lambda,x,m) local i1: expand( convert( [seq(pi1(x,lambda[i1],m),i1=1..nops(lambda))], `*`)): end: MtoE:=proc(n) local P,i1,j1,N,A,E1,lam1,k1,E1a,x: P:=Partition(n): N:=nops(P): A:=matrix(N,N): for i1 from 1 to N do E1:=expand(e_lambda(P[i1],x,n)): for j1 from 1 to N do lam1:=P[j1]: E1a:=E1: for k1 from 1 to nops(lam1) do E1a:=coeff(E1a,x[k1],lam1[k1]): od: A[i1,j1]:=E1a: od: od: op(A): end: MtoH:=proc(n) local P,i1,j1,N,A,E1,lam1,k1,E1a,x: P:=Partition(n): N:=nops(P): A:=matrix(N,N): for i1 from 1 to N do E1:=expand(h_lambda(P[i1],x,n)): for j1 from 1 to N do lam1:=P[j1]: E1a:=E1: for k1 from 1 to nops(lam1) do E1a:=coeff(E1a,x[k1],lam1[k1]): od: A[i1,j1]:=E1a: od: od: op(A): end: MtoP:=proc(n) local P,i1,j1,N,A,E1,lam1,k1,E1a,x: P:=Partition(n): N:=nops(P): A:=matrix(N,N): for i1 from 1 to N do E1:=expand(p_lambda(P[i1],x,n)): for j1 from 1 to N do lam1:=P[j1]: E1a:=E1: for k1 from 1 to nops(lam1) do E1a:=coeff(E1a,x[k1],lam1[k1]): od: A[i1,j1]:=E1a: od: od: op(A): end: EtoM:=proc(n): inverse(MtoE(n)):end: HtoM:=proc(n): inverse(MtoH(n)):end: PtoM:=proc(n): inverse(MtoP(n)):end: MonomToPar:=proc(P,x,n) local i1,lam1,coe: lam1:=[seq(degree(P,x[i1]),i1=1..n)] : coe:=normal(P/convert([seq(x[i1]^lam1[i1],i1=1..nops(lam1))],`*`)): coe,Chop(RevMM(sort(lam1))): end: SPtoM:=proc(P,x,n,m) local P1,Q,mono1,lam1,coe1: P1:=expand(P): if P1=0 then RETURN(0): fi: if Symm(P1,x,n)<>P1 then RETURN(FAIL): fi: Q:=0: while type(P1,`+`) do mono1:=op(1,P1): lam1:=MonomToPar(mono1,x,n): coe1:=lam1[1]: lam1:=lam1[2]: Q:=Q+coe1*m[op(lam1)]: P1:=expand(P1-coe1*m_lambda(lam1,x,n)): od: if P1<>0 then lam1:=MonomToPar(P1,x,n): coe1:=lam1[1]: lam1:=lam1[2]: Q:=Q+coe1*m[op(lam1)]: P1:=expand(P1-coe1*m_lambda(lam1,x,n)): fi: Q: end: SPtoMyz:=proc(P,x,n,m) local P1; P1 := expand(P): if P1 = 0 then return(0): fi: if Symm(P1,x,n)<>P1 then return(FAIL); fi: convert(map(proc(p) p[1]*m[op(p[2])] end proc, map(MonomToPar,{op(P1)},x,n) ), `+`); end: EtoH:=proc(n): multiply( MtoH(n),EtoM(n)): end: EtoP:=proc(n): multiply( MtoP(n),EtoM(n)): end: HtoE:=proc(n): multiply( MtoE(n),HtoM(n)): end: HtoP:=proc(n): multiply( MtoP(n),HtoM(n)): end: PtoH:=proc(n): multiply( MtoH(n),PtoM(n)): end: PtoE:=proc(n): multiply( MtoE(n),PtoM(n)): end: