#OK to post homework #Joseph Koutsoutis, 02-18-2024, Assignment 8 read `C8.txt`: #1 WtEnumerator := proc(q,M,t) local v,C,zero,n: n := nops(M[1]): zero := [0$n]: C := LtoC(q,M): add(t^HD(zero,v), v in C): end: #2 I don't know if this relation works for all generator matrices and all q but here was my process/attempt: #The first test that gave me a decent result was trying to relate #M = [] to H = I_n, the nxn identity matrix, when treated as generator matrices with entries in GF(2). #For M, WtEnumerator computes 1, and for H, WtEnumerator computes (1+t)^n. #This initially suggested treating the 1 for the polynomial for M as 1^n and substituting 1 -> 1+t and t -> -t. #Substituting 1^n -> 1+t is ambiguous, so I experimented with the following function instead: WtEnumerator2 := proc(q,M,s,t,M_empty := false,dim := 0) local v,C,zero,n: if M_empty then RETURN(s^dim): fi: n := nops(M[1]): zero := [0$n]: C := LtoC(q,M): add(s^(n-HD(zero,v))*t^HD(zero,v), v in C): end: #which computes Sum(s^(n-wt(v))*t^(wt(v)), v in C) #(the optional arguments just tell the function if M is the empty generator matrix). #Now for M = [], WtEnumerator2 computes s^n, and for H = I_n, WtEnumerator2 computes (s+t)^n. #This suggests trying the substitution s -> s+t and t -> -t. #However, this failed when trying to relate #M = [[1,0]] to H = [[0,1]], where WtEnumerator2 computes s^2+st for both of these matrices. #Some trial and error led me to the substitution s -> s+t, t -> s-t followed by division by the size #of the code. For example, WtEnumerator2 computes s^2+st for M=[[1,0]], and this substitution means that #for the dual code, we expect to compute ((s+t)^2+(s+t)(s-t)) / 2^1 = (s+t)(2s)/2 = s^2+st as desired. #Here we test this for a few values of n,d: TestWtEnumeratorGuess := proc() local n,d,k,M,H,f,g: for n in [3,4,5,6,7,8,9] do: for d from 2 to n do: M := SFde(2, GLC(2,n,d)): k := nops(M): if k <> 0 and k <> n then: H := PCM(2,M); f := WtEnumerator2(2, M, s+t, s-t) / 2^k: g := WtEnumerator2(2, H, s, t): if expand(f-g)<>0 then RETURN(FAIL): fi: fi: od: od: RETURN(SUCCESS): end: #Next I tried a similar procedure for general q. #For trying to relate M = [] with H = I_n, the nxn identity matrix, #WtEnumerator2 computes s^n for M and (s+(q-1)t)^n for H. #Trying the approach s -> s+(q-1)t and t -> s-t followed by division by the size of the code #appears to work well after testing a few values of q,n,k starting with a random generator matrix in std form: CreateRandomStdMatrix := proc(q,n,k) local M,i,j,rng: rng := rand(0..q-1): for i from 1 to k do for j from 1 to k do if i=j then M[i,j] := 1: else M[i,j] := 0: fi: od: for j from k+1 to n do M[i,j] := rng(): od: od: [seq([seq(M[i,j],j=1..n)],i=1..k)]: end: TestWtEnumeratorGuess2 := proc() local q,n,d,k,M,H,f,g: for q in [3,4,5,7,8] do: for n in [3,4,5,6,7,8] do: for k from 1 to n-1 do: M := CreateRandomStdMatrix(q,n,k): k := nops(M): H := PCM(q,M); f := WtEnumerator2(q, M, s+(q-1)*t, s-t) / q^k: g := WtEnumerator2(q, H, s, t): if expand(f-g)<>0 then RETURN(FAIL): fi: od: od: od: RETURN(SUCCESS): end: #This relation worked for the values I tested, but I do not know how to prove if it works for all inputs.