]> gitweb.michael.orlitzky.com - mjotex.git/blob - examples.tex
mjo-common: add \lcm{} for the least common multiple.
[mjotex.git] / examples.tex
1 \documentclass{report}
2
3 % Setting hypertexnames=false forces hyperref to use a consistent
4 % internal counter for proposition/equation references rather than
5 % being clever, which doesn't work after we reset those counters.
6 \usepackage[hypertexnames=false]{hyperref}
7 \hypersetup{
8 colorlinks=true,
9 linkcolor=blue,
10 citecolor=blue
11 }
12
13 % We have to load this after hyperref, so that links work, but before
14 % mjotex so that mjotex knows to define its glossary entries.
15 \usepackage[nonumberlist]{glossaries}
16 \makenoidxglossaries
17
18 % If you want an index, we can do that too. You'll need to define
19 % the "INDICES" variable in the GNUmakefile, though.
20 \usepackage{makeidx}
21 \makeindex
22
23 \usepackage{mjotex}
24 \usepackage{mathtools}
25
26 \begin{document}
27
28 \begin{section}{Algebra}
29 If $R$ is a \index{commutative ring}, then $\polyring{R}{X,Y,Z}$
30 is a multivariate polynomial ring with indeterminates $X$, $Y$,
31 and $Z$, and coefficients in $R$. If $R$ is a moreover an integral
32 domain, then its fraction field is $\Frac{R}$. If $x,y,z \in R$,
33 then $\ideal{\set{x,y,z}}$ is the ideal generated by
34 $\set{x,y,z}$, which is defined to be the smallest ideal in $R$
35 containing that set. Likewise, if we are in an algebra
36 $\mathcal{A}$ and if $x,y,z \in \mathcal{A}$, then
37 $\alg{\set{x,y,z}}$ is the smallest subalgebra of $\mathcal{A}$
38 containing the set $\set{x,y,z}$.
39 \end{section}
40
41 \begin{section}{Algorithm}
42 An example of an algorithm (bogosort) environment.
43
44 \begin{algorithm}[H]
45 \caption{Sort a list of numbers}
46 \begin{algorithmic}
47 \Require{A list of numbers $L$}
48 \Ensure{A new, sorted copy $M$ of the list $L$}
49
50 \State{$M \gets L$}
51
52 \While{$M$ is not sorted}
53 \State{Rearrange $M$ randomly}
54 \EndWhile
55
56 \Return{$M$}
57 \end{algorithmic}
58 \end{algorithm}
59 \end{section}
60
61 \begin{section}{Arrow}
62 The constant function that always returns $a$ is $\const{a}$. The
63 identity operator on $V$ is $\identity{V}$. The composition of $f$
64 and $g$ is $\compose{f}{g}$. The inverse of $f$ is
65 $\inverse{f}$. If $f$ is a function and $A$ is a subset of its
66 domain, then the preimage under $f$ of $A$ is $\preimage{f}{A}$.
67 \end{section}
68
69 \begin{section}{Calculus}
70 The gradient of $f : \Rn \rightarrow \Rn[1]$ is $\gradient{f} :
71 \Rn \rightarrow \Rn$.
72 \end{section}
73
74 \begin{section}{Common}
75 The function $f$ applied to $x$ is $f\of{x}$, and the restriction
76 of $f$ to a subset $X$ of its domain is $\restrict{f}{X}$. We can
77 group terms like $a + \qty{b - c}$ or $a + \qty{b - \sqty{c -
78 d}}$. The tuples go up to seven, for now:
79 %
80 \begin{itemize}
81 \begin{item}
82 Pair: $\pair{1}{2}$,
83 \end{item}
84 \begin{item}
85 Triple: $\triple{1}{2}{3}$,
86 \end{item}
87 \begin{item}
88 Quadruple: $\quadruple{1}{2}{3}{4}$,
89 \end{item}
90 \begin{item}
91 Qintuple: $\quintuple{1}{2}{3}{4}{5}$,
92 \end{item}
93 \begin{item}
94 Sextuple: $\sextuple{1}{2}{3}{4}{5}{6}$,
95 \end{item}
96 \begin{item}
97 Septuple: $\septuple{1}{2}{3}{4}{5}{6}{7}$.
98 \end{item}
99 \end{itemize}
100 %
101 The factorial of the number $10$ is $\factorial{10}$, and the
102 least common multiple of $4$ and $6$ is $\lcm{\set{4,6}} =
103 12$.
104
105 The direct sum of $V$ and $W$ is $\directsum{V}{W}$. Or three
106 things, $\directsumthree{U}{V}{W}$. How about more things? Like
107 $\directsummany{k=1}{\infty}{V_{k}}$. Those direct sums
108 adapt nicely to display equations:
109 %
110 \begin{equation*}
111 \directsummany{k=1}{\infty}{V_{k}} \ne \emptyset.
112 \end{equation*}
113 %
114 Here are a few common tuple spaces that should not have a
115 superscript when that superscript would be one: $\Nn[1]$,
116 $\Zn[1]$, $\Qn[1]$, $\Rn[1]$, $\Cn[1]$. However, if the
117 superscript is (say) two, then it appears: $\Nn[2]$, $\Zn[2]$,
118 $\Qn[2]$, $\Rn[2]$, $\Cn[2]$. Finally, we have the four standard
119 types of intervals in $\Rn[1]$,
120 %
121 \begin{align*}
122 \intervaloo{a}{b} &= \setc{ x \in \Rn[1]}{ a < x < b },\\
123 \intervaloc{a}{b} &= \setc{ x \in \Rn[1]}{ a < x \le b },\\
124 \intervalco{a}{b} &= \setc{ x \in \Rn[1]}{ a \le x < b }, \text{ and }\\
125 \intervalcc{a}{b} &= \setc{ x \in \Rn[1]}{ a \le x \le b }.
126 \end{align*}
127 \end{section}
128
129 \begin{section}{Complex}
130 We sometimes want to conjugate complex numbers like
131 $\compconj{a+bi} = a - bi$.
132 \end{section}
133
134 \begin{section}{Cone}
135 The dual cone of $K$ is $\dual{K}$. Some familiar symmetric cones
136 are $\Rnplus$, $\Lnplus$, $\Snplus$, and $\Hnplus$. If cones
137 $K_{1}$ and $K_{2}$ are given, we can define $\posops{K_{1}}$,
138 $\posops[K_{2}]{K_{1}}$, $\Sof{K_{1}}$, $\Zof{K_{1}}$,
139 $\LL{K_{1}}$, and $\lyapunovrank{K_{1}}$. We can also define $x
140 \gecone_{K} y$, $x \gtcone_{K} y$, $x \lecone_{K} y$, and $x
141 \ltcone_{K} y$ with respect to a cone $K$.
142 \end{section}
143
144 \begin{section}{Convex}
145 The conic hull of a set $X$ is $\cone{X}$; its affine hull is
146 $\aff{X}$, and its convex hull is $\conv{X}$. If $K$ is a cone,
147 then its lineality space is $\linspace{K}$, its lineality is
148 $\lin{K}$, and its extreme directions are $\Ext{K}$. The fact that
149 $F$ is a face of $K$ is denoted by $F \faceof K$; if $F$ is a
150 proper face, then we write $F \properfaceof K$.
151 \end{section}
152
153 \begin{section}{Euclidean Jordan algebras}
154 The Jordan product of $x$ and $y$ in some Euclidean Jordan algebra
155 is $\jp{x}{y}$.
156 \end{section}
157
158 \begin{section}{Font}
159 We can write things like Carathéodory and Güler and
160 $\mathbb{R}$. The PostScript Zapf Chancery font is also available
161 in both upper- and lower-case:
162 %
163 \begin{itemize}
164 \begin{item}$\mathpzc{abcdefghijklmnopqrstuvwxyz}$\end{item}
165 \begin{item}$\mathpzc{ABCDEFGHIJKLMNOPQRSTUVWXYZ}$\end{item}
166 \end{itemize}
167 \end{section}
168
169 \begin{section}{Linear algebra}
170 The absolute value of $x$ is $\abs{x}$, or its norm is
171 $\norm{x}$. The inner product of $x$ and $y$ is $\ip{x}{y}$ and
172 their tensor product is $\tp{x}{y}$. The Kronecker product of
173 matrices $A$ and $B$ is $\kp{A}{B}$. The adjoint of the operator
174 $L$ is $\adjoint{L}$, or if it's a matrix, then its transpose is
175 $\transpose{L}$. Its trace is $\trace{L}$, and its spectrum---the
176 set of its eigenvalues---is $\spectrum{L}$. Another matrix-specific
177 concept is the Moore-Penrose pseudoinverse of $L$, denoted by
178 $\pseudoinverse{L}$. Finally, the rank of a matrix $L$ is
179 $\rank{L}$. As far as matrix spaces go, we have the $n$-by-$n$
180 real-symmetric and complex-Hermitian matrices $\Sn$ and $\Hn$
181 respectively; however $\Sn[1]$ and $\Hn[1]$ do not automatically
182 simplify because the ``$n$'' does not indicate the arity of a
183 Cartesian product in this case.
184
185 The span of a set $X$ is $\spanof{X}$, and its codimension is
186 $\codim{X}$. The projection of $X$ onto $V$ is $\proj{V}{X}$. The
187 automorphism group of $X$ is $\Aut{X}$, and its Lie algebra is
188 $\Lie{X}$. We can write a column vector $x \coloneqq
189 \colvec{x_{1},x_{2},x_{3},x_{4}}$ and turn it into a $2 \times 2$
190 matrix with $\matricize{x}$. To recover the vector, we use
191 $\vectorize{\matricize{x}}$.
192
193 The set of all bounded linear operators from $V$ to $W$ is
194 $\boundedops[W]{V}$. If $W = V$, then we write $\boundedops{V}$
195 instead.
196
197 If you want to solve a system of equations, try Cramer's
198 rule~\cite{ehrenborg}.
199
200 The direct sum of $V$ and $W$ is $\directsum{V}{W}$, of course,
201 but what if $W = V^{\perp}$? Then we wish to indicate that fact by
202 writing $\directsumperp{V}{W}$. That operator should survive a
203 display equation, too, and the weight of the circle should match
204 that of the usual direct sum operator.
205 %
206 \begin{align*}
207 Z = \directsumperp{V}{W}\\
208 \oplus \oplusperp \oplus \oplusperp
209 \end{align*}
210 %
211 Its form should also survive in different font sizes...
212 \Large
213 \begin{align*}
214 Z = \directsumperp{V}{W}\\
215 \oplus \oplusperp \oplus \oplusperp
216 \end{align*}
217 \Huge
218 \begin{align*}
219 Z = \directsumperp{V}{W}\\
220 \oplus \oplusperp \oplus \oplusperp
221 \end{align*}
222 \normalsize
223 \end{section}
224
225 \begin{section}{Listing}
226 Here's an interactive SageMath prompt:
227
228 \begin{tcblisting}{listing only,
229 colback=codebg,
230 coltext=codefg,
231 listing options={language=sage,style=sage}}
232 sage: K = Cone([ (1,0), (0,1) ])
233 sage: K.positive_operator_gens()
234 [
235 [1 0] [0 1] [0 0] [0 0]
236 [0 0], [0 0], [1 0], [0 1]
237 ]
238 \end{tcblisting}
239
240 However, the smart way to display a SageMath listing is to load it
241 from an external file (under the ``listings'' subdirectory):
242
243 \sagelisting{example}
244
245 Keeping the listings in separate files makes it easy for the build
246 system to test them.
247 \end{section}
248
249 \begin{section}{Proof by cases}
250
251 \begin{proposition}
252 There are two cases in the following proof.
253
254 \begin{proof}
255 The result should be self-evident once we have considered the
256 following two cases.
257 \begin{pcases}
258 \begin{case}[first case]
259 Nothing happens in the first case.
260 \end{case}
261 \begin{case}[second case]
262 The same thing happens in the second case.
263 \end{case}
264 \end{pcases}
265
266 You see?
267 \end{proof}
268 \end{proposition}
269
270 Here's another one.
271
272 \renewcommand{\baselinestretch}{2}
273 \begin{proposition}
274 Cases should display intelligently even when the document is
275 double-spaced.
276
277 \begin{proof}
278 Here we go again.
279
280 \begin{pcases}
281 \begin{case}[first case]
282 Nothing happens in the first case.
283 \end{case}
284 \begin{case}[second case]
285 The same thing happens in the second case.
286 \end{case}
287 \end{pcases}
288
289 Now it's over.
290 \end{proof}
291 \end{proposition}
292 \renewcommand{\baselinestretch}{1}
293 \end{section}
294
295 \begin{section}{Set theory}
296 Here's a set $\set{1,2,3} = \setc{n \in \Nn[1]}{ n \le 3 }$. The
297 cardinality of the set $X \coloneqq \set{1,2,3}$ is $\card{X} =
298 3$, and its powerset is $\powerset{X}$.
299
300 We also have a few basic set operations, for example the union of
301 two or three sets: $\union{A}{B}$, $\unionthree{A}{B}{C}$. And of
302 course with union comes intersection: $\intersect{A}{B}$,
303 $\intersectthree{A}{B}{C}$. The Cartesian product of two sets $A$
304 and $B$ is there too: $\cartprod{A}{B}$. If we take the product
305 with $C$ as well, then we obtain $\cartprodthree{A}{B}{C}$.
306
307 We can also take an arbitrary (indexed) union, intersection, or
308 Cartesian product of things, like
309 $\unionmany{k=1}{\infty}{A_{k}}$,
310 $\intersectmany{k=1}{\infty}{B_{k}}$, or
311 $\cartprodmany{k=1}{\infty}{C_{k}}$. The best part about those is
312 that they do the right thing in a display equation:
313 %
314 \begin{equation*}
315 \unionmany{k=1}{\infty}{A_{k}}
316 \ne
317 \intersectmany{k=1}{\infty}{B_{k}}
318 \ne
319 \cartprodmany{k=1}{\infty}{C_{k}}.
320 \end{equation*}
321 %
322 \end{section}
323
324 \begin{section}{Theorems}
325 \begin{corollary}
326 The
327 \end{corollary}
328
329 \begin{lemma}
330 quick
331 \end{lemma}
332
333 \begin{proposition}
334 brown
335 \end{proposition}
336
337 \begin{theorem}
338 fox
339 \end{theorem}
340
341 \begin{exercise}
342 jumps
343 \end{exercise}
344
345 \begin{definition}
346 quod
347 \end{definition}
348
349 \begin{example}
350 erat
351 \end{example}
352
353 \begin{remark}
354 demonstradum.
355 \end{remark}
356 \end{section}
357
358 \begin{section}{Theorems (starred)}
359 \begin{corollary*}
360 The
361 \end{corollary*}
362
363 \begin{lemma*}
364 quick
365 \end{lemma*}
366
367 \begin{proposition*}
368 brown
369 \end{proposition*}
370
371 \begin{theorem*}
372 fox
373 \end{theorem*}
374
375 \begin{exercise*}
376 jumps
377 \end{exercise*}
378
379 \begin{definition*}
380 quod
381 \end{definition*}
382
383 \begin{example*}
384 erat
385 \end{example*}
386
387 \begin{remark*}
388 demonstradum.
389 \end{remark*}
390 \end{section}
391
392 \begin{section}{Topology}
393 The interior of a set $X$ is $\interior{X}$. Its closure is
394 $\closure{X}$ and its boundary is $\boundary{X}$.
395 \end{section}
396
397 \setlength{\glslistdottedwidth}{.3\linewidth}
398 \setglossarystyle{listdotted}
399 \glsaddall
400 \printnoidxglossaries
401
402 \bibliographystyle{mjo}
403 \bibliography{local-references}
404
405 \printindex
406 \end{document}