]> gitweb.michael.orlitzky.com - mjotex.git/blob - examples.tex
mjo-linear_algebra.tex: add the Moore-Penrose \pseudoinverse.
[mjotex.git] / examples.tex
1 \documentclass{report}
2
3 \usepackage{mjotex}
4 \usepackage{mathtools}
5
6 \begin{document}
7
8 \begin{section}{Algorithm}
9 An example of an algorithm (bogosort) environment.
10
11 \begin{algorithm}[H]
12 \caption{Sort a list of numbers}
13 \begin{algorithmic}
14 \Require{A list of numbers $L$}
15 \Ensure{A new, sorted copy $M$ of the list $L$}
16
17 \State{$M \gets L$}
18
19 \While{$M$ is not sorted}
20 \State{Rearrange $M$ randomly}
21 \EndWhile
22
23 \Return{$M$}
24 \end{algorithmic}
25 \end{algorithm}
26 \end{section}
27
28 \begin{section}{Arrow}
29 The identity operator on $V$ is $\identity{V}$. The composition of
30 $f$ and $g$ is $\compose{f}{g}$. The inverse of $f$ is
31 $\inverse{f}$. If $f$ is a function and $A$ is a subset of its
32 domain, then the preimage under $f$ of $A$ is $\preimage{f}{A}$.
33 \end{section}
34
35 \begin{section}{Common}
36 The function $f$ applied to $x$ is $f\of{x}$. We can group terms
37 like $a + \qty{b - c}$ or $a + \qty{b - \sqty{c - d}}$. Here's a
38 set $\set{1,2,3} = \setc{n \in \Nn[1]}{ n \le 3 }$. Here's a pair
39 of things $\pair{1}{2}$ or a triple of them $\triple{1}{2}{3}$,
40 and the factorial of the number $10$ is $\factorial{10}$.
41
42 The Cartesian product of two sets $A$ and $B$ is
43 $\cartprod{A}{B}$; if we take the product with $C$ as well, then
44 we obtain $\cartprodthree{A}{B}{C}$. The direct sum of $V$ and $W$
45 is $\directsum{V}{W}$. Or three things,
46 $\directsumthree{U}{V}{W}$. How about more things? Like
47 $\directsummany{k=1}{\infty}{V_{k}} \ne
48 \cartprodmany{k=1}{\infty}{V_{k}}$. Those direct sums and
49 cartesian products adapt nicely to display equations:
50 %
51 \begin{equation*}
52 \directsummany{k=1}{\infty}{V_{k}} \ne \cartprodmany{k=1}{\infty}{V_{k}}.
53 \end{equation*}
54 Here are a few common tuple spaces that should not have a
55 superscript when that superscript would be one: $\Nn[1]$,
56 $\Zn[1]$, $\Qn[1]$, $\Rn[1]$, $\Cn[1]$. However, if the
57 superscript is (say) two, then it appears: $\Nn[2]$, $\Zn[2]$,
58 $\Qn[2]$, $\Rn[2]$, $\Cn[2]$.
59
60 We also have a few basic set operations, for example the union of
61 two or three sets: $\union{A}{B}$, $\unionthree{A}{B}{C}$. And of
62 course with union comes intersection: $\intersect{A}{B}$,
63 $\intersectthree{A}{B}{C}$. We can also take an arbitrary
64 (indexed) union and intersections of things, like
65 $\unionmany{k=1}{\infty}{A_{k}}$ or
66 $\intersectmany{k=1}{\infty}{B_{k}}$. The best part about those
67 is that they do the right thing in a display equation:
68 %
69 \begin{equation*}
70 \unionmany{k=1}{\infty}{A_{k}} = \intersectmany{k=1}{\infty}{B_{k}}
71 \end{equation*}
72 \end{section}
73
74 \begin{section}{Cone}
75 The dual cone of $K$ is $\dual{K}$. Some familiar symmetric cones
76 are $\Rnplus$, $\Lnplus$, $\Snplus$, and $\Hnplus$. If cones
77 $K_{1}$ and $K_{2}$ are given, we can define $\posops{K_{1}}$,
78 $\posops[K_{2}]{K_{1}}$, $\Sof{K_{1}}$, $\Zof{K_{1}}$,
79 $\LL{K_{1}}$, and $\lyapunovrank{K_{1}}$. We can also define $x
80 \gecone_{K} y$, $x \gtcone_{K} y$, $x \lecone_{K} y$, and $x
81 \ltcone_{K} y$ with respect to a cone $K$.
82 \end{section}
83
84 \begin{section}{Convex}
85 The conic hull of a set $X$ is $\cone{X}$; its affine hull is
86 $\aff{X}$, and its convex hull is $\conv{X}$. If $K$ is a cone,
87 then its lineality space is $\linspace{K}$, its lineality is
88 $\lin{K}$, and its extreme directions are $\Ext{K}$.
89 \end{section}
90
91 \begin{section}{Font}
92 We can write things like Carathéodory and Güler and $\mathbb{R}$.
93 \end{section}
94
95 \begin{section}{Linear algebra}
96 The absolute value of $x$ is $\abs{x}$, or its norm is
97 $\norm{x}$. The inner product of $x$ and $y$ is $\ip{x}{y}$ and
98 their tensor product is $\tp{x}{y}$. The Kronecker product of
99 matrices $A$ and $B$ is $\kp{A}{B}$. The adjoint of the operator
100 $L$ is $\adjoint{L}$, or if it's a matrix, then its transpose is
101 $\transpose{L}$. Its trace is $\trace{L}$.
102
103 The span of a set $X$ is $\spanof{X}$, and its codimension is
104 $\codim{X}$. The projection of $X$ onto $V$ is $\proj{V}{X}$. The
105 automorphism group of $X$ is $\Aut{X}$, and its Lie algebra is
106 $\Lie{X}$. We can write a column vector $x \coloneqq
107 \colvec{x_{1},x_{2},x_{3},x_{4}}$ and turn it into a $2 \times 2$
108 matrix with $\matricize{x}$. To recover the vector, we use
109 $\vectorize{\matricize{x}}$.
110
111 The set of all bounded linear operators from $V$ to $W$ is
112 $\boundedops[W]{V}$. If $W = V$, then we write $\boundedops{V}$
113 instead.
114
115 The direct sum of $V$ and $W$ is $\directsum{V}{W}$, of course,
116 but what if $W = V^{\perp}$? Then we wish to indicate that fact by
117 writing $\directsumperp{V}{W}$. That operator should survive a
118 display equation, too, and the weight of the circle should match
119 that of the usual direct sum operator.
120 %
121 \begin{align*}
122 Z = \directsumperp{V}{W}\\
123 \oplus \oplusperp \oplus \oplusperp
124 \end{align*}
125 %
126 Its form should also survive in different font sizes...
127 \Large
128 \begin{align*}
129 Z = \directsumperp{V}{W}\\
130 \oplus \oplusperp \oplus \oplusperp
131 \end{align*}
132 \Huge
133 \begin{align*}
134 Z = \directsumperp{V}{W}\\
135 \oplus \oplusperp \oplus \oplusperp
136 \end{align*}
137 \normalsize
138 \end{section}
139
140 \begin{section}{Listing}
141 Here's an interactive sage prompt:
142
143 \begin{tcblisting}{listing only,
144 colback=codebg,
145 coltext=codefg,
146 listing options={language=sage,style=sage}}
147 sage: K = Cone([ (1,0), (0,1) ])
148 sage: K.positive_operator_gens()
149 [
150 [1 0] [0 1] [0 0] [0 0]
151 [0 0], [0 0], [1 0], [0 1]
152 ]
153 \end{tcblisting}
154 \end{section}
155
156 \begin{section}{Miscellaneous}
157 The cardinality of the set $X \coloneqq \set{1,2,3}$ is $\card{X}
158 = 3$.
159 \end{section}
160
161 \begin{section}{Proof by cases}
162
163 \begin{proposition}
164 There are two cases in the following proof.
165
166 \begin{proof}
167 The result should be self-evident once we have considered the
168 following two cases.
169 \begin{pcases}
170 \begin{case}[first case]
171 Nothing happens in the first case.
172 \end{case}
173 \begin{case}[second case]
174 The same thing happens in the second case.
175 \end{case}
176 \end{pcases}
177
178 You see?
179 \end{proof}
180 \end{proposition}
181
182 Here's another one.
183
184 \renewcommand{\baselinestretch}{2}
185 \begin{proposition}
186 Cases should display intelligently even when the document is
187 double-spaced.
188
189 \begin{proof}
190 Here we go again.
191
192 \begin{pcases}
193 \begin{case}[first case]
194 Nothing happens in the first case.
195 \end{case}
196 \begin{case}[second case]
197 The same thing happens in the second case.
198 \end{case}
199 \end{pcases}
200
201 Now it's over.
202 \end{proof}
203 \end{proposition}
204 \renewcommand{\baselinestretch}{1}
205 \end{section}
206
207 \begin{section}{Theorems}
208 \begin{corollary}
209 The
210 \end{corollary}
211
212 \begin{lemma}
213 quick
214 \end{lemma}
215
216 \begin{proposition}
217 brown
218 \end{proposition}
219
220 \begin{theorem}
221 fox
222 \end{theorem}
223
224 \begin{definition}
225 quod
226 \end{definition}
227
228 \begin{example}
229 erat
230 \end{example}
231
232 \begin{remark}
233 demonstradum.
234 \end{remark}
235 \end{section}
236
237 \begin{section}{Theorems (starred)}
238 \begin{corollary*}
239 The
240 \end{corollary*}
241
242 \begin{lemma*}
243 quick
244 \end{lemma*}
245
246 \begin{proposition*}
247 brown
248 \end{proposition*}
249
250 \begin{theorem*}
251 fox
252 \end{theorem*}
253
254 \begin{definition*}
255 quod
256 \end{definition*}
257
258 \begin{example*}
259 erat
260 \end{example*}
261
262 \begin{remark*}
263 demonstradum.
264 \end{remark*}
265 \end{section}
266
267 \begin{section}{Topology}
268 The interior of a set $X$ is $\interior{X}$. Its closure is
269 $\closure{X}$ and its boundary is $\boundary{X}$.
270 \end{section}
271
272 \end{document}