Ask Your Question

# Quadratic extension field of a finite field

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 close merge delete

## 1 Answer

Sort by ยป oldest newest most voted

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

more

## Comments

Thank you very much for the clarification.

( 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

## Stats

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

Seen: 697 times

Last updated: Jan 11 '18