Finite field and its element with symbols [Sage / Python / ...]

1.8k Views Asked by At

I have a finite field $T=GF(2^3)$, normal basis $(a, a^2, a^4)$ and polynomial $f$ from field $T$, which contains unknown variables / symbols. Is it possible to get vector with coordinates of f in normal basis?

Example in Sage:

T.<x> = GF(2^3)
V = T.vector_space()
alpha = x^2+1
normalBasis = [ alpha^(2^i) for i in range(T.degree()) ]

W = [ b._vector_() for b in normalB ] 
normalBasisVector = V.span_of_basis(W)

def linearCombination(coords, basis):
    return sum( [ coords[i] * basis[i] for i in range(len(basis)) ] )

a,b,c = var('a','b','c')
gB = [a,b,c] # vector g in normal basis
g = linearCombination(gB, normalB)

normalBasisVector.coordinates(g) # I'd like to get back g in normal basis (that is (a,b,c))
-> TypeError: can't initialize vector from nonzero non-list

If this is impossible in Sage, is it possible in any other Mathematic / Programming Language e.g. in Python?

I hope I presented my problem clearly. If you didn't get anything, feel free to ask me.

Thanks,

Denholm