First time here? Check out the FAQ!

Ask Your Question
2

Quadratic extension field of a finite field

asked 7 years ago

ninho gravatar image

updated 2 years ago

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 7 years ago

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
Preview: (hide)
link

Comments

Thank you very much for the clarification.

ninho gravatar imageninho ( 7 years ago )

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: 7 years ago

Seen: 896 times

Last updated: Jan 11 '18