#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: #Park(n,k): The set of partitions of n into exactly k parts Park:=proc(n,k) local S,k1,S1,s1: option remember: if nn then RETURN(0): fi: if n=0 then if k=0 then RETURN(1): else RETURN(0): fi: fi: expand(eknC(k,n-1,x)+ x[n]*eknC(k-1,n-1,x)): end: