next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: parts

parts -- display terms of a polynomial degree by degree

Synopsis

Description

By default, Macaulay2 displays a polynomial RingElement by putting its terms in decreasing order, with respect to the MonomialOrder of the ambient ring. On the other hand, parts will display the terms in order of increasing degree, regardless of the term order of the ring. Parentheses group together all terms of the same degree.

i1 : R = QQ[x,y];
i2 : f = (x + y + 1)^2

      2           2
o2 = x  + 2x*y + y  + 2x + 2y + 1

o2 : R
i3 : parts f

                         2           2
o3 = (1) + (2x + 2y) + (x  + 2x*y + y )

o3 : Expression of class Sum
i4 : R = QQ[x,y, MonomialOrder => Lex];
i5 : f = (x + y + 1)^2

      2                2
o5 = x  + 2x*y + 2x + y  + 2y + 1

o5 : R
i6 : parts f

                         2           2
o6 = (1) + (2x + 2y) + (x  + 2x*y + y )

o6 : Expression of class Sum

The output is an Expression of a special class, Parenthesize. Accessing the individual parenthesized parts of this expression is difficult, so for this purpose it may be better to use part.

i7 : part(2, f)

      2           2
o7 = x  + 2x*y + y

o7 : R
i8 : part(0, 1, f)

o8 = 2x + 2y + 1

o8 : R

See also

Ways to use parts :