Ask Your Question

# 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(), R.gens(), R.gens()
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))],
])
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)

edit retag close merge delete

## Comments

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.

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.

## 1 Answer

Sort by » oldest newest most voted

While there is a bug in Singular preventing from using the built-in .variety() method, I've done my own quick-n-dirty alternative implementation of this method.

In your example just run myvariety( Eq[0,0].coefficients() + Eq[1,0].coefficients() + [q^4+q for q in K.gens()] )to get the corresponding variety of size $128$ in a minute or so. In fact, the variety here represents a vector space over $\mathrm{GF}(2)$ spanned by 7 vectors (and $128 = 2^7$).

def myvariety(sys,vars=None):
J = ideal( sys )
R = J.ring()

if vars==None:
vars = R.gens()
if len(vars)==0:
return([dict()])

T = list()

v = vars
nvars = vars[1:]

B = J.elimination_ideal(nvars).basis

assert len(B) == 1
assert B != 0

for q,_ in B.univariate_polynomial().roots():
S = myvariety( [r.subs({v:q}) for r in J.interreduced_basis()], nvars )
for s in S:
s.update({v:q})
T += S
return T

more

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2021-02-02 13:04:30 +0200

Seen: 154 times

Last updated: Feb 11