Abstract
We present an algorithm to compute the exact probability Rn(p) for a site percolation cluster to span an n × n square lattice at occupancy p. The algorithm has time and space complexity O(λn) with λ ≈ 2.6. It allows us to compute Rn(p) up to n = 24. We use the data to compute estimates for the percolation threshold pc that are several orders of magnitude more precise than estimates based on Monte-Carlo simulations.

Original content from this work may be used under the terms of the Creative Commons Attribution 4.0 licence. Any further distribution of this work must maintain attribution to the author(s) and the title of the work, journal citation and DOI.
1. Introduction
Most of the work in percolation is intimately connected with computer simulations. Over the years, various algorithms have been developed [1]. Think of the Hoshen–Kopelman algorithm to identify clusters [2], the cluster growth algorithms [3, 4] or the cluster hull generating algorithm [5–7] to name but a few. Another example is the invasion percolation algorithm, that works well independently of the spatial dimension [8] and even on hyperbolic lattices with their 'infinite' dimension [9].
The microcanonical union-find algorithm by Newman and Ziff [10, 11] was a major improvement for Monte-Carolo simulations. It is not only exceedingly efficient, but also simple and beautiful.
In this contribution we will introduce an algorithm for the exact enumeration of percolating configurations in 2d lattices. We will discuss this algorithm for site percolation on the square lattice, but the method can easily be adapted to other 2d lattices.
Our motivation to devise such an algorithm and to run it is twofold. First, because we think that it is always good to have exact solutions, even for small systems. And second, because one can use the enumeration results to compute estimates for the percolation threshold pc that are more accurate than anything achievable with Monte Carlo simulations.
The latter is a recent trend in percolation. Exact estimators for small systems combined with careful extrapolations have lead to estimates for pc with unprecedented accuracy for many different lattices, see [12] and references therein.
The situation for site percolation is depicted in table 1. TM refers to transfer matrix methods as a label for enumerative, exact solutions of small systems combined with careful extrapolations. MC stands for Monte-Carlo results. As you can see, in 2008 TM took over MC. We will also use TM and add two more values to this table.
Table 1. Some published estimates of the percolation threshold for site percolation on the square lattice. TM refers to transfer matrix algorithms, MC to Monte-Carlo methods. See [18, 21] for more extensive lists. Or consult the always up to date WikipediA entry on percolation thresholds, maintained by Bob Ziff.
0.569(13) | MC 78 × 78 | 1963 [13] |
0.590(10) | Series | 1964 [14] |
0.591(1) | MC 250 × 250 | 1967 [15] |
0.593(1) | MC 256 × 256 | 1975 [16] |
0.59274(10) | TM 10 × ∞ | 1985 [17] |
0.592745(2) | MC 2048 × 2048 | 1986 [18] |
0.59274621(13) | MC 128 × 128 | 2000 [10] |
0.59274621(33) | MC 1594 × 1594 | 2003 [19] |
0.59274603(9) | MC 2048 × 2048 | 2007 [20] |
0.59274598(4) | MC 2048 × 2048 | 2008 [21] |
0.59274605(3) | TM 16 × ∞ | 2008 [22] |
0.59274605095(15) | TM 22 × 22 | 2013 [23] |
0.59274605079210(2) | TM 22 × ∞ | 2015 [24] |
The paper is organized in three sections plus conclusions and appendix. The first section defines the task and introduces the generating function. The second section comprises a detailed description of the algorithm, followed by a brief discussion of the results. In the third section we describe the computation of high precision values for the percolation threshold pc. Sections two and three can be read independently. The appendix explains some of the combinatorics behind the algorithm.
2. The number of percolating configurations
Our focus is on site percolation on the n × m square lattice with open boundary conditions, where percolation refers to spanning the m direction. In particular we want to compute the number An,m (k) of spanning configurations with k sites occupied. These numbers are conveniently organised in terms of the generating function
The spanning probability at occupancy p is given by
The numbers An,m (k) can be computed by enumerating all 2nm configurations. Enumerating only the hulls of the spanning clusters [6] reduces this complexity to O(1, 7nm ), but even with this speedup, the maximum feasible system size is 8 × 8 [25].
Obviously An,m (k) = 0 for k < m. For k = m, the only spanning cluster is a straight line of length m,
For k = m + 1 the spanning cluster is either a straight line with one extra site which does not contribute to spanning, or it is a line with a kink:
For k = m + 2 a spanning configuration is either a straight line with two free sites, a line with one kink and one free site or a line with two small or one large kink:
The formulae for k = m + 3, m + 4, ... can be derived using similar considerations, but they quickly get complicated and are not very illuminating. And of course we are here to have the computer do this work.
In the high density regime we focus on the number of empty sites. Obviously we need at least n empty sites to prevent spanning,
n empty sites can block spanning only if they form a path that a king can take from the left column of an n × m chess board to the right column in n − 1 moves. Let denote the number of such paths. Then
This number of royal paths would be m3n−1 if the king were allowed to step on rows above and below the board. If he cannot leave the board, the number of paths is given by a more intricate formula [26]. On a quadratic board, however, the number of paths can be expressed by the Motzkin numbers Mk (A.3):
Equations (3) and (4) can be used as sanity check for the algorithm. Another sanity check is provided by a surprising parity property [27],
with
3. Algorithm
If you want to devise an efficient algorithm for a computational problem, you would be well advised to consult one of the approved design principles of the algorithms craft [28]. In our case the algorithmic paradigm of choice is dynamic programming. The idea of dynamic programming is to identify a collection of subproblems and tackling them one by one, smallest first, using the solutions of the small problems to help figure out larger ones until the original problem is solved.
3.1. Dynamic programming and transfer matrix
In the present case, a natural set of subproblems is the computation of Fn,m (z) for a given occupation pattern in the mth row. For n = 2, for example, either the left site, the right site or both sites are occupied:

An all empty row cannot occur in spanning configurations. The mth row can only represent a spanning configuration if the (m − 1)th row is either
or
, hence

Complementing the equations for and
, we can write this as matrix-vector product

For general values of n we can write
where σ and σ' denote possible configurations that can occur in a row of width n. Each σ in row m represents all compatible configurations in the n × m lattice 'above' it. Appropriately we refer to σ as signature of all these configurations.
The idea of the algorithm to compute for all signatures σ and then use (8) to iteratively compute , , etc, thereby reducing the two-dimensional problem with complexity O(2nm ) to a sequence of m one-dimensional problems of complexity O(λn ) each.
This particular form of a dynamic programming algorithm is known as transfer matrix method. When transfer matrices were introduced into statistical physics by Kramers and Wannier in 1941 [29], they were meant as a tool for analytical rather than numerical computations. Their most famous application was Onsager's solution of the two dimensional Ising model in 1944 [30]. With the advent of computers, transfer matrices were quickly adopted for numerical computations, and already in 1980, they were considered 'an old tool in statistical mechanics' [31]. Over the decades, the method has been applied to a wide range of models, see [32, 33] and references therein for a review. Most of these applications focused on the enumeration of finite objects that exists in an infinite lattice, like polygons of a given circumference or self avoiding walks of a given length. The idea to use transfer matrices to compute spanning probabilities in finite lattices emerged only recently, and not in statistical physics but in theoretical computer science. For their analysis of a two-player board game, Yang et al [23] developed a dynamic programming algorithm to compute numerically exact values of the spanning probability for a given value of the occupation probability p. We build on their ideas for the algorithm presented here.
3.2. Signatures
Signatures are the essential ingredients of the algorithm. How do we code them? And what is their number? Both questions can be answered by relating signatures to balanced strings of parentheses.
Occupied sites in a signature can belong to the same cluster. Either because they are neighbours within the signature or because they are connected through a path in the lattice beyond the signature. In any case the set of signature sites that belong to the same cluster has a unique left to right order. This allows us to encode cluster sites using left and right parentheses (figure 1). We represent the leftmost site of a cluster by two left parentheses , the rightmost site by two right parentheses and any intermediate cluster site by . An occupied site that is not connected to any other site within the signature is represented by ().
Figure 1. Coding table of cluster sites in a signature as parenthesis expressions (top) and example (bottom).
Download figure:
Standard image High-resolution imageThe resulting string is a balanced parentheses expression (with some white spaces from unoccupied sites), i.e., the total number of left parentheses equals the total number right parentheses, and counting from left to right, the number of right parentheses never exceeds the number of left parentheses. The latter is due to the topological constraints in two dimensions (two clusters cannot cross). Identifying all sites of a cluster in a signature means matching parentheses in a balanced string of parentheses, a task that can obviously be accomplished in time O(n).
Since we take into account only configurations that contain at least one spanning cluster, we need to identify clusters that are connected to the top row. We could follow [23] and use brackets [[, ]], ][ and [] to represent those clusters in a signature, thereby maintaining the concept of balanced strings of parentheses. It is more efficient, however, to use only a single symbol like || for sites that are connected to the top. We can think of all || sites being connected to each other by an all occupied zeroth row. Identifying the left- and rightmost || site in a signature can again be done in time O(n).
The total number of signatures for spanning configurations depend on the width n and the depth m. Some signatures can occur only in lattices of a minimum depth. The most extreme case in this respect are nested arcs, represented by signatures like

which can only occur if m ⩾ ⌈n/2⌉. If m is larger than this, however, the total number of signatures will only depend on n. In the appendix
where Mn+1,2 is the second column in the Motzkin triangle (A.8). The first terms of the series S1, S2, ... are
We also show in the appendix
3.3. From one dimension to zero dimensions
The central idea of the transfer matrix method (8) is to transform a two dimensional problem into a sequence of one dimensional problems, as a result of which the complexity reduces from O(2nm ) to O(m2n Sn ). This idea can be applied again. By building the new row site by site (figure 2), we can subdivide the one dimensional problem into a sequence of n zero dimensional problems. This reduces the complexity from O(m2n Sn ) to O(nmSn ).
Figure 2. Increasing the system size by adding a new site in the (c + 1)th column of the partially filled row. The state of the new site may affect the cluster structure of the whole lattice, but we only need to update the signature, the cluster structure as it shows in the n sites coloured grey.
Download figure:
Standard image High-resolution imageIn this approach, the new row is partially filled up to column c. The corresponding signatures contain a kink at column c. Each signature is mapped to two signatures, depending on whether the added site at columns c + 1 is empty or occupied (figure 2).
The number of signatures Sn,c depends on n and c. We can think of a partially filled row as a full row of width n + 1, where an extra site has been inserted between positions c and c + 1, this extra site being empty in all signatures. This gets us
where the first inequality reflects the fact that the site at position c has only two neighbours (left and up), and therefore less restrictions to take on 'legal' values. The actual value of Sn,c depends on c, see table 2.
Table 2. Values of Sn,c .
c | ||||||||
---|---|---|---|---|---|---|---|---|
n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
1 | 1 | |||||||
2 | 4 | 3 | ||||||
3 | 12 | 11 | 9 | |||||
4 | 33 | 31 | 31 | 25 | ||||
5 | 91 | 85 | 87 | 85 | 69 | |||
6 | 249 | 233 | 237 | 237 | 233 | 189 | ||
7 | 683 | 638 | 651 | 646 | 651 | 638 | 518 | |
8 | 1877 | 1751 | 1788 | 1777 | 1778 | 1787 | 1752 | 1422 |
3.4. Condensation
The number of signatures is paramount for the complexity of the algorithm. Let . Figure 3 shows that . In particular, exceeds the 'giga' threshold (109) for n > 20. This is significant because we need to store pairs (σ, Fσ ) for all signatures. For above 109, this means hundreds of GBytes of RAM. In this regime, space (memory) rather than time will become the bottleneck of our algorithm.
Figure 3. Number of signatures (plain) and (condensed). The lines are and .
Download figure:
Standard image High-resolution imageIt turns out, however, that we can reduce the number of signatures. Consider a signature in row m that contains the pattern . All signatures in row m + 1 that are derived from it, do not depend on whether the single () is actually occupied. Hence we can identify all signatures
with signatures
and store only one pair (σ', Fσ
+ Fσ
') instead of two pairs (σ, Fσ
) and (σ', Fσ
'). For the same reason, we can also identify
with
and
with
and store only one of each pair.
In addition, the symmetry of the problem allows us to identify each signature of a full row (c = n) with its mirror image.
Let denote the number of signatures that haven been condensed by these rules, and let . Figure 3 shows that . The number of condensed signatures exceeds the 'giga' threshold only for n > 23.
3.5. Implementation
The elementary step of the transfer matrix algorithm is the addition of a new lattice site in a partially filled row (figure 4). This is implemented in a subroutine extend(σ, c) that takes a signature σ and a column c as input and returns a pair σ0, σ1, where σ0 (σ1) follows from σ by adding an empty (occupied) site in column c. The rules for these computations are depicted in table 3. The signatures σ0 and σ1 are of course condensed before they are returned. The subroutine extend is then called from within a loop over rows and columns of the lattice (figure 5).
Figure 4. Signature of the cluster configuration of figure 2 (top), and signatures after adding a new site that is either empty (middle) or occupied (bottom).
Download figure:
Standard image High-resolution imageTable 3. Extension rules of the transfer matrix algorithm. Each cell shows the resulting configuration if the added site is empty (top) or occupied (bottom). Some update rules are non-local: a
|| may only be deleted, if there is at least one other || elsewhere in the signature, b
deleting or means shortening of the corresponding cluster, c
the whole cluster has to be connected to the top, and d
two clusters merge. Configurations with must never occur.
![]() |
Figure 5. Transfer matrix loop.
Download figure:
Standard image High-resolution imageThe algorithm maintains two lists Lold and Lnew of configurations, where a configuration consists of a signature σ and the corresponding generating function Fσ . Lold is initialised with the 2n − 1 first row configurations, in which each occupied site is connected to the top row by definition. Lnew is initially empty.
A configuration (σ, Fσ ) is removed from Lold and σ0, σ1 = extend(σ, c) is computed. Then the configurations (σ0, Fσ ) and (σ1, zFσ ) are inserted into Lnew. This is repeated until Lold is empty. At this point, Lold and Lnew swap their names, and the process can be iterated to add the next site to the lattice.
If the lattice has reached its final size nm, the total generating function is the sum over all Fσ for (σ, Fσ ) ∈ Lold.
With its six symbols , ||, , , and (), a signature can be interpreted as a senary number with n digits. For n ⩽ 24, this number always fits into a 64-bit integer. Since
we can also represent signatures of size n = 25 by 64-bit integers, provided we choose the senary representation wisely: and .
The lists L maintained by the algorithm contain up to configurations. An efficient data structure is mandatory. We take advantage of the fact that the signatures can be ordered according to their senary value. This allows us to use an ordered associative container like set or map from the standard C++ library. Those guarantee logarithmic complexity for search, insert and delete operations [34]
Equipped with a compact representation for the signatures and an efficient data structure for the list of configurations, we still face the challenge to store the large coefficients An,m (k) of the generating functions . These numbers quickly get too large to fit within the standard fixed width integers with 32, 64 or 128 bits (figure 6).
Figure 6. Maximum coefficient Amax (n) = maxk An,n (k).
Download figure:
Standard image High-resolution imageOne could use multiple precision libraries to deal with this problem, but it is much more efficient to stick with fixed width integers and use modular arithmetic: with b-bit integers, we compute for a set of prime moduli pi < 2b such that ∏i pi > maxk An,m (k). We can then use the Chinese remainder theorem [34, 35] to recover An,m (k) from the . This way we can trade space (bit size of numbers) for time (one run for each prime modulus).
3.6. Performance
Figure 7 shows the actual memory consumption to compute Fn,n with b-bit integers. Note that data structures like red-black-tress require extra data per stored element. Unfortunately the product of all primes below 28 is not large enough to compute the coefficients in Fn,n via modular arithmetic and the Chinese remainder theorem if n ⩾ 19. Hence eight-bit integers are essentially useless.
Figure 7. Memory required to compute Fn,n with b-bit integers.
Download figure:
Standard image High-resolution imageExtrapolation of the data in figure 7 shows that the computation of Fn,n for n ⩽ 21 can be done with 16-bit integers on machines with 256 GB of RAM. Larger lattices require 384 GB (n = 22) or 1 TB (n = 23).
There is an alternative approach to determine Fn,m with less memory. Instead of enumerating the coefficients An,m (k), one can compute Fn,m (z) for nm integer arguments z (again modulo a sufficient number of primes) and then use Lagrange interpolation to recover Fn,m . This approach requires only a single b-bit integer to be stored with each signature. The prize we pay is that now we need nm computations, each consisting of several runs for a sufficient number of prime moduli. This was the approach we used to compute F22,22 on 30...60 machines with 256 GB each.
Yet another method suggests itself if one is mainly interested in evaluating the spanning probability Rn,m (p) for a given value of p. Here we need to store only a single real number with each signature, and there is no need for multiple runs with different prime moduli. Quadruple precision floating point variables with 128 bit (__float128 in gcc) allow us to evaluate Rn,m (p) with more than 30 decimals precision. We used this approach to compute Rn,n (p) for n = 23, 24, see table 4.
Table 4. Finite size estimators for pc (14). All decimals are exact.
n | pmed(n) | pcell(n) |
---|---|---|
1 | 0.500 000 000 000 000 000 000 000 000 000 | |
2 | 0.541 196 100 146 196 984 399 723 205 366 | 0.618 033 988 749 894 848 204 586 834 365 |
3 | 0.559 296 316 001 323 534 755 763 920 789 | 0.620 734 471 730 213 489 279 430 523 252 |
4 | 0.569 724 133 968 027 153 228 040 518 353 | 0.619 583 777 217 655 117 827 765 082 346 |
5 | 0.575 810 073 211 627 653 605 032 974 314 | 0.613 506 053 696 798 307 677 288 581 191 |
6 | 0.579 702 757 132 443 521 419 439 978 330 | 0.609 208 761 667 991 711 639 989 601 974 |
7 | 0.582 351 295 080 082 980 073 474 691 830 | 0.606 075 989 265 451 882 260 569 905 672 |
8 | 0.584 241 466 489 847 673 860 351 132 398 | 0.603 762 879 768 292 280 370 335 551 749 |
9 | 0.585 641 556 861 396 511 416 995 666 354 | 0.602 011 983 338 557 157 018 606 681 442 |
10 | 0.586 710 034 053 406 359 804 690 473 124 | 0.600 656 365 889 941 520 514 281 630 459 |
11 | 0.587 545 601 376 707 076 865 096 376 747 | 0.599 585 402 842 798 543 263 268 780 420 |
12 | 0.588 212 470 606 443 263 171 973 079 741 | 0.598 724 257 102 302 868 949 743 766 602 |
13 | 0.588 753 953 651 382 767 097 855 532 073 | 0.598 021 063 882 979 665 779 438 359 439 |
14 | 0.589 200 171 193 723 644 344 640 059 478 | 0.597 439 041 437 080 848 283 968 950 089 |
15 | 0.589 572 624 709 616 129 448 171 107 692 | 0.596 951 544 750 954 799 494 938 258 995 |
16 | 0.589 887 013 723 258 987 069 435 195 722 | 0.596 538 896 774 607 564 321 149 432 769 |
17 | 0.590 155 029 961 590 857 817 809 334 101 | 0.596 186 311 743 107 211 382 955 497 774 |
18 | 0.590 385 533 260 670 477 887 261 817 585 | 0.595 882 504 071 658 438 851 295 137 696 |
19 | 0.590 585 341 987 611 428 265 706 601 016 | 0.595 618 737 176 226 408 186 670 067 141 |
20 | 0.590 759 776 378 574 624 089 782 736 423 | 0.595 388 160 640 890 684 818 467 256 078 |
21 | 0.590 913 039 569 092 174 937 740 096 798 | 0.595 185 340 192 645 002 572 869 419 257 |
22 | 0.591 048 489 639 675 518 303 675 880 577 | 0.595 005 919 018 756 026 574 538 302 404 |
23 | 0.591 168 837 021 863 732 985 091 670 808 | 0.594 846 370 109 520 325 790 777 710 845 |
24 | 0.591 276 289 864 951 685 617 852 112 360 | 0.594 703 812 696 743 490 456 949 711 289 |
Figure 8 shows the time to evaluate Rn,n (p) for given value p and with 30 decimals accuracy, measured on a laptop. The time complexity corresponds to the expected complexity . The n2 iterations to build the lattice, combined with the O(n) complexity of the subroutine extend and the complexity of the associative container set yield a scaling factor n4. The number of signatures then provide the exponential part of the time complexity.
Figure 8. Time to evaluate Rn,n (p) with 30 decimals accuracy on a laptop.
Download figure:
Standard image High-resolution imageDespite the exponential complexity, the algorithm is surprisingly fast for small values of n, even on a laptop. Systems up to 12 × 12 can be computed in less than one second, 16 × 16 takes 90 seconds. The largest system that fits in the 16 GByte memory of the author's laptop is 21 × 21. A single evaluation of R21,21(p) on the laptop takes about 9 hours.
3.7. Results
We have computed the generating functions Fn,m (z) for n ⩽ 22 and all m ⩽ n. Here we will briefly discuss some properties of the coefficients An,m (k). For simplicity we will confine ourselves to the quadratic case m = n.
Ann (k) has a maximum Amax for k = kmax (n). Our data reveals that
It is tempting to conjecture that .
Amax itself scales like (figure 6). This number determines how many prime moduli of fixed width we need to compute An,n (k) via the Chinese remainder theorem.
The width of the maximum at kmax scales like n−1, as can be seen in the 'data collapse' when plotting versus n(k − kmax) (figure 9).
Figure 9. 'Data collapse' in the number of spanning configurations.
Download figure:
Standard image High-resolution image4. Critical density
The generating functions Fn,m (z) can be analysed in various ways. One can, for example, investigate their properties for arguments outside the 'physical' interval z ⩾ 0. This is how the parity property (6) was discovered and then proven for a large, quite general class of lattices [27].
In this paper we use the generating function to compute finite size estimators for the critical density pc that we can then extrapolate to the infinite lattice.
4.1. Estimators
The properties of various finite-size threshold estimators for two-dimensional percolation have been discussed by Ziff and Newman [36]. Here we will focus on estimators pmed(n) and pcell(n), defined as
and
The values for these estimators up to nmax = 24 are shown in table 4.
Both estimators are supposed to converge with the same leading exponent,
where is the critical exponent of the correlation length in two-dimensional percolation [37]. This scaling can clearly be seen in the data (figure 10).
Figure 10. Finite size estimators for pc and their convergence.
Download figure:
Standard image High-resolution imageAny convex combination of finite size estimators is another finite size estimator. We can choose λ in λpmed(n) + (1 − λ)pcell(n) such that the leading order terms of pmed(n) and pcell(n) cancel:
The precise values of cmed and ccell are not known, but their ratio follows from scaling arguments [36]:
Hence we expect that the estimator
converges faster than both pmed(n) and pcell(n). This is in fact the case, as can be seen in figure 10.
Figure 10 also depicts the estimator ppol(n), which is the root of a graph polynomial defined for percolation on the n × n torus [38–40]. Empirically, it converges like ∼n−4 in leading order. Jacobsen [24] computed this estimator for n ⩽ 21 and extrapolated the results to obtain
This is the most precise value up to today. We have used it as reference pc in figure 10 and we will also use it as reference in figures 12 and 13.
4.2. Exponents
Extrapolation methods are commonly based on the assumption of a power law scaling
with exponents 0 > Δ1 > Δ2 > .... These exponents can be determined by the following procedure.
We start by considering the truncated form . From each triple of consecutive data points p(n), p(n − 1) and p(n − 2) we can compute three unknowns pc, A1 and Δ1. This gets us sequences A1(n) and Δ1(n) that we can use to compute Δ1 = limn→∞Δ1(n) and A1 ≡ limn→∞ A1(n). Figure 11 shows Δ1(n) for p(n) = pmed(n) plotted versus n−1 along with a 4th-order polynomial fit. The result is of course expected. It is stable under variations of the order of the fit and the number of low order data points excluded from the fit.
Figure 11. Exponent sequences Δk (n) of pmed(n) and 4th-order polynomial fits.
Download figure:
Standard image High-resolution imageWe then subtract the sequence from p(n) to eliminate the leading scaling term . Considering again a truncated form , we can get sequences A2(n) and Δ2(n) from three consecutive terms of this sequence. And again we extrapolate these sequences by fitting a low order polynomial in n−1, thereby obtaining Δ2 and A2.
Obviously, this can be iterated to determine the exponents Δk one by one, although the stability of the procedure deteriorates to some extent with each iteration. Figure 11 shows the extrapolations for Δ2, Δ3 and Δ4 for pmed with results
The results for pcell are similar. These results provide compelling evidence that
These are the exponents that we will use in our extrapolations.
Applying the same procedure, Jacobsen [24] concluded that the scaling exponents for ppol are
For p⋆(n), we could not reliably compute exponents Δk . It can already be sensed from the curvature in the logarithmic plot (figure 10), that p⋆(n) is not determined by a set of well separated exponents. This is the reason why we will not use p⋆(n) for extrapolation in this contribution, despite its fast convergence.
4.3. Extrapolation
A study of extrapolation methods in statistical physics [41] demonstrated that Bulirsch–Stoer (BST) extrapolation [42] is a reliable, fast converging method. It is based on rational interpolation. For a given sequence of exponents 0 < w1 < w2 < ... and n data points p(1), ..., p(n), one can compute coefficients a0, ..., aN and b1, ..., bM with N + M + 1 = n such that the function
interpolates the data: p(k) = QN,M (1/k) for k = 1, ..., n. The value of a0 yields the desired extrapolation p(k → ∞).
The best results are usually obtained with 'balanced' rationals N = ⌈(n − 1)/2⌉ and M = ⌊(n − 1)/2⌋. This is what we will use for our extrapolations.
The BST method discussed in [41] uses exponents wk = kω, where the parameter ω is chosen to match the leading order of the finite size corrections. Here we choose .
Having fixed the exponents and the degrees of nominator and denominator, we still have a free parameter: the number of data points to be included in the extrapolation. Since we are interested in the asymptotics n → ∞ we will of course use the data of the large systems, but we may vary the size n0 of the smallest system to be included. We expect that the extrapolation gets more accurate with increasing n0, but only up to a certain point after which the quality deteriorates because we have to few data points left. This intuition is confirmed by the data (figure 12).
Figure 12. Rational extrapolation result vs minimum system size n0.
Download figure:
Standard image High-resolution imageThe accuracy of an extrapolation based on system sizes n0, ..., nmax is gauged by the difference between extrapolations of data points for n0 + 1, ..., nmax and n0, ..., nmax − 1. These are the errorbars shown in figure 12.
It seems reasonable to focus on the regime of n0 where the results form a plateau with small errorbars, and to take the mean of these values as the final estimate of pc. Using the values for n0 = 14, 15 (pmed) and n0 = 15, 16 (pcell) (see table 5) we get
The first value deviates from the reference value (19) by 2 errorbars, the second by 2.5 errorbars.
Table 5. Extrapolations for different minimum system sizes n0. Starred values are averaged to yield the final estimates (25) for pc.
n0 | pmed | pcell |
---|---|---|
13 | 0.59274605098(12) | 0.592746041(15) |
14 | 0.5927460507885(22)⋆ | 0.5927460541(16) |
15 | 0.592746050783(6)⋆ | 0.592746050611(7)⋆ |
16 | 0.59274605077(12) | 0.59274605059(16)⋆ |
17 | 0.59274605023(34) | 0.5927460501(5) |
The reference value pc 19 was obtained with different extrapolation approach. To see how consistent our method is, we applied it also to the estimator ppol(n) from Jacobsen [24, table 2]. Here we used the exponents (23) in the BST extrapolation.
Figure 13 shows, that the errorbars are smaller than the errorbars on pmed and pcell (note the scaling of the y-axis). The estimator ppol is also more robust under variation of n0. Taking the average of the estimates for n0 = 1, ..., 10 gives
This value agrees with Jacobsen's value (19) within the errorbars.
Figure 13. Rational extrapolation ppol vs minimum system size n0.
Download figure:
Standard image High-resolution imageWe believe that the superiority of the estimator ppol is due to the better separation of scales: Δk+1 − Δk = −1 for pmed, pcell versus Δk+1 − Δk = −2 for ppol.
5. Conclusions
We have introduced a transfer matrix algorithm to compute the generating function Fnm (z) for the number of spanning configurations in an n × m square lattice.
The exponential number of signatures imposes a hard limit on system sizes. With the current algorithm, computing F25,25(z) would require a computer with a 4 TB memory and a couple of months CPU time. Evaluating R25,25(p) for a single real argument p requires 512 GB of memory und would take about one month.
We have also seen another example where the exact solution of small systems is sufficient to compute estimates for the critical density pc with an accuracy that no Monte-Carlo method could ever achieve. Or, as Bob Ziff put it, 'Monte-Carlo is dead' [43] when it comes to computing pc for 2d systems.
This approach can be advanced. Not so much by solving larger systems, but by a better understanding of finite size estimators and their scaling. An interesting approach in this context is to focus on critical configurations, i.e. configurations in which spanning depends on a single site [44].
Adapting this algorithm to other 2d lattices and other boundary conditions (cylindrical, helical) is straightforward. It can also be adapted to enumerate spanning configurations in k2-mer percolation [45].
Acknowledgments
This paper benefitted a lot from discussions with Bob Ziff. Like almost all of my previous papers on percolation! Whenever I had a question or a crazy idea on percolation, I could ask Bob. And I always got a quick and satisfying answer. It is a great pleasure to thank Bob for his support and his friendship.
Data availability statement
The data that support the findings of this study are available upon reasonable request from the authors.
Appendix A.: The number of signatures
To compute the number Sn of signatures in fully completed rows, we use the connection of signatures and balanced strings of parentheses.
The number of balanced strings of parentheses length 2a is given by the Catalan number Ca [46, theorem 7.3],
A completely balanced string of parentheses contains the same number a of opening and closing parentheses. We will see that it is useful to consider also strings of parentheses that consist of a opening parentheses and b ⩽ a closing parentheses such that reading from left to right, every closing parenthesis matches an opening parenthesis. The number of these partially balanced strings of parentheses reads [47]
The numbers Ca,b are known as Catalan's triangle, and the Catalan numbers are the diagonal Ca = Ca,a of this triangle.
A.1. From Catalan to Motzkin numbers
In a signature, the parentheses are not independent. Occupied sites that are adjacent in a row belong to the same cluster. We deal with this local connectivity by considering runs of adjacent occupied sites as single entities that we may call h(orizontal)-clusters. A row of width n contains at most ⌈n/2⌉ h-clusters. Different h-clusters may be connected through previous rows, and again we have a unique left-right order and the topological constraints that allow us to identify h-clusters with strings of balanced parentheses expression, using the set of symbols ((, )), )(and (). Any legal signature with r h-clusters corresponds to a balanced string of 2r parentheses and vice versa.
We write the occupation pattern of a row as n-bit word s ∈ {0,1}n , where 0 represents an empty site and 1 represents an occupied site. Let r(s) denote the number of h-clusters, i.e. runs of consecutive 1s, in s. Then the number of signatures is
This sum can be simplified by computing the number of n-bit words with exactly r h-clusters. For that we add a leading zero to the word. This ensures that every h-cluster has a zero to its left. The position of this zero and the position of the rightmost site of the h-cluster specify the h-cluster uniquely. Hence the number of n-bit words with r h-clusters is given by , providing us with
A.2. The spanning constraint
Up to this point we have ignored that our signatures have an additional symbol || for occupied sites connected to the top row. In a signature with r h-clusters, any number w ⩽ r of h-clusters can be connected to the top row:
This is only an upper bound because it does not take into account that h-clusters not connected to the top row cannot be connected to each other across a top row h-cluster. In the example shown in figure A1, the number of signatures compatible with the top row h-cluster is not C6 = 132 but C3 C1 C2 = 10.
Figure A1. The dashed connection is forbidden: h-clusters cannot connect across h-clusters that are connected to the top row.
Download figure:
Standard image High-resolution imageWe need to consider the compositions that w top row h-clusters can impose upon the r − w other h-clusters. The composition of an integer n into k parts is defined as an ordered arrangement of k non-negative integers which sum to n [50]. The compositions of 4 into 2 parts are
A number of w top row h-clusters can divide the r − w other h-clusters into w + 1 parts at most. This gets us
Using Catalan's convolution formula [51] for 1 ⩽ k ⩽ n,
we can write this as
The sum over w can be done using binomial coefficient identities [52, table 174]. The result reads
where (A.7) follows from (A.2) with a = r + 1 and b = r − 1. This result can be categorised by considering the generalisation of (A.3). Analog to Catalan's triangle, Motzkin's triangle [53] is defined as
Hence Sn = Mn+1,2, the second column in Motzkin's triangle. This sequence is number A005322 in the on-line encyclopaedia of integer sequences.
A.3. Asymptotics
Although Motzkin's triangle is a well known object in combinatorics, we could not find an explicit formula for the asymptotic scaling of Mn,2. Hence we compute it here, following the procedure outlined in [54].
Our starting point is the generating function for Sn = Mn+1,2 [53]
The pole that determines the asymptotics of the coefficients is x = 1/3. Expanding F in terms of gives
The coefficients of the binomial series that appear in this expansion are
For α = 0, 1, 2, 3, ..., the binomial series is finite and does not contribute to the asymptotic scaling. For α ≠ 0, 1, 2, 3, ..., the binomial coefficient can be written as
and we can use the asymptotic series for the Γ function
to obtain