<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def expected_value(operator, eig_values, eig_states, beta):
 """Calculates the average value of an observable it requires that states and operators have the same base"""

    aux = np.einsum('i,ji,ji', np.exp(-beta*eig_values),
                    eig_states, operator.dot(eig_states))

    return aux / partition_func(beta, eig_values)