# Find solution to Polynomial Sequences without going through variety in Sage

I'm computing the Groebner basis of an ideal defined over the QQ ring. Once I have this Groebner basis, I would like to obtain a set of values that satisfy the equations in the Groebner basis. I know that the full set is going to be the variety of the ideal, but since this object is huge, I might not be interested in finding those values. In Maple, after computing the Groebner basis, I'm able to call the solve() method on it and even set a maximum number of solutions I want to obtain. As a small example:

P.<x,y,z,t>=PolynomialRing(QQ,4)
I = P.ideal(x*(x-1), y*(y-1), z*(z-1), t - x*y*z)
gb = I.groebner_basis()


Here I could have called I.variety() or gb.variety() and obtained the same set of solutions:

sage: gbI.variety()
[{y: 0, z: 0, t: 0, x: 0},
{y: 0, z: 0, t: 0, x: 1},
{y: 1, z: 0, t: 0, x: 0},
{y: 1, z: 0, t: 0, x: 1},
{y: 0, z: 1, t: 0, x: 0},
{y: 0, z: 1, t: 0, x: 1},
{y: 1, z: 1, t: 0, x: 0},
{y: 1, z: 1, t: 1, x: 1}]


But I would like to know if it is possible to call a method like (I can do this in Maple):

solve(gb,[max_sol=2])


Such that I can obtain a subset of the variety instead of the whole set. My motivation is that the size of the initial system of polynomials that I have is considerably larger than this example, and finding the feasible solutions on the reduced Groebner basis is more manageable. I might also not be interested in all the elements in the variety. Finally, if I transform the Groebner basis in an ideal itself and try to compute the variety on that object

gbI = ideal(gb)
gbI.variety()


I find the following error

RuntimeError: error in Singular function call 'groebner':
int overflow in hilb 3
error occurred in or before standard.lib::stdhilb line 299:     intvec hi = hilb( Id(1),1,W );
expected intvec-expression. type 'help intvec;'
leaving standard.lib::stdhilb
leaving standard.lib::groebner

• Your Gröbner computation is the bottle-neck, and it is an all-or-nothing affair. If you get a Gröbner basis in triangular form then computing the solutions is the less complicated operation. Restricting the output of the second step will not reduce the runtime by much or at all. – LutzL Aug 6 at 13:39
• Well actually for some cases (again, I was implementing this in maple before) it pays off. It might be that the solve command in maple takes advantage of this, but I would like to verify it using a "solve" statement that I can verify what it does. – David Bernal Aug 6 at 21:35