# Sage crash when computing variety for an ideal with many variables

I try to run a code (on a Jupyter notebook) which computes the variety of an ideal for some polynomial in many variables (64 for in this case. Notice I solve for `a`

and not for `x,y,z`

). My code crashes with the following message:

```
RuntimeError: error in Singular function call 'groebner':
int overflow in hilb 1
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
```

This is the code:

```
K = PolynomialRing(GF(2),2^6,'a')
R = K["x, y, z"]
x, y, z = R.gens()[0], R.gens()[1], R.gens()[2]
a = K.gens()
pbc = lambda p :(( p%(x^4+1))%(y^4+1))%(z^4+1)
e_L = Matrix([[R((1 + x + y + z)^(2^4)/(1 + x + y + z))],
[0]])
X,Y,Z = [Matrix(g.powers(4)) for g in [x,y,z]]
XY=X.tensor_product(Y)
XYZ = XY.tensor_product(Z)
poly = (Matrix(a)*XYZ.transpose())[0,0]
RHS_eq = Matrix([[pbc((1 + x*y + x*z + y*z) * poly)],
[pbc((1 + x + y + z) * poly)]])
IJK = list(Words(alphabet=range(4), length=3))
for i,j,k in IJK:
P = pbc(e_L + (x^i*y^j*z^k)*e_L)
lhs = RHS_eq + P
Eq = Matrix([[R(lhs[0,0])],
[R(lhs[1,0])]])
I = K.ideal(Eq[0,0].coefficients() + Eq[1,0].coefficients() + [q^4+q for q in K.gens()])
sols = I.variety(GF(2^6,'w'))
sols_arr = np.asarray([list(sol.values()) for sol in sols])
print(sols_arr)
```

Please make your code self-contained so that it works in a fresh session (e.g.

`poly`

is currently not defined). The error you quote is due to the`groebner`

function in Singular choosing a wrong strategy. You could try entering your ideal into Singular and using`std`

(instead of`groebner`

) there.How do I that?

Please fix your code so that it works when pasted into https://sagecell.sagemath.org/. Then try

`I.groebner_basis()`

instead of`I.variety(...)`

to get some idea about the solutions (the Groebner basis is in particular a system of generators of your ideal).@rburing Thank you for your comment, the code in my questions fails as expected now. If I understand right, the last three lines should be changes as you suggested.

@rburing I understand that the Groebner basis is a set of polynomials then equated to 0 the solutions to these equations are the variety that I want. But Sage's variety function doesn't allow to choose which algorithm to use to calculate the Groebner basis. I can compute the Groebner basis with either

`I.groebner_basis(algorithm='singular:std')`

or`I.groebner_basis()`

so this doesn't seem to be the issue.