#GLORIA LIU, Feb 17 2024, Assignment 9 read `C9.txt`: #=====================================# #1. By looking at the beautiful valentines figure out the age of each of the creators (recall that 26 and 27 yield the same coded message). Also make sure that the authors consistently used the Caesar code. #When I did the Valentine ratings I did not notice that there were valentines in the /txt folder and gave people 0 by accident :( #Alex Varjabedian: 19 #Aurora Hiveley: 23 #Me: 21 #Himanshu Chandra: 22 #Isaac Lam: I couldn't tell from Valentine #Joseph Koutsoutis: 20 #Kaylee Weatherspoon: 22 #Lucy Martinez: 25 #Natalya Ter-Saakov: 24 #Pablo Blanco: 22 #RDB: I couldn't tell from Valentine #Ramesh Balaji: 19 #Ryan Badi: 20 #Shaurya Baranwal: 19 #Daniel Elwell: I couldn't tell from Valentine #Nuray Kutlu: 20 #=====================================# #2. Writre a procedure #antiPCM(q,H): #inputs the modolus q, and a parity check matrix in standard form, outputs the corresponding #generating matrix M of a linear code over GF(q) such that #antiPCM(q,PCM(q,M))=M and PCM(q,AntiPCM(q,H))=H antiPCMFail:=proc(q,H) local M1,result: M1:=SFde(q,H): #print(M1); result:=PCM(q,M1): SFde(q,result): end: antiPCM:=proc(q,H) local k,n,M,i,j: #option remember: n:=nops(H[1]): k:=n-nops(H): M:=[seq([seq(0,j=1..n)],i=1..k)]: for i from 1 to k do for j from 1 to k do M[i][j]:=0: if i=j then M[i][j]:=1: fi: od: od: for i from 1 to n-k do for j from 1 to k do M[j][i+k]:=-H[i][j] mod q: od: od: M: end: #Testing with(LinearAlgebra): for j from 1 to 10 do q:=ithprime(rand(1..5)()): n:=rand(3..10)(): k:=rand(2..n-1)(): M:=[seq(RV(q, n), i = 1 .. k)]: M1:=SFde(q,M): H:=PCM(q,M1): M2:=antiPCM(q,H): if M1 = M2 then print("success"); else print(matrix(M1)); print(matrix(H)); print(matrix(M2)); fi: od: #=====================================# #3.Write a procedure #DecodeLT(q,M) : #that is similar to DecodeT(q,n,C), that inputs a generating matrix M (note that n=nops(M[1])), and #uses the Syndrom Table to construct a table that mays every vector in Fqn(q,n) to the member of #LtoC(q,M) that it is mapped to. DecodeLT:=proc(q,M) local S, T, sTable, syndroms, C, cosetLeader, syndrom: S:=Fqn(q,n): sTable:=SynT(q,M)[1]: C:=LtoC(q,M): H:=PCM(q,M): for v in S do syndrom:=Syn(q,H,v): cosetLeader:=sTable[syndrom]: #T[v]:=v-cosetLeader: T[v]:=[seq(v[i] - cosetLeader[i], i=1..nops(v))]: od: op(T): end: