I'm working with square polynomial systems and wish to know if a (small) system has a finite number of solutions. That is, if it's zero-dimensional. I'm not aware of any built-in function to do this so attempted to write my own but not that familiar with the concept and was wondering if others might have any comments about my routine below? Some background for the reader:
One way to compute the dimension is to compute a Groebner basis and then check if some element of the basis has a leading monomial (monomial with highest precedence described below) that is a pure power of each variable, i.e., a leading monomial with only one variable. My understanding is one first settles on a monomial ordering. Two of which is lexicographic or graded lexicographic. In lexicographic, the ordering of the variables defined by say $f(x,y,z)$ take precedence: $x$ has a higher precedence than say $y^2$. In the case of say $x^2 y$ and $x^2 y^2$, the ordering is in terms of overall degree so $x^2 y^2>x^2y$ and so forth.
The build-in function CoefficientRules will lexigraphically order the monomial exponent vectors from highest precedence to lowest. So that a Groebner basis is computed and then the list of exponent vectors is computed. The leading terms of each vector set is then checked for a pure power of each variable. In the case of 3 variables, this would be checking for the set $\text{{{0,0,_},{0,_,0},{_,0,0}}}$. If this set is found, the sysem is zero-dimensional.
Here is a 3-variable example using a known zero-dimensional system:
f[{x_, y_, z_}] = {x^2 - 2 x z + 5, x y^2 + y z^3, 3 y^2 - 8 z^3};
isZeroDimensional[f_] := Module[{gBasis, cRules, leadingC, p1, p2,
p3},
gBasis = GroebnerBasis[f[{x, y, z}], {x, y, z}];
(*
get coefficient rules.
This will order the exponent vectors lexicographically from
highest precedence to lowest
*)
cRules = (CoefficientRules[#, {x, y, z}] & /@ gBasis);
(*
get the highest precedent monomial of each basis element
*)
leadingC = cRules[[All, 1]][[All, 1]];
(*
now check the list of leading monomials for the set {{0,0,_},
{0,_,0},{_,0,0}}. This represents a set of pure powers of x,y,z
*)
If[MemberQ[leadingC, {0, 0, _}] && MemberQ[leadingC, {0, _, 0}]
&& MemberQ[leadingC, {_, 0, 0}],
True
,
False
]
];
isZeroDimensional[f]
Out[150]= True
MonomialList
, that predated the System context function of the same name. The current approximate equivalent would beGroebnerBasis`DistributedTermsList
(maybe you knew that). Or you can use the newMonomialList
as someone else kindly updated the code to do. (It's unfortunate this Krull dimension code is something of a moving target. Another reason I'd be happy to upvote an update to version 12.) $\endgroup$