Symmetric functions
These are from the first lab on symmetric functions.
These functions can also be loaded in from the file
on symmetric functions.
> readlib(coeftayl);
hn2p returns hn in the p-basis
>
hn2p:=proc(n) option remember; local k,t;
coeftayl(exp(add(p.k/k*t^k,k=1..n)),t=0,n);
end:
en2p returns en in the p-basis
>
en2p:=proc(n) option remember; local k,t;
(-1)^n*coeftayl(exp(-add(p.k/k*t^k,k=1..n)),t=0,n);
end:
var2val converts variables that begin with a letter and end with a number into a number
e.g. h6 -> 6 and p25 -> 25 more generally h3p1h2 -> 312
>
var2val:=proc(var) local i,val,nums,ps;
nums:=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`,`0`];
val:=0;
for i from 1 to length(var) do
if member(substring(var,i..i),nums,'ps') then
if ps=10 then ps:=0; fi;
val:=val*10+ps;
fi;
od;
val;
end:
h2p converts a polynomial or expression in the h-variables and converts them to an
expression in the p-basis
>
h2p:=proc(HEX) local ids;
ids:=select(x->evalb(substring(x,1..1)='h'),indets(HEX,`symbol`));
subs({seq(var=hn2p(var2val(var)),var=ids)},HEX);
end:
e2p does the same thing for the e-variables
>
e2p:=proc(EEX) local ids;
ids:=select(x->evalb(substring(x,1..1)='e'),indets(EEX,`symbol`));
subs({seq(var=en2p(var2val(var)),var=ids)},EEX);
end:
>
hhh:=proc(val);
if val<0 then 0;
elif val=0 then 1;
else
cat('h',val);
fi;
end:
Take a partition la and return the Schur basis indexed by the partition
>
Schur_in_h:=proc(la) local i,j;
linalg[det]([seq([seq(hhh(la[i]-i+j),i=1..nops(la))],
j=1..nops(la))]);
end:
>
Schur_in_p:=proc(la);
expand(h2p(Schur_in_h(la)));
end:
>
subPar:=proc(n, row, col) local i;
if n=0 then RETURN([[]]) fi;
if col=0 then RETURN([]) fi;
[seq(op(map((x, y)->[y, op(x)],
subPar(n+i,-i,col-1),-i)),
i =-min(row,n)..-iquo(n+col-1,col))];
end:
List all partitions:
>
listPar:=proc(n)
subPar(n,n,n);
end:
>
pla:=proc(la) local i;
mul(cat('p',la[i]),i=1..nops(la));
end:
>
peh2s:=proc(EX) local pEX, allps, pzEX, degzs, out, i, pEXd, slst;
pEX:=expand(h2p(e2p(EX)));
allps:=select(x->type(x,`symbol`) and
evalb(substring(x,1..1)='p'), indets(pEX));
pzEX:=expand(subs({seq(cat('p',k)=z^k*cat('p',k),
k=map(var2val,allps))},pEX));
degzs:=degree(pzEX,z);
out:=subs(z=0,pzEX);
for i from 1 to degzs do
pEXd:=coeff(pzEX,z,i);
if pEXd<>0 then
slst:=solve({coeffs(expand(pEXd-add(c[la]*Schur_in_p(la),
la=listPar(i))), {seq(cat('p',j),j=1..i)})});
out:=out+subs(slst, add(c[la]*s[op(la)],la=listPar(i)));
fi;
od;
out;
end: