The Program support  the paper
Average norms of polynomials

> #program to find the expression mu_T^alpha(n).
     The input is the set T, the alpha and the n,
     The output is mu_T^alpha(0)+mu_T^alpha(1)x+...+mu_T^alpha(n)x^n
> #To apply this program, just write: genmu(alpha,n,set) where set is given by nonempty vector.

bjind:=proc()
local n,d,j1,i1,i2,i3: n:=args[1]: d:=args[2]:
for i1 from 1 to n do j1[1,i1]:=1: od:
for i1 from 2 to d^n do
    for i2 from 1 to n do j1[i1,i2]:=j1[i1-1,i2]: od:
   i2:=n: while (j1[i1,i2]=d and i2>0) do i2:=i2-1: od:
   j1[i1,i2]:=j1[i1,i2]+1:
   for i3 from i2+1 to n do j1[i1,i3]:=1: od:
od: RETURN(j1): end:

biind:=proc()
local n,d,j1,j2,i1,i2,i3,s: n:=args[1]: d:=args[2]: j1:=bjind(n,d+1):  i3:=0:
for i1 from 1 to (d+1)^n do
   s:=0: for i2 from 1 to n do s:=s+j1[i1,i2]: od:
   if (s-n=d) then i3:=i3+1: for i2 from 1 to n do j2[i3,i2]:=j1[i1,i2]-1: od: fi:
od: RETURN(j2): end:

mu:=proc()
local a,n,T,d,Jind,Kind,Lind, klong,mu,s,s1, i0,i1,i2,i3,i4: a:=args[1]: n:=args[2]: T:=args[3]:
klong:=binomial(n+a-1,a): d:=nops(T): Jind:=bjind(n,d): Kind:=biind(n,a): Lind:=biind(n,a): mu:=0:
for i0 from 1 to d^n do
   for i1 from 1 to klong do
     for i2 from 1 to klong do s:=0:
        for i4 from 1 to n do s:=s+(i4-1)*(Lind[i2,i4]-Kind[i1,i4]): od:
        if (s=0) then s1:=a!^2: for i4 from 1 to n do if T[Jind[i0,i4]]<>0  then
                   s1:=s1/Kind[i1,i4]!/Lind[i2,i4]!*T[Jind[i0,i4]]^Kind[i1,i4]*conjugate(T[Jind[i0,i4]])^Lind[i1,i4]:
                   else s1:=0: fi: od:
       mu:=mu+s1*X^(n-1)/d^n: fi:
od: od: od: RETURN(mu): end:

genmu:=proc()
local a,n,T,ss,i: a:=args[1]: n:=args[2]: T:=args[3]: ss:=0:
for i from 1 to n+1 do ss:=ss+mu(a,i,T): od:
RETURN(ss): end:

>
> #genmu(alpha,degree,set)
> #example1: to find mu_{-1,1}^2(0..4); we do
> genmu(2,4,[1,-1]);

                   1 + 6 X^2 + 19 X^3  + 44 X^4  + 85 X^5
> #-----------------------------------------------------------------------------

>#Here we are interesting to find the generating function E_T(x,v,u,w) in the paper AVERAGE NORMS OF POLYNOMIALS. So the input of the procedure findxw() is alpha and the output is the e_T^{alpha,alpha}(x,w):
>
> #REMARKS:
> #1: xx[ii] denote the element x_i in T, and yy[ii] the conjecuted element of xx[ii].
> #2: f[i,j] is the diff(diff(e_T(x,u,v,w),u^i),v^j))
> #3: A[i,j]=A_T^{i,j}
> #4: if you want to apply this program for set T with sum(t,t\in T)=0 you should put A[1,0]=0 and A[0,1]=0 after f[0,0]:=1/(1-x) in the procedure findxw
> ### WARNING: persistent store makes one-argument readlib obsolete

> restart: readlib(mtaylor):
   findxw:=proc() option remember; local pp,pq,pm,sd,nsd,n,i,j,mat,funct,i1,l1,l2,vv,f,gg,p1,p2: n:=args[1]: funct:=sum(1/d/(1-xx[ii]*u)/(1-yy[ii]*v)+x/d/(1-xx[ii]*u)/(1-yy[ii]*v)*a(x,u/w/(1-xx[ii]*u),w*v/(1-yy[ii]*v),w),'ii'=1..d): f[0,0]:=1/(1-x): for i from 0 to n do for j from 0 to n do if i=0 and j=0 then sd:=funct: else if i=0 then sd:=diff(funct,v$j) fi: if j=0 then sd:=diff(funct,u$i) fi: if i*j<>0 then sd:=diff(diff(funct,u$i),v$j): fi: fi: if (i+j>0) then sd:=subs(u=0,v=0,sd):  sd:=op(sd)[1]: sd:=subs(yy[ii]=yy,xx[ii]=xx,a(x,0,0,w)=f[0,0],sd):  for pm from 1 to i+j do vv:=vector(pm,[]): for l1 from 0 to pm do for i1 from 1 to l1 do vv[i1]:=2: od: for i1 from l1+1 to pm do vv[i1]:=3: od:  vv:=convert(vv,list): vv:=D[op(vv)](a)(x,0,0,w):  sd:=subs(vv=f[l1,pm-l1],sd): od: od: sd:=subs(f[i,j]=d*f[i,j],sd): gg:=mtaylor(sd,{xx=0,yy=0},(n+1)*2): nsd:=coeff(coeff(gg,xx,0),yy,0): for p1 from 0 to n do for p2 from 0 to n do if p1+p2<>0 then nsd:=nsd+coeff(coeff(gg,xx,p1),yy,p2)*A[p1,p2]: fi: od: od:  f[i,j]:=(solve(f[i,j]=nsd,f[i,j])):  print("finished the deff",E_T[i,j]); fi: od: od:  RETURN(f[n,n]): end:
> #--------------------------------------------------------------
> #example1: we want to find the e_T^{1,1}:
> g:=findxw(1):
                    "finished the deff", E_T[0, 1]

                    "finished the deff", E_T[1, 0]

                    "finished the deff", E_T[1, 1]

>#remark: g will contain the answer.
> #---------------------------------------------------------------
> #example2: we want to find the e_T^{2,2}:
> g:=findxw(2):

                    "finished the deff", E_T[0, 1]
                    "finished the deff", E_T[0, 2]
                    "finished the deff", E_T[1, 0]
                    "finished the deff", E_T[1, 1]
                    "finished the deff", E_T[1, 2]
                    "finished the deff", E_T[2, 0]
                    "finished the deff", E_T[2, 1]
                    "finished the deff", E_T[2, 2]

> # If we want under the condition A_T^{1,0}=0 we should do (another approach):

> A[1,0]:=0: A[0,1]:=0: f2:=simplify(g):  #f2 contains the e_T^{2,2}(x,w) with A_T^{0,1}=0.

> #To find the free coefficient of w in f2 do
For n from 0 to 6 do ss:=coeff(expand(coeff(taylor(f2,x=0,10),x,n)),w,0)/(2!^2): print("the coeff of",x^n," is  ",ss): od:
                                                          A[2, 2]
                 "the coeff of", 1, " is  ", -------
                                                              d
                                                                                             2
                                                       2 A[2, 2]       4 A[1, 1]
          "the coeff of", x, " is     ", ------------ + ---------- ---
                                                             d                    2
                                                                                 d
                                                                                                 2
                                      2                  3 A[2, 2]       12 A[1, 1]
         "the coeff of", x , " is     ",----- --------- + ----------------
                                                                d                2
                                                                                 d
                                                                                                 2
                                      3                4 A[2, 2]         24 A[1, 1]
         "the coeff of", x , " is      ", ------------- + ---------------
                                                            d                         2
                                                                                     d
                                                                                                 2
                                     4                5 A[2, 2]          40 A[1, 1]
         "the coeff of", x , " is      ", ------------- + ---------------
                                                             d                      2
                                                                                   d
                                                                                                 2
                                      5                6 A[2, 2]         60 A[1, 1]
         "the coeff of", x , " is      ", ------------- +---- -----------
                                                             d                       2
                                                                                    d
                                                                                               2
                                      6               7 A[2, 2]        84 A[1, 1]
         "the coeff of", x , " is      ", ------------ + ---------------
                                                            d                          2
                                                                                      d
>