SSEPCompact.py
From Werner KRAUTH
Revision as of 12:40, 10 June 2024 Werner (Talk | contribs) ← Previous diff |
Revision as of 13:06, 10 June 2024 Werner (Talk | contribs) Next diff → |
||
Line 26: | Line 26: | ||
if Conf[NewActive] == 0: Conf[Active], Conf[NewActive] = 0, 1 | if Conf[NewActive] == 0: Conf[Active], Conf[NewActive] = 0, 1 | ||
PP = '|' | PP = '|' | ||
- | ktot= 0 | ||
for k in range(NSites): | for k in range(NSites): | ||
- | if Conf[k] == 0: | + | if Conf[k] == 0: PP += ' ' |
- | PP += ' ' | + | else: PP += '|' |
- | else: | + | PP += '|' |
- | ktot += 1 | + | |
- | if ktot != NPart / 2: PP += 'X' | + | |
- | else: PP += '|' | + | |
if iter % NStrob == 0: print(PP) | if iter % NStrob == 0: print(PP) | ||
print('-' * (NSites + 2)) | print('-' * (NSites + 2)) | ||
Line 43: | Line 39: | ||
==Output== | ==Output== | ||
- | Here is output of the above Python program. The histogram is absolutely flat, without any corrections. But this is normal, given that the simulation has run, for each of the realizations of the random map, an infinite number of iterations. | + | Here is output of the above Python program with, for simplicity, N=32, L=64 and only 20 configurations over the length of the simulation. |
+ | |||
+ | The initial configuration is compact. Clearly, the simulation has not run long enough to forget its initial state, and it would be necessary to increase the simulation time from N^2 log N to N^3 log N. In our simplified setting, the logarithm is difficult to see, but better analysis tools readily extract it from the numerical data. | ||
+ | |||
+ | Periodic SSEP, N= 32, L= 64 | ||
+ | ------------------------------------------------------------------ | ||
+ | |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | | ||
+ | |XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X | | ||
+ | | XXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X| | ||
+ | | X XXXXXXXXXXXXXXXXXXXXXXXXXXX X X X X| | ||
+ | | X XXXXXXXXXXXXXXXXXXXXXX X XXX X X XX X| | ||
+ | |X XXXXXXXXXXXXXXXXXXXXX XXX X XX X X X X | | ||
+ | |X XXX XXXXXXXXXXXXXXXXXXXX XX X X X X X X | | ||
+ | | XXXX XXXXXXXXXXXXXXXXXXXX X X XX X X X X| | ||
+ | | XXXXXX XXXXXXXXXXXXXXXXXX X X X X X X X X | | ||
+ | | XXXXXXXX XXXXXXXXXXXXXXX X X X XX X XX X| | ||
+ | | XXXXXXX XXXXXXXXXXXXX XXXX X X XX XX X X | | ||
+ | | XXXX XXXXXXXXXXXXXX XXXXX X XXXX X X X X | | ||
+ | |X XX XXXXXXXXXXXX XXXXXXX X XX XX X X X XX | | ||
+ | |X XXXX XXXXXXXXXX XXXX XXXX XXX X X X X XX| | ||
+ | | XXX XXXXXXXXXXX XXXXXXXXX X X X X X X X X X| | ||
+ | |X XXX XXXXXXXXXXX XXXX XXXXX X X X XX X XX| | ||
+ | | XXXXX XXXXXXXXX X XXXXXXXXX X X XXX X XX| | ||
+ | |XXXX XXXXXXXXXXXX X XXXXX XX X XX X X XX X| | ||
+ | |XXXX XXXXXXXXX XXXXXXXX XX X XX X X XX X X| | ||
+ | |XXXXXX XXXXXX XXXXXXXXXXX X X X X XX X X X | | ||
+ | |X XXXXXX XX XXXXXXXXXXXXX XX X X X X X X X X| | ||
+ | ------------------------------------------------------------------ | ||
+ | Total time = 1.0 * N ^ 2.0 * log N | ||
+ | |||
- | [[Image:Backward position t0.png|left|600px|border|Coupling-from-the-past approach to sampling.]] | ||
- | <br clear="all" /> | ||
==Further Information== | ==Further Information== | ||
+ | |||
+ | * The mixing behavior of the SSEP t_mix \sim N^3 log N has been computed by Lacoin (2016, 2017) (see references). | ||
+ | * The relaxation time of the SSEP is t_rel \sim N^3. It is thus asymptotically smaller than the mixing time, leading to the cutoff phenomenon. | ||
==References== | ==References== |
Revision as of 13:06, 10 June 2024
Contents |
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 math import random exponent = 3.0 alpha = 0.5 prefactor = 1.0 NPart = 64; NSites = 2 * NPart NIter = int(prefactor * NPart ** exponent * math.log(NPart)) NStrob = NIter // 40 Conf = [1] * NPart + [0] * (NSites - NPart) Active = random.randint (0, NSites - 1) while Conf[Active] != 1: Active = random.randint(0, NSites - 1) Text = 'Periodic SSEP, N= ' + str(NPart) + ', L= ' + str(NSites) print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2)) print('-' * (NSites + 2)) for iter in range(NIter): Active = random.randint (0, NSites - 1) while Conf[Active] != 1: Active = random.randint(0, NSites - 1) Step = random.choice([-1,1]) NewActive = (Active + Step) % NSites if Conf[NewActive] == 0: Conf[Active], Conf[NewActive] = 0, 1 PP = '|' for k in range(NSites): if Conf[k] == 0: PP += ' ' else: PP += '|' PP += '|' if iter % NStrob == 0: print(PP) print('-' * (NSites + 2)) Text = 'Total time = ' + str(prefactor) + ' * N ^ ' + str(exponent) + ' * log N' print(' ' * (NSites// 2 + 1 - len(Text) // 2) + Text + ' ' * (NSites// 2 + 1 - len(Text) // 2))
This example program performs a large number of iterations of the Monte Carlo algorithm for the Symmetric Simple Exclusion Process, and plots 40 lines of output over the entire simulation time.
Output
Here is output of the above Python program with, for simplicity, N=32, L=64 and only 20 configurations over the length of the simulation.
The initial configuration is compact. Clearly, the simulation has not run long enough to forget its initial state, and it would be necessary to increase the simulation time from N^2 log N to N^3 log N. In our simplified setting, the logarithm is difficult to see, but better analysis tools readily extract it from the numerical data.
Periodic SSEP, N= 32, L= 64 ------------------------------------------------------------------ |XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX | |XXXXXXXXXXXXXXXXXXXXXXXXXXXXX XX X | | XXXXXXXXXXXXXXXXXXXXXXXXXXXXX X X X| | X XXXXXXXXXXXXXXXXXXXXXXXXXXX X X X X| | X XXXXXXXXXXXXXXXXXXXXXX X XXX X X XX X| |X XXXXXXXXXXXXXXXXXXXXX XXX X XX X X X X | |X XXX XXXXXXXXXXXXXXXXXXXX XX X X X X X X | | XXXX XXXXXXXXXXXXXXXXXXXX X X XX X X X X| | XXXXXX XXXXXXXXXXXXXXXXXX X X X X X X X X | | XXXXXXXX XXXXXXXXXXXXXXX X X X XX X XX X| | XXXXXXX XXXXXXXXXXXXX XXXX X X XX XX X X | | XXXX XXXXXXXXXXXXXX XXXXX X XXXX X X X X | |X XX XXXXXXXXXXXX XXXXXXX X XX XX X X X XX | |X XXXX XXXXXXXXXX XXXX XXXX XXX X X X X XX| | XXX XXXXXXXXXXX XXXXXXXXX X X X X X X X X X| |X XXX XXXXXXXXXXX XXXX XXXXX X X X XX X XX| | XXXXX XXXXXXXXX X XXXXXXXXX X X XXX X XX| |XXXX XXXXXXXXXXXX X XXXXX XX X XX X X XX X| |XXXX XXXXXXXXX XXXXXXXX XX X XX X X XX X X| |XXXXXX XXXXXX XXXXXXXXXXX X X X X XX X X X | |X XXXXXX XX XXXXXXXXXXXXX XX X X X X X X X X| ------------------------------------------------------------------ Total time = 1.0 * N ^ 2.0 * log N
Further Information
- The mixing behavior of the SSEP t_mix \sim N^3 log N has been computed by Lacoin (2016, 2017) (see references).
- The relaxation time of the SSEP is t_rel \sim N^3. It is thus asymptotically smaller than the mixing time, leading to the cutoff phenomenon.