Ask Your Question

Revision history [back]

If you don't have a privileged choice for the ordering of the elements, simply use list(F) to generate a list containing all elements of the finite field. For instance:

sage: F.<x> = GF(3^5, impl='givaro')                                                                
sage: LF = list(F)

The first 10 elements of the list LF are

sage: LF[:10]                                                                                       
[0,
 x,
 x^2,
 x^3,
 x^4,
 x + 2,
 x^2 + 2*x,
 x^3 + 2*x^2,
 x^4 + 2*x^3,
 2*x^4 + x + 2]

Accessing to element of index 5:

sage: LF[5]                                                                                         
x + 2

The reverse operation:

sage: LF.index(x + 2)                                                                               
5

If you don't have a any privileged choice for the ordering of the elements, simply use list(F) to generate a list containing all elements of the finite field. For instance:

sage: F.<x> = GF(3^5, impl='givaro')                                                                
sage: LF = list(F)

The first 10 elements of the list LF are

sage: LF[:10]                                                                                       
[0,
 x,
 x^2,
 x^3,
 x^4,
 x + 2,
 x^2 + 2*x,
 x^3 + 2*x^2,
 x^4 + 2*x^3,
 2*x^4 + x + 2]

Accessing to element of index 5:

sage: LF[5]                                                                                         
x + 2

The reverse operation:

sage: LF.index(x + 2)                                                                               
5