\documentclass{article}

\usepackage{amsmath,amsthm,amssymb}

\usepackage{asymptote}


\begin{document}

Here is a sample of using the \texttt{asy} environment in a \LaTeX\ document.  Note that the {\verb \usepackage{asymptote} } command was in the preamble.  The \texttt{asymptote.sty} file is also included with the Asymptote distribution.

\begin{figure}[h]
\begin{center}
\begin{asy}
size(2inches,2inches);

// vertices of a regular hexagon inscribed in a unit circle
pair p0 = expi(0*pi/3);
pair p1 = expi(1*pi/3);
pair p2 = expi(2*pi/3);
pair p3 = expi(3*pi/3);
pair p4 = expi(4*pi/3);
pair p5 = expi(5*pi/3);

path hexagon = p0--p1--p2--p3--p4--p5--cycle;

// draw a picture of abutting hexagons and radial lines to understand this
// xshift is the shift in the centre line from one column of hexes to the next
real xshift = p0.x + p1.x;
// yshift is the shift in the centre from one hex in a column to the next
real yshift = p1.y + p2.y;

// seed for pseudo-random number generator - why not today's date?
srand(20080522);

pen wpen = rgb(1,1,1); // white
pen rpen = rgb(1,0,0); // red

for(int i=0; i<30; ++i) { 
  for (int j=0; j<30; ++j) {
    if (rand()>randMax/2) {
      fill(shift(i*xshift, (j+(i/2-floor(i/2)))*yshift)*hexagon,rpen);
    //} else {
    //  // background is already white so this is not necessary
    //  fill(i*xshift, shift((j+(i/2-floor(i/2)))*yshift)*hexagon,wpen);
    }
    draw(shift(i*xshift, (j+(i/2-floor(i/2)))*yshift)*hexagon);
  }
}
\end{asy}
\caption{Here is a $30\times 30$ sample of critical percolation on the hexagonal lattice.}
\end{center}
\end{figure}

Looking at the asymptote code, it is pretty easy to see how to modify it. The first command sets the \texttt{size} of the framebox. Later on, in the \texttt{for} loop, you can change the number of hexagons in width and height. Note that changing the \texttt{srand} command is necessary in order to generate different samples.


\end{document}
