Hello GAP Forum,
  I thought it would be useful to have a function that generates a
basis for the space of symmetric polynomials in the ring
k[x_1,x_2,..,x_n]. Here is some simple code that does the job.
  The code is implemented only for k[x,y,z] right now, but changing it
to any number of variables is straightforward.
  The code is not the most efficient possible certainly, but it works...

  Ravi

#####################################################################
# symPol(k)
#############
# symPol(k) will return a basis for the space of symmetric polynomials
# of degree k in three variables x,y,z
# WARNING: It is assumed that x,y,z exist in the environment!
# Do this first, before invoking symPol:

# gap> R := PolynomialRing(Rationals,3);;       
# gap> inds := IndeterminatesOfPolynomialRing(R);;
# gap> x := inds[1];; y := inds[2];; z := inds[3];;
#############

symPol := function(k)
  local lis1, i, j, outlist, outpolist;
        lis1 := Tuples([0..k],3); # am interested in C^3 only
        
        # now only retain those elements of lis1 whose sum equals k
        outlist := "";
        for i in [1..Length(lis1)] do
                if Sum(lis1[i]) = k then
                        Add(outlist, lis1[i]);
                fi;
        od;
        
        outpolist := "";
        for j in [1..Length(outlist)] do
                
Add(outpolist,x^(outlist[j][1])*y^(outlist[j][2])*z^(outlist[j][3]));
        od;
        return Reversed(outpolist);
end;
#####################################################################

_______________________________________________
Forum mailing list
Forum@mail.gap-system.org
http://mail.gap-system.org/mailman/listinfo/forum

Reply via email to