\documentclass[12pt]{article}
\usepackage{fancyhdr,fancybox,amssymb,epsfig,amsmath,latexsym,bm}
\usepackage{enumerate}
\usepackage{tikz}
\usepackage[all]{xy}
\usepackage{stackrel}
\usepackage[]{hyperref}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.markings}

\tikzset{big arrow/.style={decoration={markings,mark=at position 0.6
      with {\arrow[scale=2]{>}}}, postaction={decorate}, shorten >=1pt}}

% Code to make an augmented matrix (Usage: \begin{bmatrix}[ccc|c])
\makeatletter
\renewcommand*\env@matrix[1][*\c@MaxMatrixCols c]{%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{#1}}
\makeatother

\topmargin=-.5in
\headsep=0.2in
\oddsidemargin=0in
\textwidth=6.7in
\textheight=9.2in
\footskip=.5in

% Change this line to \def\bold{\mathbf} for ``upright boldface.''
\def\bold{\bm}

\newcommand{\F}{\mathbb{F}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\R}{\mathbb{R}}
\newcommand{\Z}{\mathbb{Z}}
\def\0{\bold{0}}
\def\A{\bold{A}}
\def\B{\bold{B}}
\def\C{\bold{C}}
\def\I{\bold{I}}
\def\M{\bold{M}}
\def\P{\bold{P}}
\def\Q{\bold{Q}}
\def\a{\bold{a}}
\def\b{\bold{b}}
\def\c{\bold{c}}
\def\e{\bold{e}}
\def\p{\bold{p}}
\def\q{\bold{q}}
\def\t{\bold{t}}
\def\u{\bold{u}}
\def\v{\bold{v}}
\def\x{\bold{x}}
\def\<{\langle}
\def\>{\rangle}
\def\hat{\widehat}

\def\And{\wedge}
\def\Or{\vee}
%\def\Not{\neg}
\newcommand{\Not}[1]{\overline #1}



\DeclareMathOperator{\OR}{OR}
\DeclareMathOperator{\NOR}{NOR}
\DeclareMathOperator{\Span}{Span}
\DeclareMathOperator{\rank}{rank}
\newcommand{\vv}[2]{\begin{bmatrix} #1 \\ #2 \end{bmatrix}}
\newcommand{\vvv}[3]{\begin{bmatrix} #1 \\ #2 \\ #3 \end{bmatrix}}

\newcommand{\ds}{\displaystyle}

\renewcommand{\footrulewidth}{1pt}
\newenvironment{proof}[1][Proof.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{sol}[1][Solution.]{\smallskip\begin{trivlist}
    \item[\hskip \labelsep {\sffamily #1}]}{\qed\end{trivlist}\bigskip}
\newenvironment{fminipage}
{\setlength{\fboxsep}{15pt}\begin{Sbox}\begin{minipage}}
{\end{minipage}\end{Sbox}\fbox{\TheSbox}}
\newcommand{\qed}{\hfill \ensuremath{\Box}}
\newcommand{\disp}{\displaystyle}


\pagestyle{fancy} \lhead{{\sf Homework 7 $|$ Due March 11 (Friday)
}} \rhead{\thepage} \cfoot{{\sf Math 4500 $|$ Mathematical Modeling
    $|$ Spring 2022 $|$ M.~Macauley}}


\begin{document}

%$\;$

\noindent \emph{Read}: Chapter 4.1: Global dynamics emerging from
local interactions: agent-based modeling for the life sciences. By
D.~Gammack, Elsa.~Schaefer, and H.~Gaff, pp.~105--113.


\begin{enumerate}

\item Find an applet or program that can simulate a cellular
  automata. One such example is
  \url{https://elife-asu.github.io/wss-modules/modules/1-1d-cellular-automata/}.
  Carry out the following steps for ECA Rules 54, 73, 137, and one
  more ``interesting'' rule of your choice. Make the grid size be
  several hundred; not too big, and not too small (the specific size
  for which it ``looks best'' will depend on the specific rule).
  \begin{enumerate}
  \item Explore the dynamics of the elementary cellular automaton
    (ECA) rule using both a single black square as a starting state,
    and using a random state. Include a screenshot of your findings.
  \item Which of the four Wolfram classes do you think this rule
    belongs to, and why? \medskip
  \end{enumerate}
  

  
\item Consider the ECA rule defined by the following \emph{truth
  table}:
    \[
    \begin{tikzpicture}[scale=.5]
      \begin{scope}[shift={(0,0)}]
        \draw [fill=black] (.07,.07) rectangle (.93,.93); 
        \draw [fill=black] (1.07,.07) rectangle (1.93,.93); 
        \draw [fill=black] (2.07,.07) rectangle (2.93,.93); 
        \draw (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(4,0)}]
        \draw [fill=black] (.07,.07) rectangle (.93,.93); 
        \draw [fill=black] (1.07,.07) rectangle (1.93,.93); 
        \draw (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(8,0)}]
        \draw [fill=black] (.07,.07) rectangle (.93,.93); 
        \draw (1.07,.07) rectangle (1.93,.93); 
        \draw [fill=black] (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(12,0)}]
        \draw [fill=black] (.07,.07) rectangle (.93,.93); 
        \draw (1.07,.07) rectangle (1.93,.93); 
        \draw (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(16,0)}]
        \draw (.07,.07) rectangle (.93,.93); 
        \draw [fill=black] (1.07,.07) rectangle (1.93,.93); 
        \draw [fill=black] (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(20,0)}]
        \draw (.07,.07) rectangle (.93,.93); 
        \draw [fill=black] (1.07,.07) rectangle (1.93,.93); 
        \draw (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(24,0)}]
        \draw (.07,.07) rectangle (.93,.93); 
        \draw (1.07,.07) rectangle (1.93,.93); 
        \draw [fill=black] (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
      \begin{scope}[shift={(28,0)}]
        \draw (.07,.07) rectangle (.93,.93); 
        \draw (1.07,.07) rectangle (1.93,.93); 
        \draw (2.07,.07) rectangle (2.93,.93); 
        \draw [fill=black] (1.07,-.07) rectangle (1.93,-.93); 
      \end{scope}
    \end{tikzpicture}
    \]
    Here, white $=0$, black $=1$, and each 4-box diagram represents a
    three-bit input vector $(x_{i-1}(t),x_i(t),x_{i+1}(t))$ and the
    corresponding output $x_i(t+1)=f(x_{i-1}(t),x_i(t),x_{i+1}(t))$.
    \begin{enumerate}
      \item Find the decimal form of this rule. It should be a number
        between $0$ and $255$.
      \item Write the function $f(x_{i-1},x_i,x_{i+1})$ as a
        \emph{polynomial} over $\Z_2=\{0,1\}$, by replacing $x\And y$
        with $xy$, $x\Or y$ with $x+y+1$, and $\neg x$ with $1+x$,
        and reducing modulo $2$.
      \item Write the local function $f(x_{i-1},x_i,x_{i+1})$ as a
        Boolean logical expression (that is, using $\vee$, $\wedge$,
        and $\neg$). \medskip
    \end{enumerate}


    
  \item For each of the following, express the ECA rule four different
    ways: by its truth table, in decimal form, using Boolean logic,
    and as a polynomial over $\Z_2$.
    \begin{enumerate}
      \item the rule that translates its initial state one position to
        the right;
      \item the rule that models traffic flow to the left,
      \item the \emph{logical OR} function:
        $f(x_{i-1},x_i,x_{i+1})=\OR(x_{i-1},x_i,x_{i+1})$.
      \item the negation of the logical or function,
        $f(x_{i-1},x_i,x_{i+1})=\NOR(x_{i-1},x_i,x_{i+1})$. 
      \item the \emph{parity function},
        $f(x_{i-1},x_i,x_{i+1})=x_{i-1}+x_i+x_{i+1}\pmod{2}$. \medskip
    \end{enumerate}
    


  \item Go to \url{https://www.netlogoweb.org/} to access NetLogo,
    which can be run online or downloaded. Find two agent-based models that we
    did not try out in class. Adjust one of the parameters until you
    find a ``threshold'' between two distinct types of
    behaviors. Describe your findings in a paragraphs, including the
    approximate value of the threshold, and print out a screen shot
    (in color, if possible).


\end{enumerate}


\end{document}


