ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 23 Jan 2018 18:32:17 -0600Making a dictionary of matrices, and save the sessionhttp://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 1Tue, 23 Jan 2018 18:32:17 -0600http://ask.sagemath.org/question/40756/Quadratic extension field of a finite fieldhttp://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 09:22:01 -0600http://ask.sagemath.org/question/40568/Roots of polynomials over a non-prime finite field in a given extensionhttp://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 11:48:49 -0600http://ask.sagemath.org/question/10711/