## Simulations of Percolation on the Hexagonal Lattice

Here is code to generate pictures of critical site percolation on the hexagonal lattice (i.e., each hexagon is coloured either red or white independently with probability 1/2).

This code was written by my colleague Edward Doolittle of the University of Regina.

It is written in Asymptote and can either be run directly with the Asymptote program or included in a LaTeX document.

### Instructions for running percolate1.asy directly

Step 0: Make sure that Asymptote is installed on your system. See the Asymptote website for more details.

Step 1: Run the command asy on the file percolate1.asy. The output is the file percolate1.eps in the same directory as where you ran asy.

> asy percolate1.asy
Read the percolationsample.ps or percolationsample.pdf file for a couple of tips on changing the percolate1.asy code to make different pictures.

Step 2: The .eps file can be included in your LaTeX document using \includegraphics{percolate1.eps} (or whatever other command you prefer to include .eps files). Or you can convert it to .pdf using epstopdf and \includegraphics the .pdf file.

### Instructions for including percolate1.asy in a LaTeX Document

Step 0: Make sure that Asymptote is installed on your system. See the Asymptote website for more details.

Step 1: Include the asymptote.sty package in your preamble.

Step 2: Use the asy environment and include the percolate1.asy code within the asy environment.

Step 3: Process your LaTeX file with three runs

> latex filename
> asy filename
> latex filename

or

> pdflatex filename
> asy filename
> pdflatex filename

Here is the sample LaTeX document percolationsample.tex illustrating the use of percolate1.asy.

percolationsample.tex
percolationsample.ps
percolationsample.pdf

JPEG, 40 hexagons x 40 hexagons
JPEG, 40 hexagons x 40 hexagons
EPS, 20 hexagons x 30 hexagons
PDF, 20 hexagons x 30 hexagons
EPS, 17 hexagons x 12 hexagons
PDF, 17 hexagons x 12 hexagons
EPS, 17 hexagons x 12 hexagons (fixed boundaries)
PDF, 17 hexagons x 12 hexagons (fixed boundaries)
EPS, 37 hexagons x 30 hexagons
EPS, 47 hexagons x 37 hexagons
EPS, 37 hexagons x 30 hexagons (grid only)
EPS, 47 hexagons x 37 hexagons (grid only)
EPS, 30 hexagons x 30 hexagons
EPS, 50 hexagons x 50 hexagons (4 inch square)
EPS, 50 hexagons x 50 hexagons (6 inch square)
EPS, 100 hexagons x 100 hexagons (4 inch square)
EPS, 100 hexagons x 100 hexagons (6 inch square)
EPS, 100 hexagons x 100 hexagons (8 inch square)