Re: monomials in Graded Lexicographic Order and associated factorials

• To: mathgroup at smc.vnet.net
• Subject: [mg73802] [mg73802] Re: [mg73787] monomials in Graded Lexicographic Order and associated factorials
• From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
• Date: Fri, 2 Mar 2007 05:59:40 -0500 (EST)
• References: <200702280937.EAA24658@smc.vnet.net>

```On 28 Feb 2007, at 10:37, er wrote:

> hi,
>
> 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.
> thanks.
>
> 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}}
>
> code:
> GLO/:PowerList[GLO,0,vars_]:={{1}};
> 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}];
>
>

There are few things about a post to this list which are more
discouraging to a potential responder than incomplete code (what is
aux ?) contining obious errors (what is foldList ?).

All I will say is that one can write faster code to perform these
tasks using Internal`DistributedTermsList but this is all I am
prepared to say in response to this kind of post.

Andrzej Kozlowski

```

• Prev by Date: Means
• Next by Date: fastest way to add up a billion numbers
• Previous by thread: Re: monomials in Graded Lexicographic Order and associated factorials
• Next by thread: Re: monomials in Graded Lexicographic Order and associated factorials