Ask Your Question

ofir_ar's profile - activity

2023-06-08 18:29:51 +0200 received badge  Famous Question (source)
2022-10-30 13:18:47 +0200 received badge  Notable Question (source)
2022-06-24 21:25:30 +0200 received badge  Notable Question (source)
2022-02-06 15:48:08 +0200 received badge  Popular Question (source)
2021-04-13 10:52:00 +0200 received badge  Popular Question (source)
2021-02-04 10:30:42 +0200 commented question Sage crash when computing variety for an ideal with many variables

@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.

2021-02-03 20:48:28 +0200 received badge  Nice Question (source)
2021-02-03 19:40:03 +0200 commented question Sage crash when computing variety for an ideal with many variables

@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.

2021-02-03 18:59:18 +0200 commented question Sage crash when computing variety for an ideal with many variables

How do I that?

2021-02-02 13:04:30 +0200 asked a 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()[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))],
X,Y,Z = [Matrix(g.powers(4)) for g in [x,y,z]]
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])],

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])     
2021-01-28 09:20:12 +0200 commented answer Solve for coefficients of polynomials

@tmonteil I changed the names as you suggested, I got another error (my question was updeated)

2021-01-27 18:34:30 +0200 received badge  Editor (source)
2021-01-27 18:13:17 +0200 received badge  Student (source)
2021-01-27 17:53:43 +0200 asked a question Solve for coefficients of polynomials

I want to solve for the coefficients $\alpha(n, m, k)$ an equation that looks like this: $$ 0 = (1 + x + y + z) \sum_{n, m, k \in \{0, 1, \dots, N\}} \alpha(n, m, k) x^n y^m z^k $$ where $\alpha(n, m, k) \in \{0, 1\}$ and $x^n y^m z^k$ are polynomials over $\mathbb{F}_2$ that satisfy $x^L = y^L = z^L = 1$ for some integer $L$.

Is there a way to do this in Sage? Notice there are three generators $x,y,$ but the number of coefficents $\alpha$ is $2^{3L}$.

I tried to follow this answer and wrote this code that failed-

R = PolynomialRing(GF(2),3,"xyz")
x,y,z = R.gens()
S.<a,b,c> = R.quotient((x^2 + 1,y^2+1,z^2+1))
K = PolynomialRing(GF(2),2,'q') # Coefficients
q = K.gens()

Pol = (q[1]*a+q[0])*(a*b)-5*b*a # Equation to solve

I = K.ideal(Pol.coefficients())

And I get the following error:

TypeError                                 Traceback (most recent call last)
<ipython-input-90-e45cccb450b5> in <module>
      5 q = K.gens()
----> 7 Pol = (q[Integer(1)]*a+q[Integer(0)])*(a*b)-Integer(5)*b*a # Equation to solve
      9 K.ideal(Pol.coefficients())

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__mul__ (build/cythonized/sage/structure/element.c:12199)()
   1513             return (<Element>left)._mul_(right)
   1514         if BOTH_ARE_ELEMENT(cl):
-> 1515             return coercion_model.bin_op(left, right, mul)
   1517         cdef long value

/opt/sagemath-9.2/local/lib/python3.7/site-packages/sage/structure/coerce.pyx in sage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11304)()
   1246         # We should really include the underlying error.
   1247         # This causes so much headache.
-> 1248         raise bin_op_exception(op, x, y)
   1250     cpdef canonical_coercion(self, x, y):

TypeError: unsupported operand parent(s) for *: 'Multivariate Polynomial Ring in q0, q1 over Finite Field of size 2' and 'Quotient of Multivariate Polynomial Ring in x, y, z over Finite Field of size 2 by the ideal (x^2 + 1, y^2 + 1, z^2 + 1)'