Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Declare diagonal matrix with unknown variables in GF(2).

I have an equation of the form $AXY = V$, that I am trying to solve using Sage. All matrixes are in $GF(2)$, $A$ and $X$ are of size 32x32, and $Y$ and $V$ column vectors of size 32.

My unknown matrix $X$ consists in zeros, except on the diagonal where I'd like to have 32 unknowns (representing each bit of a unknown 32-bits integer). I first tried to declare an array of variables like this:

vars_list = list(var("x_%d" % i) for i in range(32)) which throws me a "TypeError: x_0 is not a variable of Univariate Polynomial Ring in X over Finite Field of size 2 (using GF2X)". Looking at Sage documentation, I didn't find a way to declare them in $GF(2)$.

Using this link, I tried to declare my variables like this: x_1 = SR(GF(2)(1)) * var("x1") which gave me this time a "TypeError: positive characteristic not allowed in symbolic computations".

How should I setup $X$ so I can solve my equation?

Declare diagonal matrix with unknown variables in GF(2).

I have an equation of the form $AXY $AXB = V$, that I am trying to solve using Sage. All matrixes are in $GF(2)$, $A$ and $X$ are of size 32x32, and $Y$ $B$ and $V$ column vectors of size 32.

My unknown matrix $X$ consists in zeros, except on the diagonal where I'd like to have 32 unknowns (representing each bit of a unknown 32-bits integer). I first tried to declare an array of variables like this:

vars_list = list(var("x_%d" % i) for i in range(32)) which throws me a "TypeError: x_0 is not a variable of Univariate Polynomial Ring in X over Finite Field of size 2 (using GF2X)". Looking at Sage documentation, I didn't find a way to declare them in $GF(2)$.

Using this link, I tried to declare my variables like this: x_1 = SR(GF(2)(1)) * var("x1") which gave me this time a "TypeError: positive characteristic not allowed in symbolic computations".

How should I setup $X$ so I can solve my equation?