-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmath.tex
241 lines (178 loc) · 5.33 KB
/
math.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
\documentclass[20pt,a4paper]{extarticle}
\usepackage[a4paper,margin=6mm]{geometry}
\usepackage{amsmath}
\usepackage{hyperref}
\title{\LaTeX\ Mathematics Examples}
\author{Prof Tony Roberts}
\begin{document}
\maketitle
\tableofcontents
\section{Delimiters}
See how the delimiters are of reasonable size in these examples
\[
\left(a+b\right)\left[1-\frac{b}{a+b}\right]=a\,,
\]
\[
\sqrt{|xy|}\leq\left|\frac{x+y}{2}\right|,
\]
even when there is no matching delimiter
\[
\int_a^bu\frac{d^2v}{dx^2}\,dx
=\left.u\frac{dv}{dx}\right|_a^b
-\int_a^b\frac{du}{dx}\frac{dv}{dx}\,dx.
\]
\section{Spacing}
Differentials often need a bit of help with their spacing as in
\[
\iint xy^2\,dx\,dy
=\frac{1}{6}x^2y^3,
\]
whereas vector problems often lead to statements such as
\[
u=\frac{-y}{x^2+y^2}\,,\quad
v=\frac{x}{x^2+y^2}\,,\quad\text{and}\quad
w=0\,.
\]
Occasionally one gets horrible line breaks when using a list in mathematics such as listing the first twelve primes \(2,3,5,7,11,13,17,19,23,29,31,37\)\,.
In such cases, perhaps include \verb|\mathcode`\,="213B| inside the inline maths environment so that the list breaks: \(\mathcode`\,="213B 2,3,5,7,11,13,17,19,23,29,31,37\)\,.
Be discerning about when to do this as the spacing is different.
\section{Arrays}
Arrays of mathematics are typeset using one of the matrix environments as
in
\[
\begin{bmatrix}
1 & x & 0 \\
0 & 1 & -1
\end{bmatrix}\begin{bmatrix}
1 \\
y \\
1
\end{bmatrix}
=\begin{bmatrix}
1+xy \\
y-1
\end{bmatrix}.
\]
Case statements use cases:
\[
|x|=\begin{cases}
x, & \text{if }x\geq 0\,, \\
-x, & \text{if }x< 0\,.
\end{cases}
\]
Many arrays have lots of dots all over the place as in
\[
\begin{matrix}
-2 & 1 & 0 & 0 & \cdots & 0 \\
1 & -2 & 1 & 0 & \cdots & 0 \\
0 & 1 & -2 & 1 & \cdots & 0 \\
0 & 0 & 1 & -2 & \ddots & \vdots \\
\vdots & \vdots & \vdots & \ddots & \ddots & 1 \\
0 & 0 & 0 & \cdots & 1 & -2
\end{matrix}
\]
\section{Equation arrays}
In the flow of a fluid film we may report
\begin{eqnarray}
u_\alpha & = & \epsilon^2 \kappa_{xxx}
\left( y-\frac{1}{2}y^2 \right),
\label{equ} \\
v & = & \epsilon^3 \kappa_{xxx} y\,,
\label{eqv} \\
p & = & \epsilon \kappa_{xx}\,.
\label{eqp}
\end{eqnarray}
Alternatively, the curl of a vector field $(u,v,w)$ may be written
with only one equation number:
\begin{eqnarray}
\omega_1 & = &
\frac{\partial w}{\partial y}-\frac{\partial v}{\partial z}\,,
\nonumber \\
\omega_2 & = &
\frac{\partial u}{\partial z}-\frac{\partial w}{\partial x}\,,
\label{eqcurl} \\
\omega_3 & = &
\frac{\partial v}{\partial x}-\frac{\partial u}{\partial y}\,.
\nonumber
\end{eqnarray}
Whereas a derivation may look like
\begin{eqnarray*}
(p\wedge q)\vee(p\wedge\neg q) & = & p\wedge(q\vee\neg q)
\quad\text{by distributive law} \\
& = & p\wedge T \quad\text{by excluded middle} \\
& = & p \quad\text{by identity}
\end{eqnarray*}
\section{Functions}
Observe that trigonometric and other elementary functions are typeset
properly, even to the extent of providing a thin space if followed by
a single letter argument:
\[
\exp(i\theta)=\cos\theta +i\sin\theta\,,\quad
\sinh(\log x)=\frac{1}{2}\left( x-\frac{1}{x} \right).
\]
With sub- and super-scripts placed properly on more complicated
functions,
\[
\lim_{q\to\infty}\|f(x)\|_q
=\max_{x}|f(x)|,
\]
and large operators, such as integrals and
\begin{eqnarray*}
e^x & = & \sum_{n=0}^\infty \frac{x^n}{n!}
\quad\text{where }n!=\prod_{i=1}^n i\,, \\
\overline{U_\alpha} & = & \bigcap_\alpha U_\alpha\,.
\end{eqnarray*}
In inline mathematics the scripts are correctly placed to the side in
order to conserve vertical space, as in
\(
1/(1-x)=\sum_{n=0}^\infty x^n.
\)
\section{Accents}
Mathematical accents are performed by a short command with one
argument, such as
\[
\tilde f(\omega)=\frac{1}{2\pi}
\int_{-\infty}^\infty f(x)e^{-i\omega x}\,dx\,,
\]
or
\[
\dot{\vec \omega}=\vec r\times\vec I\,.
\]
\section{Command definition}
\newcommand{\Ai}{\operatorname{Ai}}
The Airy function, $\Ai(x)$, may be incorrectly defined as this
integral
\[
\Ai(x)=\int\exp(s^3+isx)\,ds\,.
\]
\newcommand{\D}[2]{\frac{\partial #2}{\partial #1}}
\newcommand{\DD}[2]{\frac{\partial^2 #2}{\partial #1^2}}
\renewcommand{\vec}[1]{\boldsymbol{#1}}
This vector identity serves nicely to illustrate two of the new
commands:
\[
\vec\nabla\times\vec q
=\vec i\left(\D yw-\D zv\right)
+\vec j\left(\D zu-\D xw\right)
+\vec k\left(\D xv-\D yu\right).
\]
\section{Theorems et al.}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}
\begin{definition}[right-angled triangles] \label{def:tri}
A \emph{right-angled triangle} is a triangle whose sides of length~\(a\), \(b\) and~\(c\), in some permutation of order, satisfies \(a^2+b^2=c^2\).
\end{definition}
\begin{lemma}
The triangle with sides of length~\(3\), \(4\) and~\(5\) is right-angled.
\end{lemma}
This lemma follows from the Definition~\ref{def:tri} as \(3^2+4^2=9+16=25=5^2\).
\begin{theorem}[Pythagorean triplets] \label{thm:py}
Triangles with sides of length \(a=p^2-q^2\), \(b=2pq\) and \(c=p^2+q^2\) are right-angled triangles.
\end{theorem}
Prove this Theorem~\ref{thm:py} by the algebra \(a^2+b^2 =(p^2-q^2)^2+(2pq)^2
=p^4-2p^2q^2+q^4+4p^2q^2
=p^4+2p^2q^2+q^4
=(p^2+q^2)^2 =c^2\).
\end{document}