# Revision history [back]

### 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.

 2 retagged tmonteil 20598 ●25 ●146 ●381 http://wiki.sagemath.o...

### 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.