Difference between revisions of "CoCoA:HowTo:Construct fields"
KHiddemann (talk | contribs) |
m (Bot: Replacing category HowTo with HowTo Old) |
||
(5 intermediate revisions by 2 users not shown) | |||
Line 10: | Line 10: | ||
code | code | ||
− | <cocoa>Define Buildall(Deg) | + | <cocoa> Define Buildall(Deg) |
If Deg=0 Then | If Deg=0 Then | ||
Return [0,1]; | Return [0,1]; | ||
Line 16: | Line 16: | ||
L := Buildall(Deg - 1); | L := Buildall(Deg - 1); | ||
− | Return Concat([x*E | E In L], [x*E + 1 |E In L]) | + | Return Concat([x*E | E In L], [x*E + 1 | E In L]) |
EndDefine;</cocoa> | EndDefine;</cocoa> | ||
[[User:Dheldt|dheldt]] 12:30, 22 May 2007 (CEST) | [[User:Dheldt|dheldt]] 12:30, 22 May 2007 (CEST) | ||
Line 22: | Line 22: | ||
accomplishes this task. | accomplishes this task. | ||
Now, we use this function to create all polynomials of a given degree and check if they are irreduceable. This can be done with | Now, we use this function to create all polynomials of a given degree and check if they are irreduceable. This can be done with | ||
− | <cocoa>Use Z/(2)[x]; | + | <cocoa> Use Z/(2)[x]; |
Deg := 4; -- change for the degree you want. | Deg := 4; -- change for the degree you want. | ||
− | L := [ x^(Deg) + E | + | L := [x^(Deg) + E | E In Buildall(Deg-1)]; -- take all polynomials of smaller degrees and add x^Deg. |
Result := []; | Result := []; | ||
− | + | -- find all irred. polynomials. | |
ForEach E In L Do | ForEach E In L Do | ||
H := Factor(E); | H := Factor(E); | ||
Line 46: | Line 46: | ||
To find the roots for all polynomials in result, the following code is avaiable: | To find the roots for all polynomials in result, the following code is avaiable: | ||
− | <cocoa>All := Buildall(Deg-1); | + | <cocoa> All := Buildall(Deg-1); |
AllL := []; | AllL := []; | ||
Foreach F In Result Do | Foreach F In Result Do | ||
Line 65: | Line 65: | ||
were built to create semi-logarithmic multiplication and division matrices for ApCoCoA's finite fields with characteristic 2. There is not much documentation in the files, but they may give an idea. In case you have any questions / problems, feel free to contact me! [[User:Dheldt|dheldt]] 14:25, 3 November 2007 (CET) | were built to create semi-logarithmic multiplication and division matrices for ApCoCoA's finite fields with characteristic 2. There is not much documentation in the files, but they may give an idea. In case you have any questions / problems, feel free to contact me! [[User:Dheldt|dheldt]] 14:25, 3 November 2007 (CET) | ||
− | + | [[Category:HowTo Old]] | |
− | [[Category:HowTo | + | [[Category:ApCoCoALib]] |
Latest revision as of 09:42, 29 October 2020
This article is a stub. You can make this wiki more useful by adding information.
about
To construct finite field extensions, you adjungate an indeterminate and compute modulo an irreducible polynomial, e.g. . In this HowTo I will present some lines of code to find irreducible polynomials and their roots. These roots are helpful to create the field's endomorphism group or to switch between different representations of the same field.
This HowTo assumes we are working with finite field extensions of , so the code has to be adapted for other characteristics.
finding irreducible polynomials
First, we need a small function, giving us all polynomials having a degree smaller than a given bound. If Deg contains this bound the code
Define Buildall(Deg) If Deg=0 Then Return [0,1]; EndIf; L := Buildall(Deg - 1); Return Concat([x*E | E In L], [x*E + 1 | E In L]) EndDefine;
dheldt 12:30, 22 May 2007 (CEST)
accomplishes this task. Now, we use this function to create all polynomials of a given degree and check if they are irreduceable. This can be done with
Use Z/(2)[x]; Deg := 4; -- change for the degree you want. L := [x^(Deg) + E | E In Buildall(Deg-1)]; -- take all polynomials of smaller degrees and add x^Deg. Result := []; -- find all irred. polynomials. ForEach E In L Do H := Factor(E); If Len(H) = 1 Then If H[1][2] = 1 Then Append(Result, E); EndIf; EndIf; EndForEach;
dheldt 12:30, 22 May 2007 (CEST)
Now result is a list of all irreducible polynomials of degree Deg.
finding the roots
To find the roots for all polynomials in result, the following code is avaiable:
All := Buildall(Deg-1); AllL := []; Foreach F In Result Do L := []; Foreach E In All Do If (NF(Subst(F,[ [x,E] ]),Ideal([F])) = 0) Then Append(L,E); EndIf; EndForeach; Append( AllL, [F,L]); EndForeach;
dheldt 12:30, 22 May 2007 (CEST)
Then AllL contains pairs, each containing one of the irreducible polynomials and all of their roots in the corresponding field extension.
creating multiplication matrices
The files F_2048_multiplication.C and Building_finite_fields.coc were built to create semi-logarithmic multiplication and division matrices for ApCoCoA's finite fields with characteristic 2. There is not much documentation in the files, but they may give an idea. In case you have any questions / problems, feel free to contact me! dheldt 14:25, 3 November 2007 (CET)