9
$\begingroup$

All the examples in the Mathematica documentation specify that the syntax for the GroebnerBasis command is

GroebnerBasis[{poly1,poly2,...},{x1,x2,...}]

however it does return a result when ran just as

GroebnerBasis[{poly1,poly2,...}]

(although it does put a red caret in at the end, indicating it is missing an expected second parameter). I assume that, in this case, GroebnerBasis makes some choice for the variables. My intuition was that it would be GroebnerBasis[polys] == GroebnerBasis[polys, Variables[polys]], but that does not seem to be the case. What is the behavior of the GroebnerBasis command without a variable specification?

$\endgroup$

1 Answer 1

9
$\begingroup$

If the (ordered) list of variables is not specified, GroebnerBasis will order the variables as it encounters them. I remark that, as this depends on implementation details, it can be version dependent.

The question (which I should have anticipated) was raised as to how one might get the "variables" that GroebnerBasis sees, and in the same order. It can be done with a non-System-context function GroebnerBasis`DistributedTermsList. It will both rewrite the polynomials in an internal format (as its name implies), and also give the variables in the order it is using them. One must specify CoefficientDomain -> Rationals in order to force it to create new variables rather than treat unspecified ones as part of the coefficient field (the default behavior).

Here is a simple example.

polys = {3*y*z - 5, 2*x^2 + y + z^3 - 1, x*y - 2};
Variables[polys]    
Out[1]= {x, y, z}

GroebnerBasis`DistributedTermsList[polys, CoefficientDomain -> Rationals]
Out[2]= {{{{{1, 1, 0}, 3}, {{0, 0, 0}, -5}}, {{{1, 0, 0}, 1}, {{0, 3, 0}, 1}, 
    {{0, 0, 2}, 2}, {{0, 0, 0}, -1}}, {{{1, 0, 1},1}, {{0, 0, 0}, -2}}}, {y, z, x}}
$\endgroup$
6
  • $\begingroup$ Any way to get a list of the variables ordered in this way? I think the "Variables[polys]" command reorders them on it's own. $\endgroup$
    – mboratko
    Mar 13, 2012 at 19:13
  • $\begingroup$ @Michael See edit. $\endgroup$ Mar 13, 2012 at 20:17
  • $\begingroup$ Thank you, your expertise has been extremely valuable to me. I hope Wolfram pays you well. $\endgroup$
    – mboratko
    Mar 13, 2012 at 20:33
  • 12
    $\begingroup$ No, but they nowadays let me turn off the lights at night; 24 hours of fluorescence was really starting to make me feral. Brett says I should also mention the tip jar... $\endgroup$ Mar 13, 2012 at 20:48
  • $\begingroup$ @process91 @DanielLichtblau Although this is way after the fact, I've had what I think was a similar problem, with a Module I wrote myself on Mma v9 for OS X, and then tried to run on my Mma v10 for RPi, which had a single input argument, but added the red caret as if it expected a second one. I haven't figured out the reason and can't run the code at this point. Might this be a version issue with Module between v9 and v10? $\endgroup$
    – iwantmyphd
    Jan 29, 2015 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.