]> git.draconx.ca Git - scripts.git/blob - polya.tex
Mostly rewrite musicstats.zsh.
[scripts.git] / polya.tex
1 \documentclass{article}
2
3 \usepackage{fullpage}
4 \usepackage{amssymb}
5 \usepackage{tikz}
6
7 % Peano Curve of Polya
8 \newcounter{polyax}
9 \newcounter{polyay}
10 \newcounter{polyaz}
11 \newcounter{polyap}
12
13 \newcommand{\polyafig}[3]{
14   \coordinate (p0) at (#1);
15   \coordinate (p1) at +(0:#2);
16   \coordinate (p2) at (intersection cs:
17     first line={(p0)--+(60:1)},
18     second line={(p1)--($(p1)!1!150:(p0)$)});
19   \draw (p0) -- (p1) -- (p2) --cycle;
20
21   \coordinate (p3) at ($(p0)!(p2)!(p1)$);
22   \draw[densely dotted] (p2) -- (p3);
23
24   \setcounter{polyax}{0}
25   \setcounter{polyay}{2}
26   \setcounter{polyaz}{1}
27   \setcounter{polyap}{3}
28
29   \foreach \d in {#3} {
30     \pgfmathtruncatemacro{\x}{\thepolyax}
31     \pgfmathtruncatemacro{\y}{\thepolyay}
32     \pgfmathtruncatemacro{\z}{\thepolyaz}
33
34     \ifthenelse{\equal{\d}{1}}{
35       \pgfmathtruncatemacro{\xx}{\y}
36       \pgfmathtruncatemacro{\zz}{\z}
37     }{
38       \pgfmathtruncatemacro{\xx}{\x}
39       \pgfmathtruncatemacro{\zz}{\y}
40     }
41     \pgfmathtruncatemacro{\yy}{\y+1}
42
43     \pgfmathtruncatemacro{\v}{\yy+1}
44     \coordinate (p\v) at
45       ($(p\xx)!(p\yy)!(p\zz)$);
46     \draw[densely dotted] (p\yy) -- (p\v);
47
48     \setcounter{polyax}{\xx}
49     \setcounter{polyay}{\yy}
50     \setcounter{polyaz}{\zz}
51     \setcounter{polyap}{\v}
52   }
53 }
54
55 \title{The Peano Curve of P\'olya}
56 \author{}
57 \date{}
58
59 \begin{document}
60 \maketitle
61
62 A \emph{Peano Curve} is a curve which hits every point in a two-dimensional
63 object.  Recall that a curve is a continuous function
64 \[
65 f : [0,1] \to \mathbb{R}^2.
66 \]
67 A famous example of such a curve is due to George P\'olya, which fills a
68 right-angled triangle.  For $x \in [0,1)$, let $\{a_n\}^\infty_{n=0}$ be the
69 sequence of digits after the decimal point in its binary expansion.  If there
70 are multiple binary expansions, either will do (the result is the same).
71
72 \end{document}