/*
This subroutine a list of all powers for a polynomial up to and including
the arguments.
Copyright (C) 1999  Dan Stanger

This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2 of the License, or (at
your option) any later version.

This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Library General Public License for more details.

You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA

Dan Stanger dan.stanger@internut.com
please contact me for updates to this code or
look on my web page (currently www.diac.com/~dxs)

example:
 makeOrders([a,b],[2,3]) returns 
[[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3],[2,0],[2,1],[2,2],[2,3]],
which are the powers of each term of
expand((1+a+a^2)*(1+b+b^2+b^3))
*/
makeOrders(indvarlist,orderlist):=
      sort(
	   maplist(lambda([u],maplist(lambda([a],hipow(u,a)),
				      indvarlist)),
                   expand(
			  apply("*",
				    maplist(lambda([x,n],sum(x^i,i,0,n)),
					    indvarlist,
					    orderlist)))))$
