Re: What happened to MonomialList?
- To: mathgroup at smc.vnet.net
- Subject: [mg24796] Re: What happened to MonomialList?
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Thu, 10 Aug 2000 00:33:07 -0400 (EDT)
- References: <B5B6EEED.76E7%andrzej@tuins.ac.jp>
- Sender: owner-wri-mathgroup at wolfram.com
Andrzej Kozlowski wrote: > > Recently, I have been doing quite a lot of computations using GroebnerBasis. > The last time I used it so extensively was with version 3, and I have been > having a strange feeling that things used to be easier then. Particularly I > was not very happy that I have had to program a number of basic functions > myself from scratch, e.g. a LeadingTerm (with respect to a given > MonomialOrder) function. Then I looked at my old notebooks and realized > something really strange. The MonomialList function has disappeared and > nothing seems to have been provided in its place. What is more weird is that > MonomialList still appears in the Documentation for GroebnerBasis: > > MonomialList[ poly, {x1, ..., xn}] gives a list of the monomials in poly in > the order used by GroebnerBasis. MonomialList takes the same options as > GroebnerBasis. > > But unlike Mathematica 3.0, 4.0 knowsn nothing about MonomialList: > > In[1]:= > ?MonomialList > >From In[1]:= > Information::"notfound": "Symbol \!\(\"MonomialList\"\) not found." > > Any explanation? > > -- > Andrzej Kozlowski > Toyama International University, JAPAN > > For Mathematica related links and resources try: > <http://www.sstreams.com/Mathematica/> Last things first. The fact that MonomialList is gone but appears in the documentation is a known bug. As for what replaces it...there is internal functionality that I believe should be made visible and documented, but this is not my call. The new functionality is more general, using a flexible representation of the polynomial(s) as a list of exponent vector and coefficient pairs, ordered by MonomialOrder on the exponent vectors. The function I refer to is Internal`DistributedTermsList. I've had cause to use it twice in this forum, see e.g. http://library.wolfram.com/mathgroup/archive/1999/Oct/msg00076.html Below is something of an explanation for what it does. Since it is an internal function, this is subject to change. We start with a simple example. In[9]:= InputForm[dlist = Internal`DistributedTermsList[1/2 + 2/3 x^2 + 4/5 y^2, {x,y}]] Out[9]//InputForm= {{{{2, 0}, 2/3}, {{0, 2}, 4/5}, {{0, 0}, 1/2}}, {x, y}} To get something akin to the old MonomialList result, one can now do: In[10]:= InputForm[mlist = Internal`FromDistributedTermsList[dlist, List]] Out[10]//InputForm= {(2*x^2)/3, (4*y^2)/5, 1/2} DistributedTermsList will return an ordered pair of the form {internal distributed polynomial, ordered variables} The ordered variables are needed in case either internal variables were created (try it with y^(1/2) instead of y^2) or in case Sort->True was specified. The internal polynomial consists of a list of ordered pairs of the form {exponent vector, coefficient} These are ordered by decreasing exponent vectors, as determined by the given monomial order (default is lexicographic). As above we provide a function that will convert from this form back to the input expression (possibly expanded or partially collected, depending on what variables are specified, whether input was expanded, etc.). There is an optional second argument to apply to the individual terms; if unspecified we use Plus. In the example above I explicitly used List so we get a list in decreasing monomial order. Possibly this notion should be extended so that we also might apply some function to all factors within a given term. Another extension to this functionality might be to output a weight matrix in DistributedTermsList in addition to the distributed polynomial and ordered variables. Thus far I've not really had a compelling reason to do this (might be useful if the input was not a legitimate "polynomial" and internal variables were created e.g. for radicals). Daniel Lichtblau Wolfram Research