Ask Your Question

Revision history [back]

Note that you defined x in two different ways.

Suggestion: use different names.

To add 1 + 1 in R or in K, one needs to specify it. Otherwise 1 is the 1 in ZZ.

Here is a rewrite using different names; and addition performed in R or in K.

sage: R.<y> = GF(2)[]
....: x = polygen(ZZ)
....: K.<z> = GF(2^8, modulus=x^8 + x^4 + x^3 + x + 1)
....: print 'Compute 1 + 1 in R and in K'
....: print R(1) + R(1)
....: print K(1) + K(1)
....: print 'Compute y + y and z + z'
....: print y + y
....: print z + z
....: print 'Compute y + y^2 and z + z^2'
....: print y + y^2
....: print z + z^2
....: 
Compute 1 + 1 in R and in K
0
0
Compute y + y and z + z
0
0
Compute y + y^2 and z + z^2
y^2 + y
z^2 + z