#April 16, 2026 C23.txt Help23:=proc(): print(`pTOmMat(n), inv(pi), IsAsymS(f,x,n), IsASym(f,x,n)`): print(`ASymm(f,x,n), Sc(x,L), ScBase(n,x) `): end: #pTOmMat(n): The nops(Par(n)) by nops(Par(n)) matrix whose [i,j] entry is the coefficient of #pBase(n)[j] For example: #pTOmMat(4); pTOmMat:=proc(n) local EB,x,i: EB:=pBase(n,x): matrix([seq(mVec(EB[i],x,n),i=1..nops(EB))]): end: #inv(pi): The number of inversions of the per. pi inv:=proc(pi) local n,i,j,co: n:=nops(pi): co:=0: for i from 1 to n do for j from i+1 to n do if pi[i]>pi[j] then co:=co+1: fi: od: od: co: end: #IsASymS(f,x,n): checks that all the images of f under the symmetric group #coincide with the sign of the perm. times f (that is an anti-symmetric polynomial) IsASymS:=proc(f,x,n) local Sn,pi: Sn:=combinat[permute](n): evalb(expand({seq((-1)^inv(pi)*SubsPi(f,x,pi), pi in Sn)})={expand(f)}): #[expand({seq((-1)^inv(pi)*SubsPi(f,x,pi), pi in Sn)}),{expand(-f)}]; end: #IsASym(f,x,n): checks that f(x[1], ..., x[n]) is symmetric the Pablo way IsASym:=proc(f,x,n) local i: evalb(expand({seq(subs({x[i]=x[i+1],x[i+1]=x[i]},f),i=1..n-1)})={expand(-f)}): end: #Symm(f,x,n): inputs an ARBITRARY polynomial f(x[1],...,x[n]) and #outputs the sum of all the images of f under S_n Symm:=proc(f,x,n) local Sn,pi: Sn:=permute(n): add(SubsPi(f,x,pi), pi in Sn): end: #ASymm(f,x,n): inputs an ARBITRARY polynomial f(x[1],...,x[n]) and #outputs the sum of all the images of f under S_n times the sign of the perm. ASymm:=proc(f,x,n) local Sn,pi,i,F: Sn:=combinat[permute](n): F:=0: for i from 1 to nops(Sn) do F:=F+(-1)**inv(Sn[i])*SubsPi(f,x,Sn[i]): od: F: #add(((-1)**inv(pi))*(SubsPi(f,x,pi)), pi in Sn): end: #Sc(x,L): Inputs a partion L (of n, say) and outputs s_L(x[1], ..., x[n]) Sc:=proc(x,L) local L1,i,j,k,n: n:=convert(L,`+`): k:=nops(L): L1:=[op(L),0$(n-k)]: L1:=[seq(L1[i]+n-i,i=1..n)]: normal(ASymm(mul(x[i]^L1[i],i=1..n),x,n)/mul(mul(x[i]-x[j],j=i+1..n),i=1..n)): end: #Added after class #ScBase(n,x): The Schur-base of the algebra of symmetric polynomials of degree n in x[1],...,x[n] ScBase:=proc(n,x) local P,i: P:=Par(n): expand([seq( Sc(x,P[i]), i=1..nops(P))]): end: #From previous classes #C22.txt April 13, 2026 Help22:=proc(): print(`Rev(L), mBase(n,x), eBase(n,x) , pBase(n,x), hkn(k,n,x), hBase(n,x) `): print(`Coe(f,x,L), mVec(f,x,n), eTOmMat(n) `): end: #mBase: The basis of Monomial Symmetric polynomial of total degree n mBase:=proc(n,x) local P,i: P:=Par(n): [seq(mL(x,n,P[i]),i=1..nops(P))]: end: #eBase(n,x): The e-base of the algebra of symmetric polynomials of degree n in x[1],...,x[n] eBase:=proc(n,x) local P,i,j: P:=Par(n): expand([seq( mul(ekn(P[i][j],n,x),j=1..nops(P[i])), i=1..nops(P))]): end: #pBase(n,x): The p-base of the algebra of symmetric polynomials of degree n in x[1],...,x[n] pBase:=proc(n,x) local P,i,j: P:=Par(n): expand([seq( mul(pkn(P[i][j],n,x),j=1..nops(P[i])), i=1..nops(P))]): end: #hkn(k,n,x): A cleverer way to output h_k(x[1], ..., x[n]) hkn:=proc(k,n,x) option remember: if k<0 then RETURN(0): fi: if k=0 then RETURN(1): fi: if n=0 then if k=0 then RETURN(1): else RETURN(0): fi: fi: expand(hkn(k,n-1,x)+ x[n]*hkn(k-1,n,x)): end: #hBase(n,x): The e-base of the algebra of symmetric polynomials of degree n in x[1],...,x[n] hBase:=proc(n,x) local P,i,j: P:=Par(n): expand([seq( mul(hkn(P[i][j],n,x),j=1..nops(P[i])), i=1..nops(P))]): end: #Coe(f,x,L): inputs any polynomial f of x[1], ..., x[n], and a list of integers #L output the coeff. of x[1]^L[1]*x[2]^L[2]*... Coe:=proc(f,x,L) local c,i: c:=f: for i from 1 to nops(L) do c:=coeff(c,x[i],L[i]): od: c: end: #mVec(f,x,n): inputs a symmetric poly of x[1], ..., x[n] of (total) degree n #outputs the coeffi vector (of length nops(Par(n)) when you express it in terms of #m-bases mVec:=proc(f,x,n) local P,i: P:=Par(n): [seq(Coe(f,x,P[i]),i=1..nops(P))]: end: #eTOmMat(n): The nops(Par(n)) by nops(Par(n)) matrix whose [i,j] entry is the coefficient of #mBase(n)[j] in eBase(n)[i], i.e. when eBase(n)[i] is expressed as a linear combination of m_L). For example: #eTOmMat(4); eTOmMat:=proc(n) local EB,x,i: EB:=eBase(n,x): matrix([seq(mVec(EB[i],x,n),i=1..nops(EB))]): end: with(linalg): #old stuff #C21.txt, April 9, 2026 Help21:=proc(): print(`SubsPi(f,x,pi), IsSymS(f,x,n) , IsSym(f,x,n) `): print(`Symm(f,x,n), rSymm(f,x,n), mL(x,n,L) , ekn(k,n,x), pkn(k,n,x) `): print(`eknC(k,n,x)`): end: with(combinat): #SubsPi(f,x,pi): inputs a polynomial f(x[1], ..., x[n]) (n:=nops(pi)) #and ouputs the new polynomial obtaine by substituting x[i]->x[pi[i]] SubsPi:=proc(f,x,pi) local n,i: n:=nops(pi): subs({seq(x[i]=x[pi[i]],i=1..n)},f): end: #IsSymS(f,x,n): checks that all the images of f under the symmetric group #coincide with f (that is a symmetric polynomial) IsSymS:=proc(f,x,n) local Sn,pi: Sn:=permute(n): evalb({seq(SubsPi(f,x,pi), pi in Sn)}={f}): end: #IsSym(f,x,n): checks that f(x[1], ..., x[n]) is symmetric the Pablo way IsSym:=proc(f,x,n) local i: evalb({seq(subs({x[i]=x[i+1],x[i+1]=x[i]},f),i=1..n-1)}={f}): end: #Symm(f,x,n): inputs an ARBITRARY polynomial f(x[1],...,x[n]) and #outputs the sum of all the images of f under S_n Symm:=proc(f,x,n) local Sn,pi: Sn:=permute(n): add(SubsPi(f,x,pi), pi in Sn): end: #rSymm(f,x,n): inputs an ARBITRARY polynomial f(x[1],...,x[n]) and #outputs the sum of all the distinct images rSymm:=proc(f,x,n) local Sn,pi: Sn:=permute(n): convert({seq(SubsPi(f,x,pi), pi in Sn)}, `+`): end: #Rev(L): the reverse of the list L Rev:=proc(L) local i,k: k:=nops(L): [seq(L[k-i],i=0..k-1)]: end: #Par(n): The set of partitions of n, the clever way. Par:=proc(n) local P,i: P:=partition(n): Rev([seq(Rev(P[i]),i=1..nops(P))]): end: #mL(x,n,L): inputs a variable name x a positive integer n and #an integer partition L outputs the symmetrizer of #x[1]^L[1]*...*x[nops(L)]^L[nops(L)], m_L(x[1], ..., x[n]) #MONOMIAL symmetric polymomial mL:=proc(x,n,L) local k,i: k:=nops(L): rSymm(mul(x[i]^L[i],i=1..k),x,n): end: #eknS(k,n,x): The elementary symmetric polynomial of degree k in x[1], ..., x[n] eknS:=proc(k,n,x) rSymm(mL(x,n,[1$k]),x,n ): end: #pkn(k,n,x): The power symmetric polynomial pkn:=proc(k,n,x) rSymm(mL(x,n,[k]),x,n ): end: #ekn(k,n,x): A cleverer way to output e_k(x[1], ..., x[n]) ekn:=proc(k,n,x) option remember: if k>n then RETURN(0): fi: if n=0 then if k=0 then RETURN(1): else RETURN(0): fi: fi: expand(ekn(k,n-1,x)+ x[n]*ekn(k-1,n-1,x)): end: