How to solve for coefficients in a Quotient ring?

asked 2023-03-26 22:09:33 +0100

tzeentch gravatar image

I'm finding that the solve function doesn't take into account the quotients or even the coefficient ring while solving. Is there a way to do so?

For context: I am trying to solve the equation (a+bS+cS^2+dS^3+eS^4+fS^5)^6 = 1 for the variables a, b, c, d, e, f, where a, b, c, d, e, f are elements of the ring of Integers adjoined a 3^6-1 root of unity, and the variable S has the relation S^6 = 3.

The following are three attempts to do so, and the errors they bring.

var('a,b,c,d,e,f,w,s,W,S')
Rw.<w> = PolynomialRing(ZZ)
R0 = Rw.quotient(w^288 + w^284 - w^260 - w^256 - w^236 + w^228 + w^208 - w^200 + w^184 + w^172 - w^156 - w^144 - w^132 + w^116 + w^104 - w^88 + w^80 + w^60 - w^52 - w^32 - w^28 + w^4 + 1)
R1.<a,b,c,d,e,f> = PolynomialRing(R0)
R2.<s> = PolynomialRing(R1)
R = R2.quotient(s^6 - 1)
S = R(s)
W = R(w)
poly = (a+b*S+c*S^2+d*S^3+e*S^4+f*S^5)^6
solve([poly==R(1)], a,b,c,d,e,f)

It freaks out at the poly stage, giving us the following error (the same error that it gives if I run a*S):

TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and 'Univariate Quotient Polynomial Ring in sbar over Univariate Quotient Polynomial Ring in wbar over Integer Ring with modulus w^288 + w^284 - w^260 - w^256 - w^236 + w^228 + w^208 - w^200 + w^184 + w^172 - w^156 - w^144 - w^132 + w^116 + w^104 - w^88 + w^80 + w^60 - w^52 - w^32 - w^28 + w^4 + 1 with modulus s^6 - 1'

But if we change it to another order, the "poly" line runs but not the "solve" line:

sage: var('w,s,a,b,c,d,e,f')
....: Rw.<w> = PolynomialRing(ZZ)
....: R0 = Rw.quotient(w^288 + w^284 - w^260 - w^256 - w^236 + w^228 + w^208 - w^200 + w^184 + w^172 - w^156 - w^144 - w^132 + w^116 + w^104 - w^88 + w^80 + w^60 - w^52 - w^32 - w^28 + w^4 + 1)
....: R2.<s> = PolynomialRing(R0)

....: R3 = R2.quotient(s^6 - 1)
....: R.<a,b,c,d,e,f> = PolynomialRing(R3)
....: S = R(s)
....: W = R(w)
....: poly = (a+b*S+c*S^2+d*S^3+e*S^4+f*S^5)^6
....: solve([poly==R(1)], a,b,c,d,e,f)
(a, b, c, d, e, f)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[60], line 10
      8 W = R(w)
      9 poly = (a+b*S+c*S**Integer(2)+d*S**Integer(3)+e*S**Integer(4)+f*S**Integer(5))**Integer(6)
---> 10 solve([poly==R(Integer(1))], a,b,c,d,e,f)

And lastly, my first and most naive approach, which has the same errors as the "solve" stage above.

sage: var('a,b,c,d,e,f,w,s,W,S')
sage: Rw.<w> = PolynomialRing(ZZ)
sage: R0 = Rw.quotient(w^288 + w^284 - w^260 - w^256 - w^236 + w^228 + w^208 - w^200 + w^184 + w^172 - w^156 - w^144 - w^132 + w^116 + w^104 - w^88 + w^80 + w^60 - w^52 - w^32 - w^28 + w^4 + 1)
sage: R1.<a,b,c,d,e,f> = PolynomialRing(R0)
sage: R2.<s> = PolynomialRing(R1)
sage: R = R2.quotient(s^6 - 1)
sage: S = R(s)

....: W = R(w)
sage: poly = (a+b*S+c*S^2+d*S^3+e*S^4+f*S^5)^6
sage: solve([poly==R(1)], a,b,c,d,e,f)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[54], line 1
----> 1 solve([poly==R(Integer(1))], a,b,c,d,e,f)

File /usr/lib/python3.10/site-packages/sage/symbolic/relation.py:1049, in solve(f, *args, **kwds)
   1047     for i in x:
   1048         if not isinstance(i, Expression):
-> 1049             raise TypeError("%s is not a valid variable." % repr(i))
   1050 elif x is None:
   1051     vars = f.variables()

TypeError: a is not a valid variable.
edit retag flag offensive close merge delete

Comments

Definition var('a,b,c,d,e,f,w,s,W,S') is redundant as you re-define these variables as polynomial variables later anyway. Also, solve() works with symbolic variables. Since you work with polynomial rings, I suggest to employ polynomial ideals/Groebner basis, rather than symbolic, machinery instead.

Max Alekseyev gravatar imageMax Alekseyev ( 2023-04-03 07:36:28 +0100 )edit