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