# Please do not post # Omar Aceval Garcia, due 2/09/2025. Assignment 5 # Gives a random state vector: RandomState := proc(n,K) local ra,m,i,V : ra := rand(-K..K): V := [seq(ra() + I*ra(), i=1..n)]: m := sqrt(add(V[i]^2, i=1..n)): for i from 1 to n do V[i] := V[i]/m: od: return V: end: # I tried verifying that RHM(3,10) gives real eigenvalues by using EV() but the outputs are algebraically complicated # and simplify() and rationalize() didn't seem to help maple properly show these are real values. But evalf() showed that # numerically, each component had imaginary value of order around 10^-9, hence these are probably real. # For a matrix A made by RandomState, the following code takes every pair of two vectors in EVC(A)[2] (the list of eigenvectors) # and verifies that their inner product is zero. VectorCheck := proc(evc) local i,j,n,vecs: vecs := evc[2]: n := nops(vecs): return [seq(seq(IP(vecs[i],vecs[j]) , j=(i+1)..n), i=1..n)] end: # Using the above I tried evalf(VectorCheck(EVC(RHM(3,10)))) and got a vector where each entry has real and imaginary components # which are of order 10^-10, aka a zero vector for every inner product of eigenvectors. GeneralPauli:= proc(n) local nx,ny,nz: nx:= n[1]: ny:= n[2]: nz:= n[3]: return [[nz, nx - I*ny],[nx + I*ny, -nz]]: end: # Experimenting with this function and using EVC() I keep getting Unitary matrices with eigenvalues 1 and -1.