ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 18 Mar 2021 15:59:04 +0100Finite Field Extensionhttps://ask.sagemath.org/question/56220/finite-field-extension/I am using SageMath version 9.2. I was trying the example in the documentation:
`sage: k = GF(2)`
`sage: k.extension(x^1000 + x^5 + x^4 + x^3 + 1, 'a')`
However, this gives the error: `UnboundLocalError: local variable 'E' referenced before assignment`
How do I fix this?
cathreyaThu, 18 Mar 2021 15:59:04 +0100https://ask.sagemath.org/question/56220/Making a dictionary of matrices, and save the sessionhttps://ask.sagemath.org/question/40756/making-a-dictionary-of-matrices-and-save-the-session/Some time ago I [made a dictionary of matrices](https://ask.sagemath.org/question/40234/) with your help.
Now I like to save the session by `save_session()` but somehow I fail. The terminal goes as follows
sage: A=matrix(GF(2),[[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Not saving dictA: mutable matrices are unhashable
On the other hand
sage: A=matrix([[1,0],[0,1]])
sage: A.set_immutable()
sage: dictA={A:1}
sage: save_session(verbose=true)
Saving A
Saving dictA
I have no idea why specifying `GF(2)` fails `save_session()`. Does anyone know a fix?Symbol 1Wed, 24 Jan 2018 01:32:17 +0100https://ask.sagemath.org/question/40756/Quadratic extension field of a finite fieldhttps://ask.sagemath.org/question/40568/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.ninhoThu, 11 Jan 2018 16:22:01 +0100https://ask.sagemath.org/question/40568/Segmentation fault when multiplying by variablehttps://ask.sagemath.org/question/39204/segmentation-fault-when-multiplying-by-variable/In Sage 7.5.1 I'm trying to work with unknown values in GF(3) and polynomials.
The following code gives me a *segmentation fault*:
P.<x> = GF(3)['x']
var('a')
sigma = 2*x+ 1
print(a*(sigma))
What is the proper way to handle unknown GF(3) values like "a" in Sage?PsiWed, 18 Oct 2017 22:30:48 +0200https://ask.sagemath.org/question/39204/Roots of polynomials over a non-prime finite field in a given extensionhttps://ask.sagemath.org/question/10711/roots-of-polynomials-over-a-non-prime-finite-field-in-a-given-extension/I am trying to find the roots of a primitive polynomial
over a non-prime finite field, in a desired extension.
Here is an example of what I'm trying to do:
First, I define my non-prime finite field (GF(4)), and
a primitive polynomial f.
sage: F.<a>=GF(4)
sage: K.<x>=F[]
sage: F
Finite Field in a of size 2^2
sage: K
Univariate Polynomial Ring in x over Finite Field in a of size 2^2
sage: f=x^4 + (a + 1)*x^3 + a*x^2 + a
sage: f.is_primitive()
True
Now, I define an extension field G where f has its roots
sage: G=f.root_field('b')
sage: G
Univariate Quotient Polynomial Ring in b over Finite Field in a of size 2^2 with modulus x^4 + (a + 1)*x^3 + a*x^2 + a
I assume that b is a root of f, by definition (correct me if I'm wrong).
Now, I take a new primitive polynomial h.
sage: h=x^4 + x^3 + (a + 1)*x^2 + a
sage: h.is_primitive()
True
But when I try to find the roots of h in G, I get nothing.
sage: h.roots(ring=G)
[]
Could somebody tell me how I could get the roots of h in G
with respect to b?geo909Wed, 06 Nov 2013 18:48:49 +0100https://ask.sagemath.org/question/10711/