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
|