This is the commit for a fiz of the WxMaxima debug issue.
[maxima.git] / share / contrib / makeOrders.mac
blobf2212d8e902268cd72540ab162346668b598a7ea
1 /*
2 This subroutine a list of all powers for a polynomial up to and including
3 the arguments.
4 Copyright (C) 1999  Dan Stanger
6 This library is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Library General Public License as published
8 by the Free Software Foundation; either version 2 of the License, or (at
9 your option) any later version.
11 This library is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
20 Dan Stanger dan.stanger@internut.com
21 please contact me for updates to this code or
22 look on my web page (currently www.diac.com/~dxs)
24 example:
25  makeOrders([a,b],[2,3]) returns 
26 [[0,0],[0,1],[0,2],[0,3],[1,0],[1,1],[1,2],[1,3],[2,0],[2,1],[2,2],[2,3]],
27 which are the powers of each term of
28 expand((1+a+a^2)*(1+b+b^2+b^3))
30 makeOrders(indvarlist,orderlist):=
31       sort(
32            maplist(lambda([u],maplist(lambda([a],hipow(u,a)),
33                                       indvarlist)),
34                    expand(
35                           apply("*",
36                                     maplist(lambda([x,n],sum(x^i,i,0,n)),
37                                             indvarlist,
38                                             orderlist)))))$