Macaulay2 » Documentation
Packages » Macaulay2Doc » matrices » Matrix » support
next | previous | forward | backward | up | index | toc

# support -- list of variables occurring in a polynomial or matrix

- Usage:
    `support f`
- Inputs:
  - f, a ring element, or a matrix over a polynomial ring
- Outputs:
  - a list, of ring elements, the variables occurring in f

## Description

    i1 : R = QQ[a..g]

    o1 = R

    o1 : PolynomialRing

    i2 : f = a^3+b^2*c+3*f^10*d-1+e-e

             10    3    2
    o2 = 3d*f   + a  + b c - 1

    o2 : R

    i3 : support f

    o3 = {a, b, c, d, f}

    o3 : List

    i4 : M = matrix"a+b2,c+g2;c,a-1"

    o4 = | b2+a g2+c |
         | c    a-1  |

                 2      2
    o4 : Matrix R  <-- R

    i5 : support M

    o5 = {a, b, c, g}

    o5 : List

If the ring is a polynomial ring over another polynomial ring, then the support contains all of the variables, even the ones in the coefficient ring. The ring of each of these is the ring of f.

    i6 : A = ZZ[a,b]; B = A[r,s,t]; C = B[x,y,z,w];

    i9 : f = (a+r+z+1)^2+y

          2                         2                2
    o9 = z  + y + (2r + 2a + 2)z + r  + (2a + 2)r + a  + 2a + 1

    o9 : C

    i10 : S = support f

    o10 = {y, z, r, a}

    o10 : List

    i11 : ring S_2 === ring f

    o11 = true

Here is one way to select only the top level variables.

    i12 : select(S, x -> index x < numgens C)

    o12 = {y, z}

    o12 : List

To obtain a list of the integer indices of the variables one can use either indices(RingElement) or apply index to each variable.

    i13 : indices f

    o13 = {1, 2, 4, 7}

    o13 : List

    i14 : apply(support f, index)

    o14 = {1, 2, 4, 7}

    o14 : List

## See also

- index -- numeric index of a ring variable
- indices(RingElement) -- indices of variables occurring in a polynomial
- indices(Matrix) -- indices of variables occurring in a polynomial
- Ring _ ZZ -- get a ring variable by index

## Ways to use support:

- `support(Matrix)`
- `support(RingElement)`
- support(Ideal) -- list of variables occurring in the generators of an ideal

## For the programmer

The object support is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Macaulay2Doc/functions/support-doc.m2:41:0.