Diffusion forward.py

From Werner KRAUTH

(Difference between revisions)
Jump to: navigation, search
Revision as of 13:31, 6 June 2024
Werner (Talk | contribs)

← Previous diff
Revision as of 15:10, 6 June 2024
Werner (Talk | contribs)

Next diff →
Line 1: Line 1:
 +==Context==
 +This page is part of my [[BegRohu_Lectures_2024|2024 Beg Rohu Lectures]] on "The second Markov chain revolution" at the [https://www.ipht.fr/Meetings/BegRohu2024/index.html Summer School] "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).
 +
 +==Python program==
import random import random
import matplotlib.pyplot as plt import matplotlib.pyplot as plt

Revision as of 15:10, 6 June 2024

Context

This page is part of my 2024 Beg Rohu Lectures on "The second Markov chain revolution" at the Summer School "Concepts and Methods of Statistical Physics" (3 - 15 June 2024).

Python program

import random
import matplotlib.pyplot as plt

N = 5
pos = []
for stat in range(10000):
   posit = set(range(N))
   t = 0
   while True:
      t += 1
      posit = set([min(max(b + random.choice([-1, 0, 1]), 0), N - 1) for b in posit])
      if len(posit) == 1: break
   pos.append(posit.pop())
plt.title('Forward coupling: 1-d with walls: position of the coupled config.')
plt.hist(pos,bins=N,range=(-0.5, N - 0.5), density=True)
plt.savefig('ForwardCoupling.png')
plt.show()
Personal tools