Ask Your Question

Revision history [back]

There is a minor issue in your code:

F = GF(2)
R.<x> = k[]

Presumably F should be k or vice versa. The major issue with using this in Python is that R.<x> = k[] is not allowable Python syntax. Sage preparses it first. You can find out how it does this as follows:

sage: k = GF(2)
sage: preparse('R.<x> = k[]')
"R = k['x']; (x,) = R._first_ngens(1)"

So you should be able to do

from sage.all import *
k = GF(2)
R = k['x']; (x,) = R._first_ngens(1)
K = F.extension(x^4 + x + 1, 'a')