On 9/3/07, Ahmad <[EMAIL PROTECTED]> wrote:
> I'm new to sage and I don't know even if I'm supposed to post such
> questions to this group or not. If it is a correct place:
>
> Could you please tell me how can I change the basis in finite field
> representation. As much as know sage represent the finite field
> extension in:
>
> [1, t, t^2, .., t^{n-1}]
>
> for t being the root of irreducible polynomial used to extend the
> field. I need to represent my field in normal basis (I have chosen my
> irreducible polynomial such that [t, t^2, t^4 .., t^{2^{n-1}}] forms a
> basis for the extension).
>
> If it is not a correct place to ask such questions, please guide me to
> the correct place.
>
> Thank you very much for your attention and devotion of time!

Here is an example session in which I create a finite field,
find a normal basis, then explicitly represent elements in
terms of it (by pushing everything over to vector spaces).

I have to define two functions below in order to
do this.  If people think something like this would be generally
useful, then it could be made "built in" to SAGE:

sage: k.<a> = GF(2^5)
sage: k
Finite Field in a of size 2^5
sage: V = k.vector_space()
sage: z = (1+a)^17; z
a^3 + a + 1
sage: def to_V(w):
...       return V(w.polynomial().padded_list(V.dimension()))
sage: to_V(z)
(1, 1, 0, 1, 0)
sage: B2 = [(a+1)^(2^i) for i in range(k.degree())]
sage: W = [to_V(b) for b in B2]
sage: V.span(W).dimension()
5
sage: W0 = V.span_of_basis(W)
sage: def in_terms_of_normal_basis(z):
...       return W0.coordinates(to_V(z))
sage: in_terms_of_normal_basis(a+1)
[1, 0, 0, 0, 0]
sage: in_terms_of_normal_basis(1 + a + a^2 + a^3)
[1, 0, 0, 1, 0]

----

Or, in SAGE notebook text format:

ahmad -- sage-support
system:sage

{{{id=0|
k.<a> = GF(2^5)
}}}

{{{id=1|
k
///
Finite Field in a of size 2^5
}}}

{{{id=2|
V = k.vector_space()
}}}

{{{id=3|
z = (1+a)^17; z
///
a^3 + a + 1
}}}

{{{id=4|
def to_V(w):
    return V(w.polynomial().padded_list(V.dimension()))
}}}

{{{id=5|
to_V(z)
///
(1, 1, 0, 1, 0)
}}}

{{{id=6|
B2 = [(a+1)^(2^i) for i in range(k.degree())]
}}}

{{{id=7|
W = [to_V(b) for b in B2]
}}}

{{{id=8|
V.span(W).dimension()
///
5
}}}

{{{id=9|
W0 = V.span_of_basis(W)
}}}

{{{id=10|
def in_terms_of_normal_basis(z):
    return W0.coordinates(to_V(z))
}}}

{{{id=11|
in_terms_of_normal_basis(a+1)
///
[1, 0, 0, 0, 0]
}}}

{{{id=12|
in_terms_of_normal_basis(1 + a + a^2 + a^3)
///
[1, 0, 0, 1, 0]
}}}
\

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to