#not OK to post homework #Nick Belov, Feb 9nd 2025, Assignment 4 read "C5.txt": #PM(): the three famous Pauli matrices sigma_x,sigma_y, sigma_z #RHM(n,K): a random n by n Hermitian matrix with entriries from -K to K #EV(L): inputs a Hermitian matrix (say n by n) and outputs the LIST of eigenvalues #EVC1(L,g): inputs a matrix L and an eigenvalue g finds the NORMALIZED eigenvector #EVC(L): inputs a Hermitian matrix and outputs the pair ListOfEigenvalues, ListOfEigenvectors #ProbDist(L,A): Given an obervalble represented by the Hermitian matrix L and a state vector A outputs first all the eigenvectors (pure states) and the prob. of winding in the respective pure states followed by the expected value of A (i.e. if you make the observation L and the state is A the average in the long run #RandomState(n,K) #that inputs a pos. integer n and a pos. integer K and outputs a random state vector with n complex components whose real and imaginary parts are from -K to K, then normalize it. RandomState:=proc(n,K) local i,res,ra,m; ra:=rand(-K..K); res:=[seq(ra()+ra()*I,i=1..n)]; m:=add(res[i]^2,i=1..n); m:=sqrt(m); res:=[seq(res[i]/m,i=1..n)]; return res; end: #inputs a NORMALIZED vector n=[nx,ny,nz] #that constructs the 2 by 2 matrix. at the bottm of p. 349 of the Susskind-Frieman Quantum Mechanics book book. GeneralPauli := proc(v) local nx, ny, nz; nx := v[1]; ny := v[2]; nz := v[3]; # Return the 2x2 matrix as a list of lists: return [ [ (nz), nx - I*ny ], [ nx + I*ny, -nz ] ]; end: #eigen values seem to be 1 and -1 !