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

part(ZZ,ZZ,VisibleList,RingElement) -- select terms of a polynomial by degree or weight

Synopsis

Description

i1 : R = QQ[x,y,z,Degrees=>{3,2,1}];
i2 : f = (1+x+y+z)^3

      3     2        2     2      2    3                     2        2     2
o2 = x  + 3x y + 3x*y  + 3x z + 3x  + y  + 6x*y*z + 6x*y + 3y z + 3x*z  + 3y 
     ------------------------------------------------------------------------
                  2                3          2
     + 6x*z + 3y*z  + 3x + 6y*z + z  + 3y + 3z  + 3z + 1

o2 : R
i3 : part(0,1,3:1,f)

o3 = 3x + 3y + 3z + 1

o3 : R
i4 : part(0,1,1..3,f)

o4 = 3x + 1

o4 : R
i5 : part(7,9,1..3,f)

       2        2       2    3
o5 = 3y z + 3x*z  + 3y*z  + z

o5 : R

If wt is omitted, and the ring is singly graded, then the degrees of the variables are used as the weights.

i6 : gens R

o6 = {x, y, z}

o6 : List
i7 : degree \ oo

o7 = {{3}, {2}, {1}}

o7 : List
i8 : part(7,9,f)

      3     2        2     2
o8 = x  + 3x y + 3x*y  + 3x z

o8 : R

If lo or hi is omitted, but not the corresponding comma, then there is no corresponding bound on the weights of the terms provided.

i9 : part(7,,f)

      3     2        2     2
o9 = x  + 3x y + 3x*y  + 3x z

o9 : R
i10 : part(,3,f)

                   3          2
o10 = 3x + 6y*z + z  + 3y + 3z  + 3z + 1

o10 : R
i11 : part(,3,1..3,f)

       3     2
o11 = x  + 3x  + 6x*y + 3x + 3y + 3z + 1

o11 : R

The bounds may be infinite.

i12 : part(7,infinity,f)

       3     2        2     2
o12 = x  + 3x y + 3x*y  + 3x z

o12 : R
i13 : part(-infinity,3,f)

                   3          2
o13 = 3x + 6y*z + z  + 3y + 3z  + 3z + 1

o13 : R
i14 : part(-infinity,infinity,1..3,f)

       3     2        2     2      2    3                     2        2  
o14 = x  + 3x y + 3x*y  + 3x z + 3x  + y  + 6x*y*z + 6x*y + 3y z + 3x*z  +
      -----------------------------------------------------------------------
        2              2                3          2
      3y  + 6x*z + 3y*z  + 3x + 6y*z + z  + 3y + 3z  + 3z + 1

o14 : R

If just one limit is provided, terms whose weight are equal to it are provided.

i15 : part(7,f)

          2     2
o15 = 3x*y  + 3x z

o15 : R
i16 : part(7,1..3,f)

        2        2
o16 = 3y z + 3x*z

o16 : R

For polynomial rings over polynomial rings, all of the variables participate.

i17 : S = QQ[a][x];
i18 : g = (1+a+x)^3

       3            2      2               3     2
o18 = x  + (3a + 3)x  + (3a  + 6a + 3)x + a  + 3a  + 3a + 1

o18 : S
i19 : part(2,{1,1},g)

        2            2
o19 = 3x  + 6a*x + 3a

o19 : S
i20 : part(2,{1,0},g)

               2
o20 = (3a + 3)x

o20 : S
i21 : part(2,,{0,1},g)

        2     3     2
o21 = 3a x + a  + 3a

o21 : S