# hw 6 - Pablo Blanco # OK to post ###### # Outputs ALL 2 by 2 matrices of the form # # [[a,b+I*c],[b-I*c,d]] # # where a,b,c,d, are integers such that 1 <= a,b,c,d <= K ##### AllHM2:=proc(K) local a,b,c,d: {seq(seq(seq(seq( [[a,b+I*c],[b-I*c,d]],a=1..K ),b=1..K ),c=1..K ),d=1..K )}: end: ##### # Normalize(v): Helper function that returns a vector which is v normalized. ##### Normalize:=proc(v) local n,N,i: n:=nops(v): N:=add(expand(v[i]*conjugate(v[i])) ,i=1..n): [seq(v[i]/sqrt(N) ,i=1..n)]: end: ##### # Generates all [a,b] with 1<=a,b<=K, then outputs the normalized [a,b]. # Note that this outputs FEWER than K^2 vectors. e.g., [3,3] and [4,4] are the same once normalized. ##### RealSV2:=proc(K) local a,b: {seq(seq( Normalize([a,b]),a=1..K),b=1..K)}: end: UncertaintyContest:= proc(K): end: