Mean field self consistency single site.py
From Werner KRAUTH
(Difference between revisions)
Revision as of 10:59, 8 November 2016 Werner (Talk | contribs) ← Previous diff |
Current revision Werner (Talk | contribs) (→Description) |
||
Line 1: | Line 1: | ||
+ | This page presents the Python2 program Mean_field_self_consistency_single_site.py, that obtains the most basic self-consistency solution for the Ising model. | ||
+ | |||
+ | __FORCETOC__ | ||
+ | =Reference= | ||
+ | |||
+ | This program is discussed in [[ICFP_Stat_Physics_2019|Lecture 08]] of my 2019 ICFP lecture on Statistical physics: "Mean-field theory: The three pillars". | ||
+ | |||
+ | =Description= | ||
+ | |||
+ | The program performs a most basic iteration (searching self-consistency) of the m = tanh(q beta m) loop. If you run this program, you will notice the appearance of a self-consistent solution with m different from zero at temperatures below T=4. | ||
+ | |||
+ | =Program= | ||
+ | |||
+ | |||
import random, math, pylab | import random, math, pylab | ||
Line 21: | Line 35: | ||
pylab.savefig('mean_field_self_consistency_Ising.png') | pylab.savefig('mean_field_self_consistency_Ising.png') | ||
pylab.show() | pylab.show() | ||
+ | |||
+ | =Version= | ||
+ | See history for version information. | ||
+ | |||
+ | [[Category:Python]] [[Category:ICFP]] |
Current revision
This page presents the Python2 program Mean_field_self_consistency_single_site.py, that obtains the most basic self-consistency solution for the Ising model.
Contents |
[edit]
Reference
This program is discussed in Lecture 08 of my 2019 ICFP lecture on Statistical physics: "Mean-field theory: The three pillars".
[edit]
Description
The program performs a most basic iteration (searching self-consistency) of the m = tanh(q beta m) loop. If you run this program, you will notice the appearance of a self-consistent solution with m different from zero at temperatures below T=4.
[edit]
Program
import random, math, pylab dim = 2 q = 2.0 * dim Tc = 2.0 * dim m_vec = [1.0] T_vec = [0] for iter in range(-1000, 1000): t = iter / float(1100.0) beta = (t * Tc + Tc) ** (-1) T_vec.append(1.0 / beta) m = 0.1 for iter2 in range(1000): m = math.tanh(beta * q * m) m_vec.append(m) pylab.plot(T_vec, m_vec) pylab.title('Weiss self-consistency for the Ising model in $d$ = ' + str(dim) + ' dimensions') pylab.xlabel('$T$ (Temperature)', fontsize=18) pylab.ylabel('$m$ (magnetization per site)', fontsize=18) pylab.savefig('mean_field_self_consistency_Ising.png') pylab.show()
[edit]
Version
See history for version information.
Categories: Python | ICFP