MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

monomials in Graded Lexicographic Order and associated factorials

  • To: mathgroup at
  • Subject: [mg73787] monomials in Graded Lexicographic Order and associated factorials
  • From: "er" <erwann.rogard at>
  • Date: Wed, 28 Feb 2007 04:37:43 -0500 (EST)


i just want to share my code below and ask for any suggestion to speed
up the function FactorialList below,
which takes up about as much time to complete as PowerList, mostly due
to function aux. storing a table of values to avoid repeated
computation seems to be the easiest solution. however, i'm hoping to
avoid that, perhaps by exploiting the particular GLO structure.

here's the usage i'm interested in: "PowerList[GDO,max,{x1,...,xD}]
returns { {{x1\^p1*...*xD^pD:|p|=q},q=0,...,max } where |p|=p1+...+pD;
FactorList[GDO,D,max] returns the corresponding mv-factorial terms:
{ {p1!*...*pD!:|p|=q},q=0,...,max }", e.g.

In[1] := PowerList[GLO, 2, {a, b, c}]
FactorialList[GLO, d, 2]
Out[2] = {{1}, {a, b, c}, {a ^ 2, a b, a c, b^ 2, b c, c^ 2}}
Out[2] = {{1}, {1, 1, 1}, {2, 1, 2, 1, 1, 2}}

GLO/:PowerList[GLO,p_,vars_]:=With[{rev=Reverse[vars]}, Join[{{1}},
Flatten/@Map[Reverse,           NestList[rev*Flatten/
@foldList[#]&,List/@rev,p-1],2]] ];
GLO/: FactorialList[GLO,d_,p_]:=Map[Times@@Factorial[#]&,aux[d,p],{2}];

  • Prev by Date: Re: Hold and Equal
  • Next by Date: Re: Computing a covariance matrix
  • Previous by thread: Beginner--Problem with FilledPlot
  • Next by thread: Unexpected message 2