-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsource_code.tex
93 lines (93 loc) · 2.91 KB
/
source_code.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
\section{Sage Code}
This section shows how to reproduce any of the results in these Cheat Sheets.
\subsection{Requirements}
The image and experimental results in these cheat sheets were created with the
following version of Sage \cite{sage}
\begin{verbatim}
$ sage -v
SageMath Version 6.10.beta3, Release Date: 2015-11-05
\end{verbatim}
and my optional Sage package \cite{labbe_slabbe_2015} which can be installed with:
\begin{verbatim}
$ sage -p http://www.slabbe.org/Sage/slabbe-0.2.spkg
\end{verbatim}
\subsection{Definition}
Define a Multidimensional Continued Fraction algorithm:
\begin{verbatim}
sage: from slabbe.mult_cont_frac import Brun
sage: algo = Brun()
\end{verbatim}
You may replace \texttt{Brun} above by any of the following:
\begin{verbatim}
Brun, Poincare, Selmer, FullySubtractive,
ARP, Reverse, Cassaigne
\end{verbatim}
\subsection{Matrices}
\begin{verbatim}
sage: cocycle = algo.matrix_cocycle()
sage: cocycle.gens()
\end{verbatim}
\subsection{Cylinders}
\begin{verbatim}
sage: cocycle = algo.matrix_cocycle()
sage: t = cocycle.tikz_n_cylinders(3, scale=3)
sage: t.pdf()
\end{verbatim}
\subsection{Density function}
This section is hand written.
\subsection{Invariant measure}
\begin{verbatim}
sage: fig = algo.invariant_measure_wireframe_plot(
....: n_iterations=10^6, ndivs=30, norm='1')
sage: fig.savefig('a.pdf')
\end{verbatim}
\subsection{Natural extension}
\begin{verbatim}
sage: t = algo.natural_extension_tikz(n_iterations=1200,
....: marksize=.8, group_size="2 by 2")
sage: t.png()
\end{verbatim}
\subsection{Lyapunov exponents}
The algorithm that computes Lyapunov exponents was provided to me
by Vincent Delecroix, in June 2013. I translated his C code into cython.
\begin{verbatim}
sage: from slabbe.lyapunov import lyapunov_table
sage: lyapunov_table(algo, n_orbits=30, n_iterations=10^7)
\end{verbatim}
\subsection{Substitutions}
\begin{verbatim}
sage: algo.substitutions()
\end{verbatim}
\subsection{$S$-adic word example}
\begin{verbatim}
sage: v = (1,e,pi)
sage: it = algo.coding_iterator(v)
sage: [next(it) for _ in range(10)]
sage: algo.s_adic_word(v)
sage: map(w[:10000].number_of_factors, range(21))
\end{verbatim}
\subsection{Discrepancy}
\begin{verbatim}
sage: D = algo.discrepancy_statistics(length=20)
sage: histogram(D.values())
\end{verbatim}
\subsection{Dual substitutions}
\begin{verbatim}
sage: algo.dual_substitutions()
\end{verbatim}
\subsection{E one star}
\begin{verbatim}
sage: from slabbe import TikzPicture
sage: P = algo.e_one_star_patch(v=(1,e,pi), n=8)
sage: s = P.plot_tikz()
sage: TikzPicture(s).pdf()
\end{verbatim}
\subsection{Comparison of Lyapunov exponents}
\begin{verbatim}
sage: import slabbe.mult_cont_frac as mcf
sage: from slabbe.lyapunov import lyapunov_comparison_table
sage: algos = [mcf.Brun(), mcf.Selmer(), mcf.ARP(),
....: mcf.Reverse(), mcf.Cassaigne()]
sage: lyapunov_comparison_table(algos, n_orbits=30,
....: n_iterations=10^7)
\end{verbatim}