collecting terms



On Sun, 16 Jan 2005 11:30:33 -0800, Richard Fateman
 wrote:
> I don't understand the continuing discussion on this point.
> What Stavros has written does not provide an expression
> as a SUM OF MONOMIALS, which was the original request.

I think we will simply have to await clarification from Fabrizio on
what exactly he wants.  What is and isn't a monomial depends on what
you're defining as the coefficient ring, doesn't it?  If you have a
(univariate) polynomial in x with coefficients in the ring of
polynomials in y over the integers, then (y+1)*x is a monomial.  If on
the other hand, you have a bivariate polynomial. in x and y, then it
is not: it is the sum of the monomials x*y and y.

I agree that Ratexpand (with the appropriate ratvar ordering) may well
be what he wants.  Ratexpand is just a very thin wrapper on top of
Rat, anyway -- but doesn't allow specifying variable order.

In fact, Rat(...,var) may be what he wants since it allows specifying
the variable odering.  In General Representation, the ordering of
variables is global, so it's not possible to have a simplified
expression like

        [x+y ,        <-- expanded w.r.t. x
         y+x ]         <-- expanded w.r.t. y

whereas CRE does support it:

      [ rat(x+y,x), rat(x+y,y) ]

In fact, the polyform function uses rat; it simply avoids
unnecessarily expanding the coefficients.