# The polynomial function changed to a set consisting of terms of polynomial function

I have the following polynomial function $$f= x_{1,2} x_{2,4}+x_{1,3} x_{3,2} x_{2,4}+x_{1,2} x_{2,3} x_{3,2} x_{2,4}+x_{1,3} x_{3,4}+x_{1,2} x_{2,3} x_{3,4}$$

I want to convert the polynomial function to set consisting of terms of polynomial function as follows,

$$\{x_{1,2} x_{2,4},x_{1,3} x_{3,2} x_{2,4},x_{1,2} x_{2,3} x_{3,2} x_{2,4},x_{1,3} x_{3,4},x_{1,2} x_{2,3} x_{3,4}\}$$

Then, delete terms that contain another terms in the set.

$$x_{1,2} x_{2,4}\subset x_{1,2} x_{2,3} x_{3,2} x_{2,4}$$

so we delete $x_{1,2} x_{2,3} x_{3,2} x_{2,4}$ and we get,

$$S=\{x_{1,2} x_{2,4},x_{1,3} x_{3,4},x_{1,3} x_{3,2} x_{2,4},x_{1,2} x_{2,3} x_{3,4}\}$$

the mathematica code of the polynomial function $f$

f=Subscript[x, 1, 2] Subscript[x, 2, 4] +
Subscript[x, 1, 3] Subscript[x, 2, 4] Subscript[x, 3, 2] +
Subscript[x, 1, 2] Subscript[x, 2, 3] Subscript[x, 2, 4] Subscript[x,
3, 2] + Subscript[x, 1, 3] Subscript[x, 3, 4] +
Subscript[x, 1, 2] Subscript[x, 2, 3] Subscript[x, 3, 4]


Thanks for the help.

• Shouldn't $S$ contain $x_{1,3}x_{3,4}$? – FalafelPita Aug 2 '17 at 17:16
• @FalafelPita This is a watery mistake thanks for a note. see new update – Emad kareem Aug 2 '17 at 17:20

You could use DeleteDuplicates + SortBy:

baseSet[f_] := DeleteDuplicates[
Denominator[#2/#1]==1&
]


baseSet[f] //TeXForm


$\left\{x_{1,2} x_{2,4},x_{1,3} x_{3,4},x_{1,2} x_{2,3} x_{3,4},x_{1,3} x_{2,4} x_{3,2}\right\}$

• Thank you very much for this right answer – Emad kareem Aug 2 '17 at 18:08

This method is overkill for the given example but could be useful for larger problems of this type. It uses two steps, both with non-System context functions. The first is to get the monomials as lists of exponent vectors and corresponding coefficients (the latter of which we will ignore). Then we use a function that effectively finds the minimal exponent vectors, discarding the rest.

f = x[1, 2] x[2, 4] + x[1, 3] x[2, 4] x[3, 2] +
x[1, 2] x[2, 3] x[2, 4] x[3, 2] + x[1, 3] x[3, 4] +
x[1, 2] x[2, 3] x[3, 4];


Here is the list of monomial/coefficient pairs along with the ordering of variables that was used to create it (useful for converting back to monomials but I am omitting that step).

dtl = GroebnerBasisDistributedTermsList[f, Variables[f]]

(* Out[291]= {{{{1, 1, 0, 1, 1, 0}, 1}, {{1, 1, 0, 0, 0, 0},
1}, {{1, 0, 0, 0, 1, 1}, 1}, {{0, 1, 1, 1, 0, 0},
1}, {{0, 0, 1, 0, 0, 1}, 1}}, {x[1, 2], x[2, 4], x[1, 3],
x[3, 2], x[2, 3], x[3, 4]}} *)


Here we pick out our exponent vectors.

monoms = dtl[[1, All, 1]]

(* Out[293]= {{1, 1, 0, 1, 1, 0}, {1, 1, 0, 0, 0, 0},
{1, 0, 0, 0, 1, 1}, {0, 1, 1, 1, 0, 0}, {0, 0, 1, 0, 0, 1}} *)


And now we get the minimal elements.

InternalListMin[monoms]

(* Out[301]= {{1, 1, 0, 0, 0, 0}, {0, 0, 1, 0, 0, 1},
{1, 0, 0, 0, 1, 1}, {0, 1, 1, 1, 0, 0}} *)


Some day I'll advocate for making that ListMin into a System-context function.

• May I ask what InternalListMin does? Is it fair to say that it eliminates a subset of of rows so that the output matrix has MatrixRank equal to number of rows? – QuantumDot Aug 3 '17 at 1:26
• Given a list of lists of real values, all of the same length, InternalListMin removes any that has all elements greater or equal to elements of another. In effect if finds minimal elements. If the notion of a "Pareto front" is familiar, it is useful for finding those elements that give such a front. Lower hull supporting set (not necessarily convex) might be another way to view it. (Whether these help one to understand the function depends on one's familiarity with them, I realize.) – Daniel Lichtblau Aug 3 '17 at 16:00