Ask Your Question

how to compute x^ip (mod P) in F2

asked 2022-05-04 02:11:38 +0200

updated 2022-05-04 07:55:34 +0200

FrédéricC gravatar image


i want to compute x^iq (mod P) for q=2,0<=i<=3. By using the Euclidean algorithm; but i don

p = 3
X = ZZ['X'].gen()
P = 1+X+X^2+X^3
K.<X> = GF(p)['X'].quotient(P)
K.<X> = PolynomialRing(GF(2),'X')
X = K.gen()
S = K.quotient(P, 'X')
X = S.gen()
M = matrix([(X^(p*i).list() for i in range(p)]).transpose()

but my matrix M does not correspond to what i have when i do it by hand. thanks

edit retag flag offensive close merge delete


Please describe the situation mathematically first, since the provided code cannot be a substitute. Do we want to work in characteristic two or in characteristic three? The ring $$\Bbb F_3[X]\ /\ (1+X+X^2+X^3)$$ is immediately overwritten. Why do we do this? The prime $p=3$ is finally used also in the matrix $M$. Which should be this matrix?

dan_fulea gravatar imagedan_fulea ( 2022-05-06 14:15:55 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2022-05-04 19:16:02 +0200

Max Alekseyev gravatar image

updated 2022-05-04 19:21:12 +0200

Your code is quite messy and does not match the problem description. Let me design one from scratch:

R.<X> = PolynomialRing(GF(2))
P = 1+X+X^2+X^3
S = R.quotient(P)
q = 2
print('as elements of S:', [S.gen()^(i*q) for i in (0..3)] )
print('as elements of P:', [(S.gen()^(i*q)).lift() for i in (0..3)] )

Is this what you want?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2022-05-04 02:11:38 +0200

Seen: 48 times

Last updated: May 04