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