I'm trying to calculate total energy of a system $$ E(v, h) = -\sum a_iv_i - \sum b_jh_j - \sum_{i,j} v_ih_jw_{ij} $$ Python equivalent looks like this

def energy(v, h, a, b, w):
    v_h = np.outer(v, h)
    return -np.sum(a*v) - np.sum(b*h) - np.sum(np.multiply(v_h, w))

But when it comes to the partition function $$ Z = \sum_{v,h}e^{-E(v,h)} $$ (summing over all possible pairs of visible and hidden vectors). How do I get all these pairs? Is it all possible combinations for all available binary states for v and h vectors? I'm not sure where should I obtain these other states.

Let's assume my v = np.array([1, 0, 0, 0, 1, 1]) and h = np.array([1, 1]), what the expected result should be?

  • $\begingroup$ I think one can only know the number of particles with some set of properties, not which particle has which properties. So one needs to avoid overcounting. $\endgroup$ – Emil Feb 7 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.