#not OK to post homework #Nick Belov, Feb 9nd 2025, Assignment 5 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 #UM(alpha,beta,gamma,delta) #that implements box 1.1. on p. 20 of the The Nielsen-Chuang book [Note the superflous comma] #For random alpha, beta, gamma, delta apply it to IsUM(A). Also, a litle bit of challenge, prove it for geneal (symbolic) alpha,beta,gamma, delta UM := proc(alpha, beta, gamma, delta) local ealph, ebetaminus, ebetaplus, edeltaminus, edeltaplus; local c, s; local f1, f2, f3; local M1, M2, Mfinal; ealph := exp(I*alpha); ebetaminus := exp(-I*beta/2); ebetaplus := exp( I*beta/2); edeltaminus := exp(-I*delta/2); edeltaplus := exp( I*delta/2); # Trig pieces c := cos(gamma/2); s := sin(gamma/2); f1 := Matrix([[ebetaminus,0], [0,ebetaplus]]); f2 := Matrix([[c,-s], [s,c]]); f3 := Matrix([[edeltaminus, 0], [0,edeltaplus]]); M1 := f1 . f2; M2 := M1 . f3; Mfinal := ealph * M2; return [ [ Mfinal[1,1], Mfinal[1,2] ], [ Mfinal[2,1], Mfinal[2,2] ] ]; end: