code: def expected_value(operator, eig_values, eig_states, beta):
      
      aux = np.einsum('i,ji,ji', np.exp(-beta*eig_values),
                      eig_states, operator.dot(eig_states))
  
      return aux / partition_func(beta, eig_values)
docs: Calculates the average value of an observable
         it requires that states and operators have the same base