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