Help:=proc(): print(` GenPol(varL, degL,a) `) :end: #GenPol(varL,degL,a): inputs a list of variables #a list of non-negative integers, and a symbol a #outputs a polynomial (of degrees given by degL) #whose coefficients are a[s0],a[s0+1], ... #and the set of coefficients GenPol:=proc(varL,degL,a,s0) local P,var,x,n,d,i,varL1,P1,aek,c,degL1: if nops(degL)<>nops(varL) then ERROR(`Bad input`): fi: n:=nops(varL): x:=varL[n]: d:=degL[n]: if n=1 then RETURN(add(a[i+s0]*x^i,i=0..d), {seq(a[i],i=s0..s0+d)}): fi: varL1:=[op(1..n-1,varL)]:degL1:=[op(1..n-1,degL)]: P:=0: c:=s0: var:={}: for i from 0 to d do aek:=GenPol(varL1,degL1,a,c): P1:=aek[1]: var:=var union aek[2]: c:=c+nops(aek[2]): P:=expand(P+P1*x^i): od: P,var: end: