Ask Your Question
2

Quadratic extension field of a finite field

asked 2018-01-11 16:22:01 +0200

ninho gravatar image

updated 2023-01-09 23:59:44 +0200

tmonteil gravatar image

I want to create a quadratic extension of a finite field via x^2 + 1, and for that purpose I have the following Sage code:

proof.arithmetic(False)

# Parameters
f = 1
lA = 2
lB = 3
eA = 372
eB = 239

# Define the prime p
p = f*lA**eA*lB**eB-1
assert p.is_prime()

# Prime field of order p
Fp = GF(p)
# The quadratic extension via x^2 + 1 since p = 3 mod 4 
Fp2.<i> = Fp.extension(x^2+1)

Though, the above code throws a rather cryptic error UnboundLocalError: local variable 'E' referenced before assignment. Any ideas how to solve the problem and create a quadratic extension field.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2018-01-11 20:46:54 +0200

vdelecroix gravatar image

The error is indeed cryptic (see trac ticket #24526). The problem comes from the fact that your expression x^2 + 1 is not a proper polynomial with coefficients in the base field but a symbolic expression. You should do

sage: K = GF(3)
sage: R.<t> = PolynomialRing(K)
sage: K.extension(t^2 + 1, 'a')
Finite Field in a of size 3^2

You can compare

sage: parent(x)
Symbolic Ring
sage: parent(t)
Univariate Polynomial Ring in t over Finite Field of size 3
edit flag offensive delete link more

Comments

Thank you very much for the clarification.

ninho gravatar imageninho ( 2018-01-11 23:00:46 +0200 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-01-11 16:22:01 +0200

Seen: 794 times

Last updated: Jan 11 '18