我想知道是否有一种简单的方法可以在 LaTeX 中绘制 Wolfram 的基本细胞自动机(及其演变的一些步骤),例如规则 30,如下所示:
http://mathworld.wolfram.com/CellularAutomaton.html
当然,也可以尝试用 TikZ 来绘制它,但这会相当复杂。
答案1
TikZ
矩阵的可能解决方案
\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{matrix, positioning}
\begin{document}
\begin{tikzpicture}[b/.style={draw, minimum size=3mm,
fill=black},w/.style={draw, minimum size=3mm},
m/.style={matrix of nodes, column sep=1pt, row sep=1pt, draw, label=below:#1}, node distance=1pt]
\matrix (A) [m=0]{
|[b]|&|[b]|&|[b]|\\
&|[w]|\\
};
\matrix (B) [m=0, right=of A]{
|[b]|&|[b]|&|[w]|\\
&|[w]|\\
};
\matrix (C) [m=0, right=of B]{
|[b]|&|[w]|&|[b]|\\
&|[w]|\\
};
\matrix (D) [m=1, right=of C]{
|[b]|&|[w]|&|[w]|\\
&|[b]|\\
};
\matrix (E) [m=1, right=of D]{
|[w]|&|[b]|&|[b]|\\
&|[b]|\\
};
\matrix (F) [m=1, right=of E]{
|[w]|&|[b]|&|[w]|\\
&|[b]|\\
};
\matrix (G) [m=1, right=of F]{
|[w]|&|[w]|&|[b]|\\
&|[b]|\\
};
\matrix (H) [m=0, right=of G]{
|[w]|&|[w]|&|[w]|\\
&|[w]|\\
};
\end{tikzpicture}
\end{document}
答案2
另一种解决方案:
\usepackage{amsmath}
\[ \LARGE
\substack{\blacksquare \blacksquare \blacksquare \\ \square} \enspace
\substack{\blacksquare \blacksquare \square \\ \square} \enspace
\substack{\blacksquare \square \blacksquare \\ \square} \enspace
\substack{\blacksquare \square \square \\ \blacksquare} \enspace
\substack{\square \blacksquare \blacksquare \\ \blacksquare} \enspace
\substack{\square \blacksquare \square \\ \blacksquare} \enspace
\substack{\square \square \blacksquare \\ \blacksquare} \enspace
\substack{\square \square \square \\ \square}
\]