Homepage > MCMC ## Potts Model

The Ising model is a special case of the Potts model since their Hamiltonian functions and satisfy when or accordingly as or 0. The Potts model in potts.r assumes . Thus, the Potts model with and the inverse temperature 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 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 of common states and inverse temperature , 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 matrix of data a is created with

  data.matrix = matrix(data=a, n, m)

where the data 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 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 matrix of external force, and run the Gibbs sampler for Potts model.

© TTU Mathematics