{VERSION 5 0 "IBM INTEL LINUX" "5.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "2D Output" 2 20 "" 0 1 0 0 255 1 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE " " -1 257 "symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 " symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 261 "symbol" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Times" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 }{PSTYLE "Heading 1" -1 3 1 {CSTYLE "" -1 -1 "Times" 1 18 0 0 0 1 2 1 2 2 2 2 1 1 1 1 } 1 1 0 0 8 4 1 0 1 0 2 2 0 1 }{PSTYLE "Maple Output" 0 11 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 3 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 11 12 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }1 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 0 "" 0 "" {TEXT -1 98 "Thanks to John Cook for su bmitting an earlier version of this to me, and sharing it with everyon e!" }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 78 "Restart Maple and pull in the LinearAlgebra package that will b e needed later." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "with(LinearAlgebra):" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 92 "Define how many elements are in th e field and the prime over which the field is to be built." }}{PARA 0 "" 0 "" {TEXT -1 58 "You will change these values to create different \+ fields. " }}{PARA 0 "" 0 "" {TEXT -1 176 "You will also need to choos e a primitive polynomial. A function for creating a list of primitive polynomials is in the following section. \nIf you know one, skip tha t section." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 37 "p := 3; \ns \+ := 2;\nq := p^s;\nn := q-1;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"pG \"\"$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"sG\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"qG\"\"*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"n G\"\")" }}}{SECT 0 {PARA 3 "" 0 "" {TEXT -1 31 "Finding irreducible po lynomials" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 101 "The field GF(q) is \+ a splitting field for x^(q-1) - 1. I want to factor this polynomial a nd find one" }}{PARA 0 "" 0 "" {TEXT -1 92 "of the factors with degree n such that p^n = q that has a root that will generate the field." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 31 "SF := Factors(x^(n) - 1) mod p:" }} {PARA 0 "" 0 "" {TEXT -1 94 "The second parameter returned by Factors \+ returns the irreducible factors in the factorization." }}{PARA 0 "" 0 "" {TEXT -1 69 "Loop through these factors and find ones that can gene rate the field." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 361 "PrimFactors := \+ []:\nfor FactorIndx from 1 to nops(SF[2]) do\n if (degree(SF[2,Facto rIndx,1])= s) then\n if (Primitive(SF[2,FactorIndx,1]) mod p) the n\n PrimFactors := [op(PrimFactors),SF[2,FactorIndx,1]]; \+ \+ end if;\n end if;\nend do ;\n" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "The variable \"PrimFactor s\" now contains a list of polynomials that should generate the field. To be on" }}{PARA 0 "" 0 "" {TEXT -1 41 "the safe side, verify that \+ one was found." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 83 "if(nops(PrimFacto rs) <= 0) then\n print(\"No primitive polynomials found\");\nend if; " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "Creating a Finite Field" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 83 "You can use PrimFactors, from the previous section, to get a fa ctor or you can use " }}{PARA 0 "" 0 "" {TEXT -1 40 "a polynomial that you know is primitive." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 39 " #f := PrimFactors[1];\nf := x^2+2*x +2;\n" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"fG,(*$)%\"xG\"\"#\"\"\"F**&F)F*F(F*F*F)F*" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 27 "Create a short name alias (" } {XPPEDIT 18 0 "alpha;" "6#%&alphaG" }{TEXT -1 32 ") for the root of th e polynomial" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "alias(alpha=RootOf( f));" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#%&alphaG" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 69 "In GF(q) each element can be uniquely represented \+ as a polynomial in " }{TEXT 256 1 "a" }{TEXT -1 89 " of degree less t han n.\nEvery nonzero element can be uniquely represented as a power o f " }{XPPEDIT 18 0 "alpha;" "6#%&alphaG" }{TEXT -1 19 " between 0 and \+ q-2." }}{PARA 0 "" 0 "" {TEXT -1 95 "Maple has a Normal function that \+ can be used with \"mod p\" to reduce an arbitrary poynomial in " } {TEXT 257 1 "a" }{TEXT -1 9 ", taking " }}{PARA 0 "" 0 "" {TEXT -1 57 "account of the polynomial it satisfies and the modulus p." }}{PARA 0 "" 0 "" {TEXT -1 95 "It will be handy to have a table to go back and f orth between the expression of a field element" }}{PARA 0 "" 0 "" {TEXT -1 19 "as a polynomial in " }{TEXT 258 1 "a" }{TEXT -1 34 " and \+ the expression as a power of " }{TEXT 259 2 "a." }{TEXT -1 0 "" }} {PARA 0 "" 0 "" {TEXT -1 23 "You should check that " }{XPPEDIT 18 0 " alpha;" "6#%&alphaG" }{TEXT -1 17 "^(p^n - 1) is 1.\n" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "FieldTable := Matrix(q,2):" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 273 "MakeTable := proc(qq, pp, prim_elt)\nlocal indx; \+ global FieldTable;\n\n\nfor indx from 0 to qq - 1 do\n print(prim_e lt^indx = Normal (prim_elt^indx ) mod pp);\n FieldTable[indx+1,1] := prim_elt^indx;\n FieldTable[indx+1,2] := Normal(prim_elt^indx) mod \+ pp;\nend do:\nend proc;" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%*MakeTabl eGf*6%%#qqG%#ppG%)prim_eltG6#%%indxG6\"F,?(8$\"\"!\"\"\",&9$F0F0!\"\"% %trueGC%-%&printG6#/)9&F.-%$modG6$-%'NormalG6#F:9%>&%+FieldTableG6$,&F .F0F0F0F0F:>&FE6$FG\"\"#F " 0 "" {MPLTEXT 1 0 21 "MakeTable(q,p,alpha);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" } }{PARA 11 "" 1 "" {XPPMATH 20 "6#/\"\"\"F$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/%&alphaGF$" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&al phaG\"\"#\"\"\",&F&F(F(F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&alp haG\"\"$\"\"\",&F&\"\"#F(F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&a lphaG\"\"%\"\"\"\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&alphaG \"\"&\"\"\",$F&\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&alphaG\" \"'\"\"\",&F&\"\"#F*F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&alphaG \"\"(\"\"\",&F&F(\"\"#F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#/*$)%&alph aG\"\")\"\"\"F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#\"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 124 "Maple will normally print only matrices \+ smaller than 10 by 10. The following command allows you to print larg er matrices..\n" }{MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 26 "#interface(rtablesize=25);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 11 "FieldTable;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"* CfyP\"-%'MATRIXG6#7+7$\"\"\"F,7$%&alphaGF.7$*$)F.\"\"#F,,&F.F,F,F,7$*$ )F.\"\"$F,,&F.F2F,F,7$*$)F.\"\"%F,F27$*$)F.\"\"&F,,$F.F27$*$)F.\"\"'F, ,&F.F2F2F,7$*$)F.\"\"(F,,&F.F,F2F,7$*$)F.\"\")F,F," }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 23 "Finite Field Procedures" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Here are a few procedures to make operations over fini te fields easier." }}{PARA 0 "" 0 "" {TEXT -1 0 "" }}}{EXCHG {PARA 0 " " 0 "" {TEXT -1 162 "When doing operations on the field, it would be n ice to have all results in terms of the power of the \nprimitive eleme nt rather than as elements of the field. \n" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 462 "Eform := proc(element)\n local elt, indx;\n\n el t := Normal(element) mod p;\n if (elt = 0) then\n RETURN(0);\n \+ end if;\n\n indx := 1;\n while (indx < RowDimension(FieldTable)) do\n if (FieldTable[indx,2] = elt) then\n RETURN(FieldTa ble[indx,1]);\n end if;\n indx := indx + 1;\n end do;\n pri nt(element,elt, \": Element not associated with a root power!\");\n \+ RETURN(0); #These last two lines only occur if the while loop fails.\n end proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 116 "Finv := proc( element)\nlocal elt, deg;\n\nelt := Eform(element);\ndeg := degree(elt ,alpha);\nRETURN(alpha^(n-deg));\nend;\n" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%%FinvGf*6#%(elementG6$%$eltG%$degG6\"F+C%>8$-%&EformG6#9$>8%-% 'degreeG6$F.%&alphaG-%'RETURNG6#)F8,&%\"nG\"\"\"F4!\"\"F+F+F+" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 14 "Finv(alpha^5);" }}{PARA 11 " " 1 "" {XPPMATH 20 "6#*$)%&alphaG\"#5\"\"\"" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 59 "Procedures for Matrices and Polynomials over a Finite \+ Field" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 93 "The next thing I want is a routine is to multiply matrices where the matrix elements are from" }}{PARA 0 "" 0 "" {TEXT -1 46 "the finite field that was just constructed. " }}{PARA 0 "" 0 "" {TEXT -1 123 "If we just multiply the matrices using M.N the result is not reduced mod p and it is not reduced using the equation that \+ " }{TEXT 260 1 "a" }{TEXT -1 11 " satisfies." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 51 "M:= Matrix(2,2,[[1+alpha,alpha^18],[1+2*alpha,0] ]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"MG-%'RTABLEG6$\"*o***e8-%'M ATRIXG6#7$7$,&%&alphaG\"\"\"F0F0*$)F/\"#=F07$,&F0F0*&\"\"#F0F/F0F0\"\" !" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "N := M^4;" }}{PARA 12 " " 1 "" {XPPMATH 20 "6#>%\"NG-%'RTABLEG6$\"*SxvP\"-%'MATRIXG6#7$7$,&*$) ,&*$),&%&alphaG\"\"\"F6F6\"\"#F6F6*&)F5\"#=F6,&F6F6*&F7F6F5F6F6F6F6F7F 6F6*(F3F6F9F6F;F6F6,&*(F1F6F4F6F9F6F6*(F4F6)F5\"#OF6F;F6F67$,&*(F;F6F4 F6F1F6F6*(F9F6)F;F7F6F4F6F6,&F=F6*&FAF6FGF6F6" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "N1 := map(expand, N);" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#>%#N1G-%'RTABLEG6$\"*g)fx8-%'MATRIXG6#7$7$,:\"\"\"F/*$) %&alphaG\"\"%F/F/*&F3F/)F2\"\"$F/F/*&F6F/)F2\"#=F/F/*&\"#:F/)F2\"#?F/F /*&\"\"'F/)F2\"#@F/F/*&\"#7F/)F2\"#>F/F/*&F3F/)F2\"#PF/F/*&F3F/)F2\"#Q F/F/*$)F2\"#OF/F/*&F3F/F2F/F/*&F?F/)F2\"\"#F/F/,0*$F@F/F/*&F6F/F " 0 "" {MPLTEXT 1 0 17 "map(modp, N1, p);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6 $\"*wCwP\"-%'MATRIXG6#7$7$,,\"\"\"F-*$)%&alphaG\"\"%F-F-*$)F0\"#=F-F-* $)F0\"#?F-F-*$)F0\"#OF-F-,**$)F0\"#@F-F-F5F-*$)F0\"#>F-F-F2F-7$,**$)F0 \"\"$F-F-*$)F0\"\"#F-F-F0F-F-F-,(F5F-F2F-F8F-" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 141 "Well that gets us part of the way. The following fun ction takes a matrix A and applies Normal () mod p to reduce modulo th e polynomial that " }{TEXT 261 2 "a " }{TEXT -1 68 "satisfies. \nIt a lso changes to the exponential form by using Eform." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 259 "MatEform := proc(A)\n local i, j, k, W ;\n\n W := Matrix(RowDimension(A), ColumnDimension(A));\n for i fr om 1 to RowDimension(A) do\n for k from 1 to ColumnDimension(A) d o\n W[i,k] := Eform(A[i,k]);\n end do;\n end do;\n RE TURN(W);\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 18 "MatE form(M.M.M.M);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"*oowP \"-%'MATRIXG6#7$7$\"\"!\"\"\"7$*$)%&alphaG\"#7F-F1" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "This is a similar routine for polynomials to powe rs of the root in the field." }}{PARA 0 "" 0 "" {TEXT -1 64 "The varia ble var for the polynomial is an input to the function." }}{PARA 0 "> \+ " 0 "" {MPLTEXT 1 0 326 "PolyEform := proc(poly, var)\n local retpol y, indx, coef;\n\n retpoly := 0;\n for indx from 0 to degree(poly) do\n coef := coeff(poly, var, indx);\n if (coef <> 0) then \n coef := Eform(coef);\n retpoly := retpoly + coef*va r^indx;\n end if;\n end do;\n sort(retpoly);\n RETURN(retpo ly);\nend proc:" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 277 "MatPoly Eform := proc(A,var,p)\n local i, j, k, W;\n\n W := Matrix(RowDime nsion(A), ColumnDimension(A));\n for i from 1 to RowDimension(A) do \n for k from 1 to ColumnDimension(A) do\n W[i,k] := Poly Eform(A[i,k],var);\n end do;\n end do;\n RETURN(W);\nend proc :" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 47 "Examples: Finite Field Ope rations with Matrices" }}{EXCHG {PARA 0 "" 0 "" {TEXT -1 103 "Start wi th some very simple operations on the field. Verify that the followin g results are correct for" }}{PARA 0 "" 0 "" {TEXT -1 24 "the defined \+ Finite Field" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "Normal(alpha^5) mod p; " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "Normal(alpha^10) mod p;" } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "g := Normal(alpha^5 + alpha^10) mo d p;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "Eform(g);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 38 "g := Normal(alpha^5 * alpha^10) mod p;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 9 "Eform(g);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #,$%&alphaG\"\"#" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,&%&alphaG\"\"\"F% F%" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"gG\"\"\"" }}{PARA 11 "" 1 " " {XPPMATH 20 "6#\"\"\"" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"gG,&%&a lphaG\"\"\"\"\"#F'" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*$)%&alphaG\"\"( \"\"\"" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "Now move on to some mat rix examples in the field" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 58 "A := M atrix([[alpha^105,alpha^10],[alpha^115,alpha^120]]);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 56 "B := Matrix([[alpha^125,alpha^13],[alpha^15,alph a^14]]);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"AG-%'RTABLEG6$\"*c_!y8 -%'MATRIXG6#7$7$*$)%&alphaG\"$0\"\"\"\"*$)F0\"#5F27$*$)F0\"$:\"F2*$)F0 \"$?\"F2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"BG-%'RTABLEG6$\"*?t!y8 -%'MATRIXG6#7$7$*$)%&alphaG\"$D\"\"\"\"*$)F0\"#8F27$*$)F0\"#:F2*$)F0\" #9F2" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 71 "Put the sample arays into the correct Normal form for the current field" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "ANorm := MatEform(A,p);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 23 "BNorm := MatEform(B,p);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&ANormG-%'RTABLEG6$\"*+%Rl8-%'MATRIXG6#7$7$%&alphaG*$)F.\"\"# \"\"\"7$*$)F.\"\"$F2F2" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%&BNormG-%' RTABLEG6$\"*KM\"y8-%'MATRIXG6#7$7$*$)%&alphaG\"\"&\"\"\"F.7$*$)F0\"\"( F2*$)F0\"\"'F2" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 77 "Addition is as \+ you would expect. Note LinearAlgebra Add() or '+' can be used" } {MPLTEXT 1 0 0 "" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "MatEform(Add(A, B),p);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 29 "MatEform(Add(ANorm,BNorm) ,p);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "MatEform(A+B,p);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 6 "A + B;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6# -%'RTABLEG6$\"*gb\"y8-%'MATRIXG6#7$7$\"\"!\"\"\"7$F,*$)%&alphaG\"\"&F- " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"*/(>y8-%'MATRIXG6#7$ 7$\"\"!\"\"\"7$F,*$)%&alphaG\"\"&F-" }}{PARA 11 "" 1 "" {XPPMATH 20 "6 #-%'RTABLEG6$\"*/>#y8-%'MATRIXG6#7$7$\"\"!\"\"\"7$F,*$)%&alphaG\"\"&F- " }}{PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"*S!yj8-%'MATRIXG6#7$ 7$,&*$)%&alphaG\"$0\"\"\"\"F1*$)F/\"$D\"F1F1,&*$)F/\"#5F1F1*$)F/\"#8F1 F17$,&*$)F/\"$:\"F1F1*$)F/\"#:F1F1,&*$)F/\"$?\"F1F1*$)F/\"#9F1F1" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 0 "" }}{PARA 0 "" 0 "" {TEXT -1 33 "No surprises with Multiplication " }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 4 "A.B;" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "MatEform(A.B,p);" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"*Gn#y8-%'MATRIXG6#7$7$,& *$)%&alphaG\"$I#\"\"\"F1*$)F/\"#DF1F1,&*$)F/\"$=\"F1F1*$)F/\"#CF1F17$, &*$)F/\"$S#F1F1*$)F/\"$N\"F1F1,&*$)F/\"$G\"F1F1*$)F/\"$M\"F1F1" }} {PARA 11 "" 1 "" {XPPMATH 20 "6#-%'RTABLEG6$\"*s)Gy8-%'MATRIXG6#7$7$*$ )%&alphaG\"\"%\"\"\"*$)F.\"\"&F07$F.F1" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 50 "Examples: Finite Field Operations with Polynomials" }} {EXCHG {PARA 0 "" 0 "" {TEXT -1 90 "The goal here is to work with poly nomials where the coefficients are members of the field." }}{PARA 0 " " 0 "" {TEXT -1 47 "Start with a couple of very simple polynomials." } }{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "g := alpha*x + alpha;" }}{PARA 0 " > " 0 "" {MPLTEXT 1 0 35 "g2 := alpha^2*x^2 + alpha*x +alpha;" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 49 "g3 := alpha^3*x^3 + alpha^2*x^2 + a lpha*x +alpha;" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%\"gG,&*&%&alphaG\" \"\"%\"xGF(F(F'F(" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#g2G,(*&)%&alph aG\"\"#\"\"\")%\"xGF)F*F**&F(F*F,F*F*F(F*" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#g3G,**&)%&alphaG\"\"$\"\"\")%\"xGF)F*F**&)F(\"\"#F*) F,F/F*F**&F(F*F,F*F*F(F*" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 58 "Notic e the ugly mess when these polynomials are multiplied" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 22 "sort(expand(g*g2*g3));" }}{PARA 12 "" 1 "" {XPPMATH 20 "6#,:*&)%&alphaG\"\"'\"\"\")%\"xGF'F(F(*(\"\"#F()F&\"\"&F( )F*F.F(F(*&F%F(F/F(F(*(F,F()F&\"\"%F()F*F3F(F(*(\"\"$F(F-F(F4F(F(*(F3F (F2F()F*F6F(F(*&)F&F6F(F8F(F(*&F-F(F8F(F(*(F6F(F:F()F*F,F(F(*(F,F(F2F( F=F(F(*(F6F(F:F(F*F(F(*$F:F(F(" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 55 "Try to control it by using the standard Normal function" }{MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 36 "sort(Normal(expand (g*g2*g3)) mod p);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#*&,&%&alphaG\"\" #F&\"\"\"F',.*$)%\"xG\"\"'F'F'*&F$F')F+\"\"&F'F'*&,&F%F'F'F'F')F+\"\"% F'F'*&,&F%F&F'F'F')F+\"\"$F'F'*&F1F')F+F&F'F'*&F&F'F%F'F'F'" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 97 "Better, but what I really want is \+ to convert the coefficients into the proper powers of the root." } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 42 "g4 := s ort(Normal(expand(g*g2*g3)) mod p);" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "g4 := PolyEform(g4,x,p);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#g4G *&,&%&alphaG\"\"#F(\"\"\"F),.*$)%\"xG\"\"'F)F)*&F&F))F-\"\"&F)F)*&,&F' F)F)F)F))F-\"\"%F)F)*&,&F'F(F)F)F))F-\"\"$F)F)*&F3F))F-F(F)F)*&F(F)F'F )F)F)" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#>%#g4G,.*&)%&alphaG\"\"'\"\" \")%\"xGF)F*F**&)F(\"\"%F*)F,\"\"&F*F**$)F,F/F*F**&F(F*)F,\"\"$F*F**$) F,\"\"#F*F**$)F(F6F*F*" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 20 "P olyEform(g4^3,x,p);" }}{PARA 11 "" 1 "" {XPPMATH 20 "6#,.*&)%&alphaG\" \"#\"\"\")%\"xG\"#=F(F(*&)F&\"\"%F()F*\"#:F(F(*$)F*\"#7F(F(*&)F&\"\"$F ()F*\"\"*F(F(*$)F*\"\"'F(F(F&F(" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "5" 0 }{VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }{RTABLE_HANDLES 135899968 137757740 137759860 137762476 137766868 }{RTABLE M7R0 I6RTABLE_SAVE/135899968X,%)anythingG6"6"[gl!"%!!!#%"#"#,&-%'RootOfG6#,(*$%#_ZG" "%"""F-F/F/F/F/F/F/,&F/F/F(""#*$F("#=""!6" } {RTABLE M7R0 I6RTABLE_SAVE/137757740X,%)anythingG6"6"[gl!"%!!!#%"#"#,&*$,&*$,&-%'RootOfG6#,( *$%#_ZG""%"""F1F3F3F3F3F3F3""#F3*&F,"#=,&F3F3F,F4F3F3F4F3*(F+F4F,F6F7F3F3,&*(F7 F3F+F3F)F3F3*(F,F6F7F4F+F3F3,&*(F)F3F+F3F,F6F3*(F+F3F,"#OF7F3F3,&F8F3*&F,F?F7F4 F36" } {RTABLE M7R0 I6RTABLE_SAVE/137759860X,%)anythingG6"6"[gl!"%!!!#%"#"#,:"""F(*$-%'RootOfG6#,(* $%#_ZG""%F(F/F(F(F(F0F(*$F*""$F0*$F*"#=F2*$F*"#?"#:*$F*"#@""'*$F*"#>"#7*$F*"#PF 0*$F*"#QF0*$F*"#OF(F*F0*$F*""#F:,4F1""(FD""*F*""&F;"#5F5"#;F)FEF8"")F(F(F3FE,0F 8F(F5F2F;F2F3F(F>F:FBFEF@F0,0F5FIF8FEF;F0F3F(FBF(F>F0F@F06" } {RTABLE M7R0 I6RTABLE_SAVE/137762476X,%)anythingG6"6"[gl!"%!!!#%"#"#,,"""F(*$-%'RootOfG6#,(* $%#_ZG""%F(F/F(F(F(F0F(*$F*"#=F(*$F*"#?F(*$F*"#OF(,**$F*""$F(*$F*""#F(F*F(F(F(, **$F*"#@F(F3F(*$F*"#>F(F1F(,(F3F(F1F(F5F(6" } {RTABLE M7R0 I6RTABLE_SAVE/137766868X,%)anythingG6"6"[gl!"%!!!#%"#"#""!*$-%'RootOfG6#,(*$%#_ ZG""%"""F.F0F0F0"#7F0-F*F+6" }