nunavutpanther

10 Reputation

One Badge

7 years, 247 days

MaplePrimes Activity


These are questions asked by nunavutpanther

I'm trying to create the set of monomials in n variables (given as a list var), up to a given degree d. Her eis my code. Any comments to make it better?

mondeg:=proc(var::list,d)
local n, mon, moni, i, j, m1, m;

   n:=nops(var);
   mon:={1};
   moni:={1};
   for i to d do
        for m1 in moni do
             #print(m1);
             moni:=moni minus {m1};
             #print(moni);
             for j to n do
                #print(var[j]);
                 m:=m1*var[j];
                 moni:=moni union {m};
                #print("moni=",moni);
             od;
        od;
        mon:=mon union moni;
        #print(mon);
   od;

mon;
end:

Page 1 of 1