Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

If the (ordered) list of veriables 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}}
share|improve this answer
    
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. –  process91 Mar 13 '12 at 19:13
    
@Michael See edit. –  Daniel Lichtblau Mar 13 '12 at 20:17
    
Thank you, your expertise has been extremely valuable to me. I hope Wolfram pays you well. –  process91 Mar 13 '12 at 20:33
4  
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... –  Daniel Lichtblau Mar 13 '12 at 20:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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