# Extension field arithmetic This post is a wiki. Anyone with karma >750 is welcome to improve it.

Code

p=(2^3)
F.<a>=GF(2^3);F.modulus();#F
R.<x>=F[];#R
K.<b>=F.extension(x^2+(a^2+a+1)*x+a^2);#K
R.<z>=PolynomialRing(K) ;#R
R1.<a1,b1,a2,b2>=PolynomialRing(K,4) ;#R1
var('R b z a')
f3=z + (a^2 + a)*b + a + 1
M= f3.operands();M
f=M;f
new4=f.coefficients(b);new4
M1=new4
R=(M,M1+M);R
M2= M1+M


I have written the above code over extension field to separate out terms (a+1) and (a^2+a) , but the code is not working properly . following error is obtained

**AttributeError: 'PolynomialRing_field_with_category.element_class' object has no attribute 'operands',**

edit retag close merge delete

It is very hard to say, both mathematically and/or pythonically, what is the meaning of the message. Please write the code, so that a copy+paste reconstructs the problem. The post can be (hardly) understood: After some edit, the first lines of code are of the shape:

F.<a> = GF( 8 )
print "modulus of F is %s" % F.modulus()
S.<x> = F[];
K.<b> = F.extension( x^2 + (a^2+a+1)*x + a^2 )
R1.<a1,b1,a2,b2> = PolynomialRing( K, 4 )


(Edit as follows: Copy, paste, mark, hit that button with 101 and 010.) And all this is never used again!

Then it can be compiled:

var('R,b,z,a')
f3   = z + (a^2 + a)*b + a + 1
M    = f3.operands()
f    = M


e.g.

sage: f3
(a^2 + a)*b + a + z + 1
sage: M
[(a^2 + a)*b, a, z, 1]


And soon ...(more)