Debian Codegraph @

texmf-dist/doc/latex/onepgnote/onepgnote-example.tex

raw
1 % two columns generally contains more content than 1 col, despite the small gap
2 % in the middle, because line breaks, and unfull lines cost less here.
3 \documentclass[a4paper,twocolumn,enumboxcolor=cyan!50,10pt]{onepgnote}
4
5 \usepackage{amsmath,amssymb}
6 \usepackage{physics}
7
8 \usepackage[margin=10pt]{geometry}
9
10
11 \begin{document}
12 \pagestyle{empty}
13 \section{Basics}
14 \subsection{Index Notation}
15 \begin{enumerate}
16 \item
17 Whenever a quantity is summed over an index which appears exactly twice
18 in each term in the sum, we leave out the summation sign. Such an index
19 is called a \emph{dummy index}.
20 \item
21 An index appearing only once is called a \emph{free index}.
22 \item
23 No index may appear three times in a term. But one index can appear
24 multiple times in an equation. A term is the basic unit in index
25 notation.
26 \end{enumerate}
27 For example,
28 \[
29 x_{ik}y_{jk} + a_{ik}b_{ik} = a_i + b_j \quad \hbox{means} \quad \sum_k
30 x_{ik}y_{jk} + \sum_{k}a_{ik}b_{ik} =
31 a_i + b_j
32 \]
33
34 \subsection{Definitions}
35 The \emph{Kronecker delta} $\delta_{ij} := 1$ iff $i=j$ else $0$.
36
37 We define the \emph{Levi-Civita symbol} $\varepsilon_{ijk}$ for $1 \le i,j,k \le
38 3$ to be
39 \begin{enumerate}
40 \item
41 $0$ iff $(i,j,k)$ is not a permutation of $(1,2,3)$.
42 \item
43 $1$ iff $(i,j,k) \in \{(1,2,3),\allowbreak (2,3,1),\allowbreak (3,1,2)\}$.
44 \item
45 $-1$ iff $(i,j,k) \in \{(1,3,2),\allowbreak (2,1,3),\allowbreak (3,2,1)\}$.
46 \end{enumerate}
47 That is, $\varepsilon_{ijk}$ equals to the parity of the permutation $(1,2,3)
48 \to (i,j,k)$. Similarly, in 2D, $\varepsilon_{ij}$ is $1$ whenever $(i,j) =
49 (1,2)$, $-1$ when $(i,j) = (2,1)$, and $0$ otherwise.
50
51 \begin{enumerate}
52 \item
53 The \emph{double dot product} is $\vb{A} : \vb{B} :=
54 \sum_{i}\sum_{j}A_{ij}B_{ij}$ \label{doubledot}.
55 \item
56 When one operand of the dot product is a matrix, it is interpreted as
57 matrix multiplication.
58 \item
59 If we apply gradiant to a vector-valued function $\vb{f}(\vb{x})$, then
60 we are putting the gradiant of each component of it into a column of the
61 result matrix: $\nabla \vb{f} := [(\nabla f_1)^T, \dots, (\nabla
62 f_n)^T]$ \label{gradvec}.
63 \end{enumerate}
64
65 \begin{enumerate}
66 \item
67 The \emph{divergence} of $\vb{P}$, $\nabla \cdot \vb{P} :=
68 \sum_{i}\pdv{P_i}{x_i}$, as if $\nabla = (\pdv{}{x_1},\allowbreak
69 \dots,\allowbreak \pdv{}{x_n})$. It represents the source/sink of a $\vb{v}$
70 field. \mynote Distinguish $\nabla \cdot \vb{P}$ vs $\nabla \vb{P}$
71 \ref{gradvec}!
72 \item
73 The \emph{Laplace operator (Laplacian)} is defined as the divergence of
74 the gradiant of function $f$, $\nabla^2 f := \nabla \cdot \nabla f$.
75 Rarely, we may use $\Delta$ for it.
76 \item
77 The \emph{curl} of $\vb{P}$ is defined as $\nabla \times \vb{P} =
78 (\pdv{v_3}{x_2} - \pdv{v_2}{x_3}, -(\pdv{v_3}{x_1} - \pdv{v_1}{x_3}),
79 \pdv{v_2}{x_1} - \pdv{v_1}{x_2})$. It represents the vorticity of a
80 $\vb{v}$ field.
81 \end{enumerate}
82
83 \subsection{Facts}
84 \begin{enumerate}
85 \item
86 The area of a parallellogram equals $|\vb{a} \times \vb{b}|$.
87 \item
88 The volume of a
89 parallelpiped equals $|\vb{a} \cdot (\vb{b} \times \vb{c})| = \det(\vb{a},
90 \vb{b}, \vb{c})$.
91 \item
92 $\vb{a} \times \vb{b} =
93 \varepsilon_{ijk}\vb{e}_ia_jb_k$.
94 \item
95 $\varepsilon_{ijk}\varepsilon_{imn} = \delta_{jm}\delta_{kn} -
96 \delta_{jn}\delta_{km}$.
97 \end{enumerate}
98
99 \section{Change of basis}
100 For vectors and matrices.
101
102 \subsection{For vectors}
103 Let $U$ be a finite $n$-dimensional vector space over field $F$. Let
104 $(\vb{u}_i)_{i=1}^n$ and $(\vb{v}_i)_{i=1}^n$ be two ordered bases of $U$. Let
105 $\vb{x}$ be any vector in $U$. Then, there exists two unique
106 scalar sequences $(a_i)_{i=1}^n$ and $(b_i)_{i=1}^n$ such that $\sum_{i=1}^n
107 a_i\vb{u}_i = \sum_{i=1}^n b_i\vb{v}_i$. They are also vectors in their own, in
108 the vector space $F^n$. We want to find the change of basis function $T:
109 (a_i)_{i=1}^n \mapsto (b_i)_{i=1}^n$, which exists since $(\vb{v}_i)_{i=1}^n$ is
110 a basis.
111
112 $T$ may be broken down into $T = f \circ g$ where $g((a_i)_{i=1}^n) :=
113 a_i\vb{u}_i$, and $f(\vb{x} \in U) := (b_i)_{i=1}^n$ such that $b_i\vb{v}_i =
114 \vb{x}$. It is clear that both $f$ and $g$ are linear, and thus $T$ is a linear
115 function $F^n \to F^n$.
116
117 We then seek its unique matrix representation under the standard basis
118 $(\vb{e}_i)_{i=1}^n$ of $F^n$: $[T] = [T(\vb{e}_1)^T, \cdots, T(\vb{e}_n)^T]$.
119
120 \mynote When $U = F^n$ and if we happen to use
121 the standard basis of $F^n$, then $\vb{x}$ will appear
122 exactly the same as $(a_i)_{i=1}^n$, which can be extremely confusing. We must
123 constantly remind ourselves that $T$ operates on the coordinate vectors and not
124 directly on $\vb{x}$, which is the same vector regardless of the basis used to
125 represent it as coordinates.
126
127 \subsubsection{Change back} Since $(\vb{u}_i)_{i=1}^n$ is a basis (it
128 spans $U$ and each $(a_i)_{i=1}^n$ is unique), $T$ is invertible. Then,
129 indeed, the function $T^{-1}$ will be the change-back funcstion. As another way,
130 one may swap the places of $(\vb{u}_i)$ and $(\vb{v}_i)$ in the above
131 discussion.
132
133 \subsection{For matrices}
134 Let $f$ be a linear function $U \to U$. Under any basis $B =
135 (\vb{u}_i)_{i=1}^n$, $f$ has a unique matrix representation $[f]_{B}$. It is
136 interesting to us how the matrix changes when we use another basis $B' =
137 (\vb{v}_i)_{i=1}^n$ as the coordinate frame to get $[f]_{B'}$.
138
139 Let
140 $\vb{x} \in U$ be any vector, and denote $f(\vb{x}) =: y$. Let $(a_i)_{i=1}^n$
141 be the coordinates of $\vb{x}$ under basis $B$, $(b_i)_{i=1}^n$ be the
142 coordinates of $\vb{y}$ under $B$, and $(a'_i)_{i=1}^n, (b'_i)_{i=1}^n$ be the
143 coordinates for them under $B'$. Now, consider the change-of-basis function $T$
144 changing the coordinate frame under $B$ to $B'$, then, since $f$ and
145 $\vb{x}$ don't change for the basis, we should have
146 \[
147 [f]_{B}T^{-1}(a'_i)_{i=1}^n = T^{-1}(b'_i)_{i=1}^n \quad \to \quad
148 T[f]_{B}T^{-1}(a'_i)_{i=1}^n = (b'_i)_{i=1}^n
149 \]
150 Thus $[f]_{B'} = T[f]_{B}T^{-1}$. \mynote If we are talking about orthognormal
151 bases, then $T$ will be an orthognormal matrix, resulting in $T^{-1} = T^T$.
152
153 \subsection{Invariants}
154 Formally, we define an \emph{invariant} to be any function on such matrices such
155 that $f(M) = f(TMT^{-1})$ for all applicable matrices $M, T$. Three frequent
156 invariants are
157 \begin{enumerate}
158 \item $\trace M$ \item $\det M$ \item $
159 M_{11}M_{22} + M_{22}M_{33} + M_{11}M_{33}
160 - M^2_{12} - M^2_{23} - M^2_{31}$.
161 \end{enumerate}
162
163 \section{Stress}
164 Stress describes the forces present during the deformation of a material.
165 It expresses the internal forces that neighbouring particles of
166 a continuous material exert on each other.
167
168 \subsection{Cauchy stress tensor}
169 Cauchy observed that the stress vector across a surface will always be a linear
170 function of the surface's normal vector. The matrix for this function (under
171 a fixed basis) can be treated as a tensor and called the Cauchy stress
172 tensor.
173
174 For whatever reason, people chose to call the value of the Cauchy stress tensor
175 function a \emph{traction vector}, and use stress to refer to the matrix
176 (tensor) of the function. \mynote In practice we assume the function takes
177 normalized normals.
178
179 Under the standard basis, by the principle of conservation of angular momentum,
180 the matrix can be shown to be symmetric \label{stresssym}. Thus, the traction
181 vector can be computed by either $[\sigma]\vb{n}$ or $[\sigma]^T\vb{n}$. In the
182 lecture the second way is used.
183
184 \subsection{Normal \& shear tractions}
185 For a traction vector, one can divide it into two components,
186 \begin{enumerate}
187 \item
188 \emph{Normal traction}, which is parallel to the surface normal $\vb{n}$,
189 \item
190 \emph{Shear traction}, which is perpendicular to the normal $\vb{n}$.
191 \end{enumerate}
192 One can easily calculate the normal traction $\vb{t}_n = (\vb{t} \cdot \vb{n})
193 \vb{n}$. Then, the shear traction is $\vb{t}_s = \vb{t} - \vb{t}_n$.
194 \mynote We may abuse notation sometimes to refer to the magnitude of the
195 traction as traction. \mynote We also define the change in angle between two
196 normalized vectors under a stress tensor $\sigma$ to be (by symmetry),
197 $2\vb{v}_1[\sigma]\vb{v}_2^T = 2\vb{v}_2[\sigma]\vb{v}_1^T$.
198
199 \subsection{Infinitesimal strain}
200 The infinitesimal strain theory is an idealized theory in which one can arrive
201 at simple formulae for deformation. Under this, the spatial and material
202 coordinates are approximately the same, and we have the infinitesimal
203 displacement/strain tensor $\epsilon = 1/2 ((\nabla_{\vb{x}} \vb{u})^T +
204 \nabla_{\vb{x}} \vb{u})$ \label{inften1} and the infinitesimal rotation tensor
205 $\omega = 1/2(\nabla_{\vb{x}} \vb{u} - (\nabla_{\vb{x}} \vb{u})^T)$, where
206 $\vb{u}(\vb{x}, \dots)$ is the displacement vector field, and
207 $\nabla_{\vb{x}}\vb{u} = [(\nabla_{\vb{x}} u_1)^T, \cdots, (\nabla_{\vb{x}}
208 u_n)^T]$ \ref{gradvec}.
209
210 About $\epsilon$, an original location vector $\vb{x}$'s deformation will be
211 described by it in such a way that $\vb{x}' = \epsilon \vb{x}$. We have
212 \begin{enumerate}
213 \item
214 The diagonal elements of $\epsilon$ represent fractional length changes.
215 E.g., if $\vb{x} \parallel \vb{e}_1$, then $\epsilon_{11} = (|\vb{x}'| -
216 |\vb{x}|)/|\vb{x}|)$.
217 \item
218 Thus, $\trace \epsilon = \nabla \cdot \vb{u}$ is the fractional change in volume.
219 \item
220 Off-diagonal elements represent changes in angle. This is because, the
221 angle, for unit vectors, is $\arccos$ of $\vb{x} \cdot \vb{x}' =
222 \vb{x}\cdot(\epsilon \vb{x}) = \vb{x}\epsilon\vb{x}^T$.
223 \item
224 As such, $2\epsilon_{ij}, i\ne j$ is the change in angle between
225 $\vb{e}_i$ and $\vb{e}_j$ after the deformation. Also, given $\vb{p}
226 \perp \vb{q}$, $2\vb{q}\epsilon\vb{p}^T$ is the change in angle between
227 them.
228 \end{enumerate}
229
230 \section{Material vs spatial}
231 Suppose we are interested in some physical property $\vb{P}$ of some material in
232 space.
233 \begin{enumerate}
234 \item
235 In material (Lagrangian) specification, the observer's eyes follows a
236 particular particle, and the property is a function of the particle's
237 initial location $\xi$ and the time $t$: $\vb{P}(\xi, t)$.
238 \item
239 In spatial (Eulerian) specification, the observer does not follow any
240 particle but instead gives a global description of the space, resulting
241 in function $\vb{P}(\vb{x}, t)$, giving the property for the particle at
242 location $\vb{x}$ at time $t$.
243 \end{enumerate}
244
245 \subsection{Their link}
246 Suppose we are given a spatial description $\vb{P}(\vb{x}, t)$, and would like
247 to use this to follow a specific particle to give a material description to it.
248 Then, $\vb{x}$, for the particle, is a function: $\vb{x}(\xi, t)$, and $\vb{P}$
249 becomes $\vb{P}(\vb{x}(\xi, t), t)$. Specifically, if we want to find
250 $\pdv{\vb{P}}{t}$, then we need to use the chain rule to get
251 \[
252 \pdv{\vb{P}}{\vb{x}}\pdv{\vb{x}}{t} + \pdv{\vb{P}}{t}\pdv{t}{t} =
253 \pdv{\vb{P}}{\vb{x}}\vb{v}(\xi, t) + \pdv{\vb{P}}{t} =
254 \sum_{i}\pdv{\vb{P}}{x_i}v_i(\xi, t) + \pdv{\vb{P}}{t}
255 \]
256
257 \section{Equations}
258 \subsection{Terms}
259 \begin{enumerate}
260 \item \emph{Steady state} means everything is constant w.r.t.\ time $t$.
261 \item \emph{No flow} means velocity $\vb{v} = \vb{0}$.
262 \item \emph{No strain, stress} means the strain, stress tensors $\sigma,
263 \epsilon = \vb{0}$.
264 \end{enumerate}
265
266 \subsection{of mass}
267 For the conservation of mass,
268 \begin{enumerate}
269 \item
270 In spatial description, we have $\pdv{\rho}{t} + \nabla \cdot
271 (\rho\vb{v}) = 0$.
272 \item
273 In material description, it becomes $\frac{D\rho}{Dt} + \rho(\nabla \cdot
274 \vb{v}) = 0$.
275 \item If the material is incompressible, i.e., $\rho$ is constant, then the
276 equation is reduced to $\nabla \cdot \vb{v} = 0$.
277 \end{enumerate}
278
279 \subsection{of momentum}
280 \begin{enumerate}
281 \item
282 The conservation of angular momentum results in $\sigma$'s being
283 symmetric \ref{stresssym}.
284 \item
285 As for that of linear momentum \label{conlinmom}, we have
286 $
287 \rho\left(\pdv[2]{\vb{u}}{t} = \pdv{\vb{v}}{t}\right) =
288 \vb{f} + \nabla\cdot\sigma =
289 \sum_{i}\Big(f_i + \sum_j \pdv{\sigma_{ji}}{x_j}\Big).
290 $
291 \end{enumerate}
292
293 \subsection{of energy}
294 The general form of conservation of energy in the lecture is
295 $
296 \frac{D\rho C_pT}{Dt} = \nabla\cdot k(\nabla T) + A + \sigma:\vb{D}.
297 $
298 , where $:$ is \ref{doubledot} and the terms from the left to the right are
299 \begin{enumerate}
300 \item change in temperature with time
301 \item heat transfer by conduction (and radiation)
302 \item heat production (including latent heat)
303 \item heat generated by internal deformation.
304 \end{enumerate}
305
306 \subsection{Rheology}
307 We have $\hbox{rheology} \cdot \hbox{deformation}\ (\epsilon) = \hbox{stress}\
308 (\sigma)$.
309
310 \subsubsection{Elasticity}
311 \begin{enumerate}
312 \item
313 Elasticity means a material's deformation under a force will be restored
314 when the force is removed. Under perfect elasticity, Hook's law states
315 that the distance of deformation is proportional (linear) to the force
316 applied: $\sigma = C : \epsilon$ \ref{inften1}.
317 \item
318 Since it is linear, elasticity of a material is quantified by the \emph{elastic
319 modulus}, defined as $\delta :=
320 \frac{\hbox{stress}}{\hbox{strain}}$.
321 \item Young's modulus $E
322 := \frac{\sigma_{11}}{\epsilon_{11}}$c, and Poisson's ratio $\nu
323 := -\frac{\epsilon_{33}}{\epsilon_{11}}$.
324 \item
325 In homogeneous and isotropic materials, Lam\'e's constants
326 $\lambda, \mu$ define Hooke's law in 3D
327 $\sigma = 2\mu\epsilon + \lambda \trace (\epsilon) I_{3\times3}$.
328 \item
329 With the Bulk ($K$) and shear ($G$) modulus: $-p = K\theta$ (isotropic)
330 $\sigma'_{ij} = \frac{\sigma_{kk}}{3} = K \epsilon_{kk} = 2G\epsilon'_{ij}$
331 (deviatoric), where $\sigma_{ij} + p\delta_{ij} =: \sigma'_{ij}$. Thus, $K =
332 \lambda + 2\mu/3$, where the second RHS term is compressional and the third is
333 shear.
334 \item
335 In Newtonian, general compressible fluids, $\sigma = (-p+\zeta\Delta)\vb{I} +
336 2\eta\vb{D}$, where $D$ is the strain rate, $\Delta = D_{kk} = \nabla \cdot
337 \vb{v}$. We have the Navier-Stokes equation $ \nabla p + (\zeta + \eta) \nabla
338 \Delta + \eta \nabla^{2} \vb{v} + \vb{f} = \rho \frac{D\vb{v}}{Dt} = \rho
339 (\frac{\partial{\vb{v}}}{\partial{t}} + \vb{v} \cdot \nabla \vb{v}) $ If the
340 fluid is incompressible, then $\Delta = \nabla \cdot \vb{v} = 0$ and it's
341 simplified to $\sigma = -pI+2\eta D$, and we have the Navier-Stokes equation $
342 -\nabla p + \eta \nabla^{2} \vb{v} + \vb{f} = \rho
343 (\frac{\partial{\vb{v}}}{\partial{t}} + \vb{v} \cdot \nabla \vb{v}) $.
344 \end{enumerate}
345
346 \subsubsection{Wave equation} Substituting Lam\'e's constants formula into the
347 equation of conservation of linear momentum \ref{conlinmom}, we have
348 $
349 \rho\pdv[2]{\vb{u}}{t} = \vb{f} + (\lambda +
350 2\mu)\nabla(\nabla\cdot\vb{u})-\mu\nabla\times\nabla\times\vb{u}
351 $.
352
353 \section{Interpolation}
354 Let $(x_i, y_i)_{i=0}^{N}$ be $N+1$ data points. It can be shown that, provided
355 $\forall i,j, x_i \ne x_j$, $\{(x_i^n)_{n=0}^N\}_{i=0}^{N}$ is linearly
356 independent. Thus, the linear system $X\vb{a} = \vb{y}$, where $X$ has these
357 vectors as rows and $\vb{y} = (y_i)_{i=0}^N$, has a unique solution, $\vb{a} =
358 (a_n)_{n=0}^N$ which is the coefficient vector of the unique polynomial of
359 degree $N$ passing through them.
360
361 \subsection{Lagrange} Let $\mathcal{P}_N$ be the set of all polynomials of
362 degree $N$ or less. It is a $(N+1)$-dimensional vector space. Lagrange found a basis
363 $\{\ell_i(x)\}_{i=0}^N$, where $\ell_i(x) := \prod_{m \ne
364 i}\frac{x-x_m}{x_i-x_m}$, and showed that $L(x) := \sum_{i=0}^Ny_i\ell_i(x)$ is
365 the unique interpolating polynomial.
366
367 \subsubsection{Remainder} Lagrange proved that, for any $f \in C^{N+1}[a,b]$,
368 and datapoints $(x_i, y_i)_{i=0}^N$ that $f$ passes through, the unique
369 interpolation polynomial $P_N(x)$ results in a remainder, $R(x) := f(x) -
370 P_N(x)$, satisfying $\forall x \in [a,b],\ \exists c \in [a,b],\ R(x) =
371 \Psi(x)f^{N+1}(c)/\allowbreak (N+1)!$, where $\Psi(x) := \prod_{i=0}^N(x-x_i)$.
372 \mynote Thus, $\Psi(x) \cdot\allowbreak \max(f^{N+1}(c))/\allowbreak (N+1)!$ is an upper bound of
373 it.
374
375 \subsection{Variants} Observe that $\Psi(x)$ is much larger around $a$ or $b$
376 for evenly spaced datapoints. This, plus potentially large $f^{N+1}(c)$, gives
377 very unstable results near the boundary.
378 \begin{enumerate}
379 \item
380 Usually the choice of $x_i$ is the only thing we can control. Lanczos found that
381 $\max_{x_i \in [-1,1]}\Psi(x)$ attains the minimum when $x_i$ are the roots of
382 the Chebyshev polynomial $T_{N+1}(x)$, $x_i = \cos(\frac{2i-1}{2N}\pi)$.
383 \item
384 We may also interpolate $f$ piecewise to decrease the error, although it will
385 make the interpolation function lose some smoothness.
386 \end{enumerate}
387
388 \section{Quadrature}
389 \begin{enumerate}
390 \item
391 Midpoint $I_M := \sum_{i=0}^{n-1}\discretionary{}{}{} f \left ( \frac
392 {x_{i+1}+x_i} {2} \right )\discretionary{}{}{} (x_{i+1}-x_i)$.
393 \item
394 Trapezoidal $\sum_{i=0}^{n-1}\discretionary{}{}{} \left(\frac{f(x_{i+1}) +
395 f(x_{i})}{2}\right )\discretionary{}{}{} (x_{i+1}-x_i)$.
396 \item
397 Simpson's $I_S := \frac{2}{3}I_M + \frac{1}{3}I_T =
398 \sum_i \frac{(x_{i+1}-x_i)}{6}(f(x_i)+4f(m)+f(x_{i+1}))$.
399 \item
400 Weddle's $I_W = I_{S_2} + \frac {\left (I_{S_2} - I_S \right
401 )}{15}$, where $I_{S_2}$ is Simpson's applied on double amount
402 of intervals.
403 \item Composite trapezoidal $\frac{\Delta
404 x}{2}[f(x_0) + 2f(x_1) + \dots + 2f(x_{n-1}) + f(x_n)]$.
405 \item Composite Simpson's $\frac{\Delta x}{3}\left[ f \left ( x_0\right ) +
406 2\sum_{i=1}^{n/2 - 1} f\left(x_{2i}\right) + 4\sum_{i=1}^{n/2}
407 f\left(x_{2i-1}\right) + f \left ( x_{n}\right ) \right]$.
408 \end{enumerate} \mynote Composite Simpson actually uses 2 intervals as one, and
409 the middle point is thus some $x_i$.
410
411 \subsection{Error} All these rules can be regarded as doing piecewise polynomial
412 interpolation on $f$ on evenly spaced datapoints, integrating $f$ minus the
413 polynomial, summing over the intervals, and using the Lagrange remainder to find
414 the error. We may find
415 \begin{enumerate}
416 \item
417 Trapezoidal: $-\frac{1}{12} \Delta x^2 (b-a) \frac{1}{n}
418 \sum_{i=0}^{n-1}\, f''\left(c_{x_i}\right)$
419 \item
420 Midpoint: $\frac{1}{24} \Delta x^2 (b-a) \frac{1}{n} \sum_{i=0}^{n-1}\,
421 f''\left(c_{x_i}\right)$.
422 \item
423 Simpson's: since the error $I-I_T \approx -2(I-I_M)$, we imagine there's
424 a better approximation $I_S$ such that $I_S - I_T = -2(I-I_M)$, giving
425 $I_S = \frac{2}{3}I_M + \frac{1}{3}I_T$. We have error $-\frac{\Delta
426 x^4}{180} (b-a)f^{(4)}\left(c_x\right)$.
427 \item
428 Weddle's: it would be a fuss to derive the exact one but it should be
429 proportional to $\Delta x^6$.
430 \end{enumerate}
431
432 \section{ODE} To approximately solve (satisfying convergence as $\Delta t \to 0$
433 and correct qualitative behaviour) $y'(t) = f(t, y(t))$, we have
434 \begin{enumerate}
435 \item
436 By the definition of derivative or the Taylor series, we have $y_{n+1} \approx
437 y_{n} + \Delta t y'(t_n)$. This the the forward Euler.
438 \item
439 By the definition of derivative, we may also say $y_{n+1} \approx y_n + \Delta t
440 y'(t_{n+1})$, which is the backward Euler.
441 \item
442 We may also say $y'(t_n) \approx \frac{y_{n+1}-y_{n-1}}{2\Delta t}$ and as such
443 $y_{n+1} \approx y_{n-1} + 2\Delta t y'(t_n)$, which is leapfrog.
444 \item
445 Recall the trapezoidal rule before, we may use it here to average the forward
446 and backward Euler to obtain $y_{n+1} \approx y_{n} + \Delta t\frac{y'(t_n) +
447 y'(t_{n+1})}{2}$.
448 \end{enumerate}
449
450 \subsection{Error}
451 \begin{enumerate}
452 \item The \emph{local error (LE)} is error committed at one step, assuming
453 the previous step $y_{n}$ is exact. Thus it is $y_{n+1} -
454 y_{n+1}'$.
455 \item For example, using Taylor series, forward Euler has local error
456 $(\frac{\Delta t^2}{2!}y''_n + \dots)$.
457 \item The \emph{(local) truncation error (LTE)}, $\tau$, is defined by
458 the local error scaled down: $\tau := LE / (\Delta t)$.
459 \item A method is \emph{consistent} if $\lim_{\Delta t \to 0}\tau
460 = 0$.
461 \item The \emph{global error} is $E := \max_{t_0 \, \le \, t_n \, \le \, T}\|
462 y_{n} - y(t_{n})\|$, only assuming the inital $y_0$ is exact.
463 \item A method \emph{converges} iff $\lim_{\Delta t \to 0} E = 0$.
464 \end{enumerate}
465
466 \subsection{Stability}
467 Stability in numerical methods of solving ODEs have different definitions, but
468 in general we would want the numerial methods to exhibit the same important
469 properties as the exact solution. We have
470 \begin{enumerate}
471 \item
472 A numerical method is said to be \emph{A-stable}, if, when applied to
473 the reference equation $y'=ky \land y(0) = 1$ for $k \in \mathbf{C}$,
474 demonstrates that, provided $\real(k) < 0$, $\lim_{t
475 \to \infty} \hbox{solution} \to 0$, the same property from the exact
476 solution $y(t) = e^{kt}$.
477
478 \item
479 A numerical method is \emph{L-stable}, if it is A-stable, and that its
480 stability function $\phi(x) \to 0$ as $z \to \infty$.
481 \end{enumerate}
482
483 \subsection{Adams-Bashforth}
484 For general ODE of form $y'(t) = f(y(t), t)$, according to the fundamental
485 theorem of calculus, $y_{n+1} - y_n = \int_{t_n}^{t_{n+1}}f(y(t),t) \dd{t}$.
486
487 The A-B schemes uses combinations of $f_{i}$ for $k$ many $i$'s with $i \ne n+1$
488 to approximate the RHS integral to numerically solve the ODE. We have these AB
489 schemes:
490 \begin{enumerate}
491 \item $k=0$-step: $y_{n+1} = y_n + \Delta t f_n$.
492 \item $k=1$-step: $y_{n+1} = y_{n} +\frac{\Delta t}{2}\; (f_{n} +
493 f_{n+1})$.
494 \item $k=2$-step: $y_{n+2} = y_{n+1} + \frac{\Delta t}{12}\; (-f_{n} +
495 8 f_{n+1} + 5f_{n+2})$.
496 \item $k=3$-step: $y_{n+3} = y_{n+2} + \frac{\Delta t}{24}\; (f_{n} - 5
497 f_{n+1} + 19 f_{n+2} + 9 f_{n+3})$.
498 \item $k=4$-step: $y_{n+4} = y_{n+3} + \frac{\Delta t}{720}\; (-19
499 f_{n} + 106 f_{n+1} - 264 f_{n+2} + 646 f_{n+3} + 251 f_{n+4})$
500 \end{enumerate}
501
502 \subsection{Runge-Kutta}
503 Similar to the trapezoidal method, we have $y_{n+1} - y_n \approx
504 \frac{1}{2}\allowbreak\Delta t\allowbreak(y'_n + y'_{n+1})$. However, here, $y'_{n+1} =
505 f(y_{n+1},\allowbreak t_{n+1})$, where $y_{n+1}$ is not known.
506
507 In Runge-Kutta 2-step (RK2),
508 we first use forward Euler to get $y^* \approx y_{n+1}$, then use this to
509 calculate the RHS, and finally gives an approximation to $y_{n+1}$ again.
510 Perhaps surprisingly, RK2 is better in many ways than forward Euler.
511 Specifically, it is L-stable.
512
513 But the most common one is RK4, which has $y_{n+1} = y_n +
514 \frac{h}{6}\cdot\allowbreak\left(k_1 + 2k_2 + 2k_3 + k_4 \right)$, where $h$ is
515 the step size, and
516 \begin{enumerate}
517 \item
518 $k_1 = \ f(t_n,\allowbreak y_n)$
519 \item
520 $k_2 = \ f\!\left(t_n + \frac{h}{2},\allowbreak y_n + h \frac{k_1}{2}\right)$
521 \item
522 $k_3 = \ f\!\left(t_n + \frac{h}{2},\allowbreak y_n + h \frac{k_2}{2}\right)$
523 \item
524 $k_4 = \ f\!\left(t_n + h,\allowbreak y_n + h k_3\right)$
525 \end{enumerate}.
526
527 \end{document}