Ising Model

In an Ising model, the Hamiltonian of one configuration of spins $\vec{s}$ is:

$$ H(\vec{s}, \mathcal{J}, \mathcal{h}) = \sum_{i} h_{i} s_{i} + \sum_{i \ne j}J_{ij} s_{i}s_{j} $$

where each spin $s_{i} = \pm 1$.

The partition function of an Ising model is:

$$Z(\mathcal{J}, \mathcal{h}) = \sum_{\vec{r}} \exp \left [ H(\vec{r}, \mathcal{J}, \mathcal{h}) \right]$$

The summation is over all possible configurations and $r_{i} = \pm 1$ for all $i$.


How to formulate the exponential of binary variables in the partition function for QUBO-type problems?


1 Answer 1


Luckily in this case, the exponential can be treated in a way very similar to how we're already familiar. If we use the example that I chose in my answer to your recent question, we would have, where your $\vec{r}$ is just $(s_1,s_2)$:

$$\tag{1} Z=\sum_{s_1,s_2} e^{\left(\mathcal{J}s_1s_2 + hs_1\right)}. $$

If $\mathcal{J}=2.5$ and $h=3$, then we would have:

\begin{align}\tag{2} \hspace{-15mm}Z &\hspace{-5mm}= e^{\left(2.5(-1)(-1) + 3(-1)\right)} + e^{\left(2.5(1)(-1) + 3(1)\right)} + e^{\left(2.5(-1)(1) + 3(-1)\right)} + e^{\left(2.5(1)(1) + 3(1)\right)} \!\!\! \\ \tag{3} &\hspace{-5mm}=e^{2.5-3}+e^{-2.5+3}+e^{-2.5-3} + e^{2.5+3}\\\tag{4} &\hspace{-5mm}=246.951. \end{align}

A more challenging, but separate, question would be how to keep something like Eq. 10 from that answer linked above, in QUBO format when we are exponentiating binary variables such as when $\mathcal{J}$ and $h$ are not known constants but are instead written using several binary variables.

  • $\begingroup$ When the number of spins is 50, the number of possible configurations is $2^{50}$. That means $2^{50}$ terms in that equation. This seems to be impractical for 50 spins. $\endgroup$ Jul 25, 2021 at 6:29
  • $\begingroup$ Correct. Maybe you can switch from {-1,1} to {0,1} and can figure out ahead of time which ones give an energy of 0, for example in my case when s1=0 you don't even need to check the s2 cases. However at 50 spins things will be hard. $\endgroup$ Jul 25, 2021 at 13:08

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.