```Introduction to Ising Model and Opinion
Dynamics for non-physicists (hopefully)
Sang Hoon Lee,
Complex Systems and Statistical Physics Lab.,
Dept. of Physics, KAIST,
June 23, 2007.
What is the Ising model?
• Ising model: a crude attempt to simulate the
structure of a physical ferromagnetic substance
• Main virtue(?): a 2D Ising model yields to an exact
treatment in statistical mechanics
• The only nontrivial example of a phase transition
that can be worked out with mathematical rigor
Basic terminologies in statistical physics, but (possibly)
not familiar to non-physicists~
cf) ferromagnetic substance (강자성체):
Fe(철), Co(코발트), Ni(니켈), etc
What’s the relationship with opinion dynamics?
• The system is an array of N fixed points called
lattice sites
• Associated with each lattice site is a spin variable
si (i = 1, …, N) which is a number that is either +1(↑;
spin-up) or -1(↓; spin-down)
• A given set of numbers {si} specifies a
configuration of the whole system
3D spin configuration spin configuration in a non-regular lattice
(or even a complex network!)
What is spin?
• Spin is the angular momentum intrinsic to particles such as
atoms, protons, or electrons. Such particles and the spin of
quantum mechanical systems (“particle spin”) possesses
several non-classical features and for such systems spin
angular momentum
cannot be associated
“net” magnetization
= +2 (x↑) with rotation but
instead refers only to the presence of angular momentum …
• For the purpose of qualitative understanding of Ising model,
just consider the spin variable as the basic unit of
magnetization~
N
S
S
N
N
or
S
+1
-1
N
S
N
S
N
S
S
N
N
S
“Thermodynamic” quantities …
Energy
E {si }   J  si s j  H
 ij 
…
s
i
i
interaction with the
neighbor-interaction
(ferromagnetic coupling) external magnetic field
External +J if si & sj have different signs
field H -J if s & s have the same sign
Entropy
i
j
…
“Energy-minimized” configuration
Entropy
…
<
…
S ( E )  k B log  E
# of possible configurations
for a given energy value E
…
Helmholtz
free energy F  E  TS
T: temperature (“control parameter”)
cf) if T = 0, only the energy term is considered!
Minimize F = “competition” between the energy
and entropy with the control parameter T
(energy minimization vs entropy maximization)
Main question in statistical mechanics:
What’s the configuration that minimize F for given
temperature values like? What’s the average of {si},
the variance of {si}, etc?
magnetization m
susceptibility χ
Phase transition (相轉移)
We can expect that the magnetization is reduced as the
temperature rises …
Mathematical singularity:
not differentiable, etc.
(“singularity” class or
type of phase transition)
m
disorder phase
T
TC (critical or
Curie temperature)
H=0
“spontaneous” magnetization:
magnetized without any
external magnetic field
from the TV series “CSI” …
If each spin variable represents the
“individual opinion” …
• Magnetization (average spin)
→ average opinion (majority vote)
How to interpret T in the opinion dynamics?
m
disorder phase
T
~ consensus
Things to consider:
“real” phase transition occurs only
in the thermodynamic limit (N → ∞)
& many other things, such as “how
to simplify people’s opinions to
the magnetic Ising model?”
Discontinuous (1st order) &
continuous (2nd order) transition
m
m
T
Continuous transition
T
Discontinuous transition
Solution of self-consistency equation
Topology matters!
Ising model energy
E  J
ss
i
i, j
Regular lattice in Euclidean space –
dimension, coordination number
Existence of shortcuts, randomness –
Watts-Strogatz small-world network
Heterogeneity of connections –
scale-free network
j
Ising model on complex networks
Review paper about the critical phenomena in complex network:
S. N. Dorogovtsev, A. V. Goltsev, and J. F. F. Mendes,
“Critical phenomena in complex networks”, e-print arXiv:0705.0010
for physicists …
scale-free network : probability distribution
of degree follows the power law.
P( k )  k

in the log-log scale, of course …
p (k )
p (k )
p (k )
2 3
3 5
The hub (opinion)
dominates !!!
 5
k
“always magnetized”:
no phase-transition
k
k
similar to mean-field theory: mean-field theory: same
different technical details
as all-to-all interaction
The “voter model” resembles the Ising model,
but focuses on different aspects of the system
the Ising model
the voter model
the Ising-Glauber
dynamics
equilibrium state
pathway to equilibrium
thermodynamic variables
(consensus) state
Monte Carlo simulation
time to reach consensus
(Metropolis algorithm)
“Humans may dislike to be simulated like Ising spins,
and clearly the brain is more complicated than one
binary variables.” – D. Stauffer
The voter model is the simplest and most
completed solved examples of cooperative behavior
The Rule of the Model
Each site of a graph is endowed with two states –
spin up ↑(s = +1) and down ↓(s = -1) like the Ising model
For each evolution time step,
i) pick a random site
ii) the selected site adopts the state of a randomly-chosen
neighbor
These steps are repeated until a finite system necessarily
reaches consensus
The voter model dynamics - illustration
Random Field Ising Model on Scale-Free Networks
1 if i and j connected,
0 if not
external field given by
random variable
f (m)
f (m)
p (h)
p (h)
discontinuous
(1st order) transition
continuous transition
S. H. Lee, H. Jeong, and J. D. Noh, Phys. Rev. E 74, 031118 (2006).
Interpretation as opinion dynamics model?
In the original manuscript of our paper …
An anonymous referee said,
Investigating the Ising model
• Analytic approach
– 1D Ising model: no phase transition (transfer matrix)
– 2D Ising model: Onsager solution
– 3D Ising model: no exact solution (yet!), approximation
based on series expansion, etc.
– Mean-field theory: (relatively) easy calculation with the
self-consistency equation – exact for all-to-all coupling
& valid for D > 4 (upper-critical dimension)
• Numerical simulation
– Monte Carlo simulation
• Boltzmann factor and Metropolis algorithm
• Voter model dynamics ~ T=0 Ising model simulation
Boltzmann factor (before introducing the
basic algorithm for Monte Carlo simulation)
exp( 
Ei
~ probability that an equilibrium system has
the energy Ei in the canonical ensemble
with the temperature T
)
k BT
probabilit
y pi 
exp(  E i / k B T )
 exp(  E
j
exp(  E i / k B T )

/ k BT )
Z (partition
function)
j
Basic idea: let the system configuration “evolve” by
considering the Boltzmann factor and record the
average magnetization, variance, etc.
Energy
E {si }   J  si s j  H
 ij 
s
i
i
Basic Monte Carlo Simulation:
Metropolis algorithm
• Prepare the system & initialize
• System configuration evolution “loop” for each T …
– Randomly pick a site and calculate the energy change
if the spin at the site is flipped
– If the energy is lowered, the spin flip is accepted
– If the energy gets larger, the spin flip is accepted with
the probability exp(   E / k B T )
– Record the average, variance (2nd moment), 4th
moment, etc. (after the initial transient period; the
equilibration time)
• After the simulation, thermodynamic quantities
are calculated with the recorded data
Monte Carlo Simulation with what …?
• Nothing is impossible! Anything that can calculate
the exponential function (even this is not
necessary for T = 0) & generate random numbers
• Usually, programming languages such as C, C++,
python, Fortran, Java, etc.
Surprisingly, even with
Microsoft Excel !!!
2D Ising model Monte Carlo simulation:
C code by me
“spin flipping” part
Boltzmann factor
spin configuration initialization
record various quantities
call the spin flipping function
Result: time series of magnetization
T ~ TC
T < TC
spontaneous
magnetization
“critical slowing down”
T > TC
disorder phase
Result: thermodynamic quantities depending
on the temperature
Exact T C  1 / ln( 1 
2 )  2 . 269 ...
(from the Onsager solution)
Java Applets
• Prof. Jae Dong Noh’s website
• http://statphy1.uos.ac.kr/noh/java.html
Summary
• Ising model: “immortal” subject of
statistical mechanics – application to
opinion dynamics (with caution!)
• Monte Carlo simulation based on
Metropolis algorithm
• Now, you’ll take a look at how we can do
the simulation with Microsoft Excel~ :)
Any question or comment?
```