# Ok to post homework # Lucy Martinez, 03-25-2025, Assignment 16 with(combinat): ###################### #Problem 2: Read Peter Shor's seminal paper p. 9 and write procedures # ToffoliMatrix() and FredkinMatrix() that returns the appropriate 8 by 8 matrices ToffoliMatrix:=proc(): [ [1,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0], [0,0,1,0,0,0,0,0], [0,0,0,1,0,0,0,0], [0,0,0,0,1,0,0,0], [0,0,0,0,0,1,0,0], [0,0,0,0,0,0,0,1], [0,0,0,0,0,0,1,0] ]: end: FredkinMatrix:=proc(): [ [1,0,0,0,0,0,0,0], [0,1,0,0,0,0,0,0], [0,0,1,0,0,0,0,0], [0,0,0,1,0,0,0,0], [0,0,0,0,1,0,0,0], [0,0,0,0,0,0,1,0], [0,0,0,0,0,1,0,0], [0,0,0,0,0,0,0,1] ]: end: #Problem 3: Write a procedure Sjk(j,k) that expresses the matrix Sj,k # (Eq. (4.3),# p. 14) in our notation of lists-of-lists Sjk:=proc(j,k): if j