Homepage > MCMC

Potts Model

The Ising model is a special case of the Potts model since their Hamiltonian functions $ H(x)$ and $ \tilde{H}(\tilde{x})$ satisfy $ H(x) = 2 \tilde{H}(\tilde{x})$ when $ x_v = 1$ or $ -1$ accordingly as $ \tilde{x}_v = 1$ or 0. The Potts model in potts.r assumes $ J = 1$. Thus, the Potts model with $ M = 2$ and the inverse temperature $ \beta = \log(1+\sqrt{2}) \approx 0.8814$ simulates the phase transition for Ising model.

> source("potts.r")
> potts(m=2,tmax=1000,beta=0.88)
> potts(m=2,tmax=1000,beta=0.89)

Reference to external force. An external force at each site is indicated by $ 0,1,\ldots,M$ where the state 0 implies no external force at a particular site. Entire data of external force is represented in a matrix. To see the external force, use it as initial state

> potts(m=2,tmax=0,init.state=f1)
> potts(m=5,tmax=0,init.state=f2)

Explore it. Download potts.r. Choose a different number $ M$ of common states and inverse temperature $ \beta$, and see how the Gibbs sampler generates a GRF with or without existence of external force.

> source("potts.r")
> potts(m=2,tmax=1000,beta=0.9)
> potts(m=2,tmax=1000,beta=0.9,ref.state=f1)
> potts(m=5,tmax=1000,beta=1.1)
> potts(m=5,tmax=1000,beta=1.1,ref.state=f2)

Programming note. An $ n\times m$ matrix of data a is created with

  data.matrix = matrix(data=a, n, m)
where the data $ a$ is a sequence of values, and will be assigned from the first column to the last column of the matrix. For example, a matrix form of Potts state in $ 4\times 4$ grid is created and visualized as follows.
> s1 = matrix(data=c(1,2,3,3,1,2,2,3,1,1,2,2,1,1,1,2), 4, 4)
> potts(m=3,tmax=0,init.state=s1)

Explore it. Create a $ 20\times 20$ matrix of external force, and run the Gibbs sampler for Potts model.

© TTU Mathematics