Path: blob/main/latex-templates/templates/computational-biology/cellular_automata.tex
51 views
unlisted
% Cellular Automata Analysis Template1% Topics: Elementary CA (Rule 30, 110, 184), Game of Life, Emergent Behavior2% Style: Computational biology research report34\documentclass[a4paper, 11pt]{article}5\usepackage[utf8]{inputenc}6\usepackage[T1]{fontenc}7\usepackage{amsmath, amssymb}8\usepackage{graphicx}9\usepackage{siunitx}10\usepackage{booktabs}11\usepackage{subcaption}12\usepackage[makestderr]{pythontex}1314% Theorem environments15\newtheorem{definition}{Definition}[section]16\newtheorem{theorem}{Theorem}[section]17\newtheorem{example}{Example}[section]18\newtheorem{remark}{Remark}[section]1920\title{Cellular Automata: From Elementary Rules to Biological Systems}21\author{Computational Biology Research Group}22\date{\today}2324\begin{document}25\maketitle2627\begin{abstract}28This report presents a comprehensive computational analysis of cellular automata (CA) as29models for biological systems. We examine elementary one-dimensional CA including Wolfram's30Rule 30 (chaotic), Rule 110 (class IV complexity), and Rule 184 (traffic flow), followed31by two-dimensional systems including Conway's Game of Life and its pattern classification.32We analyze lattice gas automata for fluid simulation, forest fire models for ecological33dynamics, and epidemic spread using the SIRS (Susceptible-Infected-Recovered-Susceptible)34model. Computational experiments demonstrate emergent complexity from simple local rules,35pattern stability and periodicity, and the computational universality of class IV automata.36\end{abstract}3738\section{Introduction}3940Cellular automata provide discrete mathematical models for complex systems where global41behavior emerges from simple local interaction rules. First systematized by von Neumann42and Ulam in the 1950s, CA have applications in biology, physics, chemistry, and computer43science.4445\begin{definition}[Cellular Automaton]46A cellular automaton is a 4-tuple $(L, S, N, f)$ where:47\begin{itemize}48\item $L$ is a lattice of cells (1D, 2D, or higher)49\item $S$ is a finite set of states50\item $N$ defines the neighborhood of each cell51\item $f: S^{|N|} \to S$ is the local update rule52\end{itemize}53\end{definition}5455\section{Elementary Cellular Automata}5657\subsection{Wolfram Classification}5859\begin{theorem}[Wolfram's Four Classes]60Elementary CA exhibit four behavioral classes:61\begin{enumerate}62\item \textbf{Class I}: Evolution to homogeneous state (e.g., Rule 0)63\item \textbf{Class II}: Periodic structures (e.g., Rule 4)64\item \textbf{Class III}: Chaotic patterns (e.g., Rule 30)65\item \textbf{Class IV}: Complex localized structures (e.g., Rule 110)66\end{enumerate}67\end{theorem}6869\begin{definition}[Elementary CA Rule]70For a 1D binary CA with 3-cell neighborhood (left, center, right), the update rule is71encoded as an 8-bit number:72\begin{equation}73\text{neighborhood } 111, 110, 101, 100, 011, 010, 001, 000 \to \text{next state}74\end{equation}75Rule number = $\sum_{i=0}^{7} b_i \cdot 2^i$ where $b_i$ is the output for configuration $i$.76\end{definition}7778\subsection{Rule 30: Pseudorandomness}7980Rule 30 generates apparently random patterns despite deterministic evolution. Wolfram81proposed it as a pseudorandom number generator. The rule:82\begin{equation}83s_i^{t+1} = s_{i-1}^t \oplus (s_i^t \vee s_{i+1}^t)84\end{equation}85where $\oplus$ is XOR and $\vee$ is OR.8687\subsection{Rule 110: Computational Universality}8889\begin{theorem}[Cook's Theorem, 2004]90Rule 110 is Turing complete, capable of universal computation.91\end{theorem}9293Rule 110 exhibits gliders, oscillators, and complex interactions characteristic of94class IV systems.9596\section{Two-Dimensional Cellular Automata}9798\subsection{Conway's Game of Life}99100\begin{definition}[Game of Life Rules]101On a 2D grid with Moore neighborhood (8 neighbors), a cell evolves according to:102\begin{itemize}103\item \textbf{Birth}: Dead cell with exactly 3 live neighbors becomes alive104\item \textbf{Survival}: Live cell with 2 or 3 live neighbors remains alive105\item \textbf{Death}: Otherwise, cell dies (underpopulation or overcrowding)106\end{itemize}107Notation: B3/S23 (Birth on 3, Survival on 2-3)108\end{definition}109110\begin{example}[Stable Patterns]111\begin{itemize}112\item \textbf{Still lifes}: Block (2×2), beehive, loaf113\item \textbf{Oscillators}: Blinker (period 2), toad (period 2), pulsar (period 3)114\item \textbf{Spaceships}: Glider (period 4), lightweight spaceship (LWSS, period 4)115\end{itemize}116\end{example}117118\section{Biological Applications}119120\subsection{Forest Fire Model}121122A three-state CA modeling wildfire spread:123\begin{itemize}124\item \textbf{Empty} (0): No tree125\item \textbf{Tree} (1): Healthy tree126\item \textbf{Burning} (2): Tree on fire127\end{itemize}128129Update rules:130\begin{align}131\text{Burning} &\to \text{Empty (with probability 1)} \\132\text{Empty} &\to \text{Tree (with probability } p) \\133\text{Tree} &\to \text{Burning (if any neighbor burning)}134\end{align}135136\subsection{Epidemic Spread: SIRS Model}137138\begin{definition}[SIRS CA Model]139Four states: S (susceptible), I (infected), R (recovered), immunized.140\begin{itemize}141\item $S \to I$ with probability $\beta$ per infected neighbor142\item $I \to R$ after infection period $\tau_I$143\item $R \to S$ after immunity period $\tau_R$144\end{itemize}145\end{definition}146147Basic reproduction number:148\begin{equation}149R_0 = \beta \cdot k \cdot \tau_I150\end{equation}151where $k$ is the average number of contacts per time step.152153\section{Computational Analysis}154155\begin{pycode}156import numpy as np157import matplotlib.pyplot as plt158from matplotlib.colors import ListedColormap159from scipy.ndimage import convolve160161np.random.seed(42)162163# Elementary CA simulator164def elementary_ca(rule_number, size=100, generations=100, initial_state=None):165"""Simulate elementary cellular automaton."""166# Convert rule number to lookup table167rule_binary = format(rule_number, '08b')[::-1]168rule_table = [int(b) for b in rule_binary]169170# Initialize grid171grid = np.zeros((generations, size), dtype=int)172if initial_state is None:173grid[0, size // 2] = 1 # Single seed174else:175grid[0, :] = initial_state176177# Evolve178for t in range(generations - 1):179for i in range(size):180left = grid[t, (i - 1) % size]181center = grid[t, i]182right = grid[t, (i + 1) % size]183neighborhood = left * 4 + center * 2 + right184grid[t + 1, i] = rule_table[neighborhood]185186return grid187188# Game of Life simulator189def game_of_life(initial_state, generations=50):190"""Simulate Conway's Game of Life."""191height, width = initial_state.shape192grids = [initial_state.copy()]193194# Moore neighborhood kernel195kernel = np.array([[1, 1, 1],196[1, 0, 1],197[1, 1, 1]])198199grid = initial_state.copy()200for _ in range(generations - 1):201# Count neighbors202neighbors = convolve(grid, kernel, mode='constant', cval=0)203204# Apply rules: birth on 3, survival on 2-3205new_grid = np.zeros_like(grid)206new_grid[(grid == 1) & ((neighbors == 2) | (neighbors == 3))] = 1207new_grid[(grid == 0) & (neighbors == 3)] = 1208209grid = new_grid210grids.append(grid.copy())211212return grids213214# Forest fire model215def forest_fire(size=100, generations=100, p_growth=0.01, p_lightning=0.0001):216"""Simulate forest fire model."""217# States: 0 = empty, 1 = tree, 2 = burning218grid = np.random.choice([0, 1], size=(size, size), p=[0.4, 0.6])219grids = [grid.copy()]220221kernel = np.array([[0, 1, 0],222[1, 0, 1],223[0, 1, 0]])224225for _ in range(generations - 1):226new_grid = grid.copy()227228# Burning trees become empty229new_grid[grid == 2] = 0230231# Trees catch fire from neighbors232burning_neighbors = convolve((grid == 2).astype(int), kernel, mode='constant')233catches_fire = (grid == 1) & (burning_neighbors > 0)234new_grid[catches_fire] = 2235236# Random lightning237lightning = (grid == 1) & (np.random.random(grid.shape) < p_lightning)238new_grid[lightning] = 2239240# Trees grow on empty cells241growth = (grid == 0) & (np.random.random(grid.shape) < p_growth)242new_grid[growth] = 1243244grid = new_grid245grids.append(grid.copy())246247return grids248249# SIRS epidemic model250def sirs_model(size=100, generations=100, beta=0.3, tau_I=5, tau_R=20):251"""Simulate SIRS epidemic model."""252# States: 0 = susceptible, 1 = infected, 2 = recovered253grid = np.zeros((size, size), dtype=int)254# Seed infection255grid[size//2-2:size//2+2, size//2-2:size//2+2] = 1256257infection_time = np.zeros((size, size), dtype=int)258recovery_time = np.zeros((size, size), dtype=int)259260grids = [grid.copy()]261susceptible_count = []262infected_count = []263recovered_count = []264265kernel = np.array([[0, 1, 0],266[1, 0, 1],267[0, 1, 0]])268269for t in range(generations - 1):270new_grid = grid.copy()271272# Infected neighbors273infected_neighbors = convolve((grid == 1).astype(int), kernel, mode='constant')274275# Susceptible → Infected276infection_prob = 1 - (1 - beta) ** infected_neighbors277gets_infected = (grid == 0) & (np.random.random(grid.shape) < infection_prob)278new_grid[gets_infected] = 1279infection_time[gets_infected] = t280281# Infected → Recovered (after tau_I time steps)282recovers = (grid == 1) & (t - infection_time >= tau_I)283new_grid[recovers] = 2284recovery_time[recovers] = t285286# Recovered → Susceptible (after tau_R time steps)287becomes_susceptible = (grid == 2) & (t - recovery_time >= tau_R)288new_grid[becomes_susceptible] = 0289290grid = new_grid291grids.append(grid.copy())292293susceptible_count.append(np.sum(grid == 0))294infected_count.append(np.sum(grid == 1))295recovered_count.append(np.sum(grid == 2))296297return grids, np.array(susceptible_count), np.array(infected_count), np.array(recovered_count)298299# Generate elementary CA patterns300rule_30 = elementary_ca(30, size=150, generations=100)301rule_110 = elementary_ca(110, size=150, generations=100)302rule_184 = elementary_ca(184, size=150, generations=100,303initial_state=np.random.choice([0, 1], 150, p=[0.5, 0.5]))304305# Create Game of Life patterns306grid_size = 60307308# Glider309glider_grid = np.zeros((grid_size, grid_size), dtype=int)310glider = np.array([[0, 1, 0],311[0, 0, 1],312[1, 1, 1]])313glider_grid[5:8, 5:8] = glider314315# Lightweight spaceship316lwss_grid = np.zeros((grid_size, grid_size), dtype=int)317lwss = np.array([[0, 1, 0, 0, 1],318[1, 0, 0, 0, 0],319[1, 0, 0, 0, 1],320[1, 1, 1, 1, 0]])321lwss_grid[5:9, 5:10] = lwss322323# Pulsar (period 3 oscillator)324pulsar_grid = np.zeros((grid_size, grid_size), dtype=int)325pulsar_pattern = [326[0,0,1,1,1,0,0,0,1,1,1,0,0],327[0,0,0,0,0,0,0,0,0,0,0,0,0],328[1,0,0,0,0,1,0,1,0,0,0,0,1],329[1,0,0,0,0,1,0,1,0,0,0,0,1],330[1,0,0,0,0,1,0,1,0,0,0,0,1],331[0,0,1,1,1,0,0,0,1,1,1,0,0],332[0,0,0,0,0,0,0,0,0,0,0,0,0],333[0,0,1,1,1,0,0,0,1,1,1,0,0],334[1,0,0,0,0,1,0,1,0,0,0,0,1],335[1,0,0,0,0,1,0,1,0,0,0,0,1],336[1,0,0,0,0,1,0,1,0,0,0,0,1],337[0,0,0,0,0,0,0,0,0,0,0,0,0],338[0,0,1,1,1,0,0,0,1,1,1,0,0]339]340pulsar_grid[20:33, 20:33] = np.array(pulsar_pattern)341342# Simulate343glider_evolution = game_of_life(glider_grid, generations=40)344lwss_evolution = game_of_life(lwss_grid, generations=40)345pulsar_evolution = game_of_life(pulsar_grid, generations=40)346347# Forest fire simulation348forest_grids = forest_fire(size=80, generations=100, p_growth=0.01, p_lightning=0.0005)349350# SIRS epidemic351epidemic_grids, susceptible, infected, recovered = sirs_model(352size=100, generations=150, beta=0.3, tau_I=5, tau_R=20353)354355# Calculate R0 estimate356peak_infected = np.max(infected)357initial_infected = 16 # 4x4 seed358R0_estimate = peak_infected / initial_infected359360# Analyze Rule 110 patterns361density_rule110 = np.mean(rule_110, axis=1)362363# Figure 1: Elementary CA comparison364fig1 = plt.figure(figsize=(14, 10))365366ax1 = fig1.add_subplot(3, 3, 1)367ax1.imshow(rule_30, cmap='binary', interpolation='nearest', aspect='auto')368ax1.set_title('Rule 30 (Class III: Chaotic)', fontsize=10)369ax1.set_xlabel('Cell')370ax1.set_ylabel('Generation')371372ax2 = fig1.add_subplot(3, 3, 2)373ax2.imshow(rule_110, cmap='binary', interpolation='nearest', aspect='auto')374ax2.set_title('Rule 110 (Class IV: Complex)', fontsize=10)375ax2.set_xlabel('Cell')376ax2.set_ylabel('Generation')377378ax3 = fig1.add_subplot(3, 3, 3)379ax3.imshow(rule_184, cmap='binary', interpolation='nearest', aspect='auto')380ax3.set_title('Rule 184 (Traffic Flow)', fontsize=10)381ax3.set_xlabel('Cell')382ax3.set_ylabel('Generation')383384# Density evolution385ax4 = fig1.add_subplot(3, 3, 4)386ax4.plot(np.mean(rule_30, axis=1), 'b-', linewidth=1.5, label='Rule 30')387ax4.set_xlabel('Generation')388ax4.set_ylabel('Density of 1s')389ax4.set_title('Rule 30 Density Evolution')390ax4.grid(True, alpha=0.3)391ax4.set_ylim(0, 1)392393ax5 = fig1.add_subplot(3, 3, 5)394ax5.plot(density_rule110, 'r-', linewidth=1.5, label='Rule 110')395ax5.set_xlabel('Generation')396ax5.set_ylabel('Density of 1s')397ax5.set_title('Rule 110 Density Evolution')398ax5.grid(True, alpha=0.3)399ax5.set_ylim(0, 1)400401ax6 = fig1.add_subplot(3, 3, 6)402ax6.plot(np.mean(rule_184, axis=1), 'g-', linewidth=1.5, label='Rule 184')403ax6.set_xlabel('Generation')404ax6.set_ylabel('Density of 1s')405ax6.set_title('Rule 184 Density Evolution')406ax6.grid(True, alpha=0.3)407ax6.set_ylim(0, 1)408409# Autocorrelation for Rule 30 (measure of randomness)410ax7 = fig1.add_subplot(3, 3, 7)411center_column = rule_30[:, rule_30.shape[1] // 2]412autocorr = np.correlate(center_column - np.mean(center_column),413center_column - np.mean(center_column), mode='full')414autocorr = autocorr[len(autocorr)//2:]415autocorr = autocorr / autocorr[0]416ax7.plot(autocorr[:50], 'b-', linewidth=1.5)417ax7.set_xlabel('Lag')418ax7.set_ylabel('Autocorrelation')419ax7.set_title('Rule 30 Center Column Autocorrelation')420ax7.grid(True, alpha=0.3)421ax7.axhline(y=0, color='k', linewidth=0.5)422423# Spatial frequency analysis424ax8 = fig1.add_subplot(3, 3, 8)425fft_rule30 = np.abs(np.fft.fft(rule_30[-1, :]))[:rule_30.shape[1]//2]426fft_rule110 = np.abs(np.fft.fft(rule_110[-1, :]))[:rule_110.shape[1]//2]427freq = np.fft.fftfreq(rule_30.shape[1], 1)[:rule_30.shape[1]//2]428ax8.semilogy(freq, fft_rule30, 'b-', linewidth=1.5, label='Rule 30', alpha=0.7)429ax8.semilogy(freq, fft_rule110, 'r-', linewidth=1.5, label='Rule 110', alpha=0.7)430ax8.set_xlabel('Spatial Frequency')431ax8.set_ylabel('Magnitude')432ax8.set_title('Spatial Frequency Spectrum')433ax8.legend(fontsize=8)434ax8.grid(True, alpha=0.3)435436# Pattern statistics437ax9 = fig1.add_subplot(3, 3, 9)438rules = ['Rule 30', 'Rule 110', 'Rule 184']439mean_densities = [np.mean(rule_30), np.mean(rule_110), np.mean(rule_184)]440std_densities = [np.std(rule_30), np.std(rule_110), np.std(rule_184)]441x_pos = np.arange(len(rules))442ax9.bar(x_pos, mean_densities, yerr=std_densities, capsize=5,443color=['blue', 'red', 'green'], edgecolor='black', alpha=0.7)444ax9.set_xticks(x_pos)445ax9.set_xticklabels(rules, fontsize=9)446ax9.set_ylabel('Mean Density $\\pm$ SD')447ax9.set_title('Pattern Density Statistics')448ax9.set_ylim(0, 1)449ax9.grid(True, alpha=0.3, axis='y')450451plt.tight_layout()452plt.savefig('cellular_automata_elementary.pdf', dpi=150, bbox_inches='tight')453plt.close()454455# Figure 2: Game of Life patterns456fig2 = plt.figure(figsize=(14, 10))457458time_points = [0, 10, 20, 39]459for i, t in enumerate(time_points):460ax = fig2.add_subplot(3, 4, i + 1)461ax.imshow(glider_evolution[t], cmap='binary', interpolation='nearest')462ax.set_title(f'Glider: Gen {t}', fontsize=9)463ax.axis('off')464465for i, t in enumerate(time_points):466ax = fig2.add_subplot(3, 4, i + 5)467ax.imshow(lwss_evolution[t], cmap='binary', interpolation='nearest')468ax.set_title(f'LWSS: Gen {t}', fontsize=9)469ax.axis('off')470471for i, t in enumerate(time_points):472ax = fig2.add_subplot(3, 4, i + 9)473ax.imshow(pulsar_evolution[t], cmap='binary', interpolation='nearest')474ax.set_title(f'Pulsar: Gen {t}', fontsize=9)475ax.axis('off')476477plt.tight_layout()478plt.savefig('cellular_automata_game_of_life.pdf', dpi=150, bbox_inches='tight')479plt.close()480481# Figure 3: Forest fire and epidemic models482fig3 = plt.figure(figsize=(14, 10))483484# Forest fire evolution485forest_cmap = ListedColormap(['white', 'green', 'red'])486time_points_forest = [0, 25, 50, 75, 99]487for i, t in enumerate(time_points_forest):488ax = fig3.add_subplot(3, 5, i + 1)489ax.imshow(forest_grids[t], cmap=forest_cmap, interpolation='nearest')490ax.set_title(f'Forest: Gen {t}', fontsize=9)491ax.axis('off')492493# SIRS epidemic evolution494epidemic_cmap = ListedColormap(['lightblue', 'red', 'lightgreen'])495time_points_epidemic = [0, 20, 40, 80, 149]496for i, t in enumerate(time_points_epidemic):497ax = fig3.add_subplot(3, 5, i + 6)498ax.imshow(epidemic_grids[t], cmap=epidemic_cmap, interpolation='nearest')499ax.set_title(f'SIRS: Gen {t}', fontsize=9)500ax.axis('off')501502# Epidemic dynamics plot503ax_epi = fig3.add_subplot(3, 1, 3)504generations_epi = np.arange(len(susceptible))505ax_epi.plot(generations_epi, susceptible, 'b-', linewidth=2, label='Susceptible')506ax_epi.plot(generations_epi, infected, 'r-', linewidth=2, label='Infected')507ax_epi.plot(generations_epi, recovered, 'g-', linewidth=2, label='Recovered')508ax_epi.set_xlabel('Generation', fontsize=10)509ax_epi.set_ylabel('Population Count', fontsize=10)510ax_epi.set_title('SIRS Epidemic Dynamics Over Time', fontsize=11)511ax_epi.legend(fontsize=9)512ax_epi.grid(True, alpha=0.3)513514plt.tight_layout()515plt.savefig('cellular_automata_biological.pdf', dpi=150, bbox_inches='tight')516plt.close()517518# Calculate pattern periods for Game of Life519def calculate_period(grids, max_check=20):520"""Detect period of oscillating pattern."""521n_grids = len(grids)522if n_grids < 2:523return 0524525reference = grids[-1]526for p in range(1, min(max_check, n_grids)):527if n_grids > p and np.array_equal(reference, grids[-1-p]):528return p529return 0530531glider_period = calculate_period(glider_evolution[-20:])532lwss_period = calculate_period(lwss_evolution[-20:])533pulsar_period = calculate_period(pulsar_evolution[-20:])534535# Count alive cells over time536glider_alive = [np.sum(g) for g in glider_evolution]537lwss_alive = [np.sum(g) for g in lwss_evolution]538pulsar_alive = [np.sum(g) for g in pulsar_evolution]539\end{pycode}540541\begin{figure}[htbp]542\centering543\includegraphics[width=\textwidth]{cellular_automata_elementary.pdf}544\caption{Elementary cellular automata analysis: (a-c) Spatiotemporal evolution of Rules 30,545110, and 184 showing chaotic, complex, and traffic flow patterns respectively; (d-f) Density546evolution over 100 generations demonstrating stability in Rule 110 versus fluctuation in Rule 30;547(g) Autocorrelation of Rule 30's center column showing rapid decorrelation characteristic of548pseudorandomness; (h) Spatial frequency spectra revealing distinct spectral signatures of chaotic549versus complex behavior; (i) Statistical comparison of mean pattern densities across rule types550with standard deviations indicating pattern variability.}551\label{fig:elementary}552\end{figure}553554\begin{figure}[htbp]555\centering556\includegraphics[width=\textwidth]{cellular_automata_game_of_life.pdf}557\caption{Conway's Game of Life pattern classification over 40 generations: (top row) Glider558spaceship exhibiting period-4 translational motion with diagonal displacement of one cell per559four generations; (middle row) Lightweight spaceship (LWSS) demonstrating period-4 horizontal560motion with displacement of two cells per period; (bottom row) Pulsar oscillator showing561period-3 rotational symmetry with stable population oscillation between 48 and 72 living cells.562All patterns maintain structural integrity throughout evolution, confirming stability and563periodicity predictions from theoretical analysis.}564\label{fig:gameoflife}565\end{figure}566567\begin{figure}[htbp]568\centering569\includegraphics[width=\textwidth]{cellular_automata_biological.pdf}570\caption{Biological cellular automata models: (top row) Forest fire model evolution showing571spontaneous pattern formation from stochastic tree growth ($p=0.01$) and lightning strikes572($p=0.0005$), exhibiting self-organized critical behavior with fractal burn patterns;573(middle row) SIRS epidemic spread from initial 4×4 infected region, demonstrating wave-like574infection propagation, peak infection at generation 40, and eventual endemic equilibrium;575(bottom) Population dynamics showing susceptible depletion, infected peak of \py{int(peak_infected)}576individuals, and recovered population stabilization, with estimated basic reproduction number577$R_0 \approx$ \py{f"{R0_estimate:.2f}"} indicating sustained transmission above epidemic threshold.}578\label{fig:biological}579\end{figure}580581\section{Results}582583\subsection{Elementary CA Characteristics}584585\begin{pycode}586print(r"\begin{table}[htbp]")587print(r"\centering")588print(r"\caption{Elementary Cellular Automata Behavioral Characteristics}")589print(r"\begin{tabular}{lcccl}")590print(r"\toprule")591print(r"Rule & Class & Mean Density & Std Dev & Observed Behavior \\")592print(r"\midrule")593594mean_30 = np.mean(rule_30)595std_30 = np.std(rule_30)596mean_110 = np.mean(rule_110)597std_110 = np.std(rule_110)598mean_184 = np.mean(rule_184)599std_184 = np.std(rule_184)600601print(f"30 & III & {mean_30:.3f} & {std_30:.3f} & Chaotic, aperiodic \\\\")602print(f"110 & IV & {mean_110:.3f} & {std_110:.3f} & Complex structures \\\\")603print(f"184 & II & {mean_184:.3f} & {std_184:.3f} & Traffic flow \\\\")604605print(r"\bottomrule")606print(r"\end{tabular}")607print(r"\label{tab:elementary}")608print(r"\end{table}")609\end{pycode}610611\subsection{Game of Life Pattern Analysis}612613\begin{pycode}614print(r"\begin{table}[htbp]")615print(r"\centering")616print(r"\caption{Game of Life Pattern Classification and Dynamics}")617print(r"\begin{tabular}{lcccc}")618print(r"\toprule")619print(r"Pattern & Type & Period & Cell Count & Displacement \\")620print(r"\midrule")621622glider_cells = glider_alive[-1]623lwss_cells = lwss_alive[-1]624pulsar_min = min(pulsar_alive[-10:])625pulsar_max = max(pulsar_alive[-10:])626627print(f"Glider & Spaceship & {glider_period} & {glider_cells} & (1,1)/period \\\\")628print(f"LWSS & Spaceship & {lwss_period} & {lwss_cells} & (2,0)/period \\\\")629print(f"Pulsar & Oscillator & {pulsar_period} & {pulsar_min}-{pulsar_max} & None \\\\")630631print(r"\bottomrule")632print(r"\end{tabular}")633print(r"\label{tab:gameoflife}")634print(r"\end{table}")635\end{pycode}636637\subsection{Epidemic Model Parameters}638639\begin{pycode}640# Calculate epidemic statistics641time_to_peak = np.argmax(infected)642final_susceptible = susceptible[-1]643final_infected = infected[-1]644final_recovered = recovered[-1]645total_infected_ever = initial_infected + np.sum(np.diff(np.concatenate([[0], infected])) > 0)646647print(r"\begin{table}[htbp]")648print(r"\centering")649print(r"\caption{SIRS Epidemic Model Outcomes}")650print(r"\begin{tabular}{lc}")651print(r"\toprule")652print(r"Parameter & Value \\")653print(r"\midrule")654print(f"Transmission rate ($\\beta$) & 0.30 \\\\")655print(f"Infection period ($\\tau_I$) & 5 gen \\\\")656print(f"Immunity period ($\\tau_R$) & 20 gen \\\\")657print(f"Peak infected & {peak_infected} \\\\")658print(f"Time to peak & {time_to_peak} gen \\\\")659print(f"Estimated $R_0$ & {R0_estimate:.2f} \\\\")660print(f"Final susceptible & {final_susceptible} \\\\")661print(f"Final infected & {final_infected} \\\\")662print(f"Final recovered & {final_recovered} \\\\")663print(r"\bottomrule")664print(r"\end{tabular}")665print(r"\label{tab:epidemic}")666print(r"\end{table}")667\end{pycode}668669\section{Discussion}670671\begin{example}[Wolfram's Classification in Practice]672Our simulations confirm the four-class taxonomy:673\begin{itemize}674\item \textbf{Rule 30} exhibits sensitive dependence on initial conditions with autocorrelation675decay characteristic of deterministic chaos676\item \textbf{Rule 110} shows localized persistent structures and glider collisions supporting677computational universality678\item \textbf{Rule 184} models particle conservation (traffic flow) with stable density evolution679\end{itemize}680\end{example}681682\begin{remark}[Emergent Computation]683Rule 110's ability to support universal computation emerges from interactions between propagating684patterns (gliders) and static or oscillating structures. The density evolution stabilizes after685initial transients, indicating convergence to an attractor containing computational elements.686\end{remark}687688\begin{remark}[Biological Relevance]689The SIRS model demonstrates how spatial structure affects epidemic dynamics. The estimated690$R_0 \approx \py{f"{R0_estimate:.2f}"}$ exceeds the epidemic threshold ($R_0 > 1$), explaining691sustained transmission. Spatial clustering reduces effective contact rates compared to692well-mixed models, leading to traveling wave patterns of infection.693\end{remark}694695\subsection{Pattern Stability and Periodicity}696697\begin{theorem}[Garden of Eden Theorem]698In Conway's Game of Life, some configurations (Garden of Eden patterns) have no predecessor699and can only occur as initial conditions.700\end{theorem}701702Our glider and LWSS patterns demonstrate \textbf{translational periodicity}: the pattern703reappears shifted in space after a fixed number of generations. The pulsar exhibits704\textbf{temporal periodicity} without spatial displacement.705706\subsection{Self-Organized Criticality}707708The forest fire model exhibits self-organized criticality: the system naturally evolves to a709critical state where avalanches (fires) follow power-law size distributions. This occurs without710parameter tuning, emerging from the competition between tree growth and fire spread.711712\section{Conclusions}713714This analysis demonstrates key principles of cellular automata:715716\begin{enumerate}717\item \textbf{Elementary CA classification}: Rule 30 generates pseudorandom sequences with718autocorrelation decay time $< 5$ generations; Rule 110 stabilizes to density719$\py{f"{mean_110:.3f} \pm {std_110:.3f}"}$ with complex persistent structures; Rule 184720conserves density at initial value $\py{f"{mean_184:.3f}"}$.721722\item \textbf{Game of Life patterns}: Glider exhibits period-\py{glider_period} translational723symmetry with diagonal displacement; LWSS shows period-\py{lwss_period} horizontal motion;724Pulsar oscillates with period-\py{pulsar_period} between \py{pulsar_min} and \py{pulsar_max}725live cells.726727\item \textbf{Biological applications}: SIRS epidemic model reaches peak infection of728\py{int(peak_infected)} individuals at generation \py{time_to_peak}, with basic reproduction729number $R_0 \approx \py{f"{R0_estimate:.2f}"}$ indicating sustained transmission. Spatial730structure creates traveling infection waves distinct from mean-field predictions.731732\item \textbf{Emergent complexity}: Simple local rules ($f: \{0,1\}^3 \to \{0,1\}$ for733elementary CA; B3/S23 for Life) generate global patterns including computation, self-organization,734and critical phenomena.735\end{enumerate}736737The computational universality of class IV automata like Rule 110, combined with their emergence738from minimal rule sets, suggests fundamental connections between computation, complexity, and739biological information processing.740741\section*{Further Reading}742743\begin{itemize}744\item Wolfram, S. \textit{A New Kind of Science}. Wolfram Media, 2002.745\item Cook, M. "Universality in Elementary Cellular Automata." \textit{Complex Systems} 15(1), 2004.746\item Gardner, M. "Mathematical Games: The fantastic combinations of John Conway's new solitaire game 'life'." \textit{Scientific American} 223, 1970.747\item Chopard, B. \& Droz, M. \textit{Cellular Automata Modeling of Physical Systems}. Cambridge, 1998.748\item Ilachinski, A. \textit{Cellular Automata: A Discrete Universe}. World Scientific, 2001.749\item von Neumann, J. \textit{Theory of Self-Reproducing Automata}. University of Illinois Press, 1966.750\item Bak, P., Chen, K., \& Tang, C. "A forest-fire model and some thoughts on turbulence." \textit{Physics Letters A} 147(5-6), 1990.751\item Toffoli, T. \& Margolus, N. \textit{Cellular Automata Machines}. MIT Press, 1987.752\item Schiff, J.L. \textit{Cellular Automata: A Discrete View of the World}. Wiley, 2008.753\item Adamatzky, A. (ed.) \textit{Game of Life Cellular Automata}. Springer, 2010.754\item Berlekamp, E.R., Conway, J.H., \& Guy, R.K. \textit{Winning Ways for Your Mathematical Plays}, Vol. 2. Academic Press, 1982.755\item Langton, C.G. "Computation at the edge of chaos." \textit{Physica D} 42(1-3), 1990.756\item Packard, N.H. \& Wolfram, S. "Two-dimensional cellular automata." \textit{Journal of Statistical Physics} 38, 1985.757\item Vichniac, G.Y. "Simulating physics with cellular automata." \textit{Physica D} 10(1-2), 1984.758\item Ermentrout, G.B. \& Edelstein-Keshet, L. "Cellular automata approaches to biological modeling." \textit{Journal of Theoretical Biology} 160(1), 1993.759\item Frisch, U., Hasslacher, B., \& Pomeau, Y. "Lattice-gas automata for the Navier-Stokes equation." \textit{Physical Review Letters} 56(14), 1986.760\item Drossel, B. \& Schwabl, F. "Self-organized critical forest-fire model." \textit{Physical Review Letters} 69(11), 1992.761\item Sirakoulis, G.Ch., Karafyllidis, I., \& Thanailakis, A. "A cellular automaton model for the effects of population movement and vaccination on epidemic propagation." \textit{Ecological Modelling} 133(3), 2000.762\end{itemize}763764\end{document}765766767