def msigma(i):
 if (i == 1):
  mat = ((0, 1), (1, 0))
 elif (i == 2):
  mat = ((0, (- I)), (I, 0))
 elif (i == 3):
  mat = ((1, 0), (0, (-1)))
 else:
  raise IndexError('Invalid Pauli index')
 return Matrix(mat)

def msigma ( i ) : if ( i == 1 ) : mat = ( ( 0 , 1 ) , ( 1 , 0 ) ) elif ( i == 2 ) : mat = ( ( 0 , ( - I ) ) , ( I , 0 ) ) elif ( i == 3 ) : mat = ( ( 1 , 0 ) , ( 0 , ( - 1 ) ) ) else : raise IndexError ( 'Invalid Pauli index' ) return Matrix ( mat )
returns a pauli matrix sigma_i with i=1 .