more
[lectures/latex.git] / computational_physics / cp.tex
1 \documentclass[pdf]{prosper}
2
3 \usepackage{verbatim}
4 \usepackage[german]{babel}
5 \usepackage[latin1]{inputenc}
6 \usepackage[T1]{fontenc}
7 \usepackage{amsmath}
8 \usepackage{ae}
9 \usepackage{aecompl}
10 \usepackage{color}
11 \usepackage{graphicx}
12 \graphicspath{{./img/}}
13 \usepackage{hyperref}
14
15 \title{introduction to computational physics}
16 \subtitle{basic concepts and approaches}
17 \author{frank zirkelbach}
18 \email{frank.zirkelbach@physik.uni-augsburg.de}
19 \institution{experimantal physics {\footnotesize IV} - university of augsburg}
20
21 \begin{document}
22
23 \maketitle
24
25 \overlays{5}{
26 \begin{slide}{outline}
27 \begin{itemstep}
28   \item motivation
29   \item history of computing hardware/software
30   \item warning
31   \item computational techniques
32   \item summary
33 \end{itemstep}
34 \end{slide}}
35
36 \overlays{4}{
37 \begin{slide}{motivation}
38 \FromSlide{1}{
39   \begin{center}
40   \begin{figure}[h]
41   \includegraphics[width=8cm]{cp_appl_field.eps}
42   \end{figure}
43   \end{center}
44 }
45 \FromSlide{2}{
46 challenge:
47 }
48 \FromSlide{3}{
49 \begin{itemize}
50   \item precise mathematical theory
51   \item often: solving theory's equations ab-initio is not realistic
52   \item only a few models can be solved exactly
53 \end{itemize}}
54 \FromSlide{4}{
55 $\Rightarrow$ study and implementation of numerical algorithms
56 }
57 \end{slide}}
58
59 \overlays{5}{
60 \begin{slide}{history of computing hardware}
61   \begin{minipage}[t]{10cm}
62      \onlySlide*{1}{\begin{center} \includegraphics[height=3cm]{abacus.eps} \end{center}}
63      \onlySlide*{2}{\begin{center} \includegraphics[height=3cm]{eniac.eps} \hspace{1cm} \includegraphics[height=3cm]{tube.eps} \end{center}}
64      \onlySlide*{3}{\begin{center} \includegraphics[height=3cm]{z1.eps} \end{center}}
65      \onlySlide*{4}{\begin{center} \includegraphics[height=3cm]{pdp1.eps} \hspace{1pt} \includegraphics[height=3cm]{transistor.eps} \end{center}}
66      \onlySlide*{5}{\begin{center} \includegraphics[height=3cm]{pdp8.eps} \hspace{1cm} \includegraphics[height=3cm]{ic.eps} \end{center}}
67      %\FromSlide{6}{\begin{center} \includegraphics[height=3cm]{} \end{center}}
68   \end{minipage}
69   \begin{minipage}[b]{10cm}
70     \begin{itemstep}
71       \item $3000 \, bc$: abacus - first calculating device
72       \item $1945$: eniac - electrical digital computer
73       \item $1938/41$: z1/3 - featuring memory and programmability
74       \item $1960$: pdp-1 - transistor based computers
75       \item $1964$: pdp-8 - integrated circuit computers
76     \end{itemstep}
77   \end{minipage}
78 \end{slide}}
79
80 \overlays{6}{
81 \begin{slide}{history of computing hardware}
82   \begin{minipage}[t]{10cm}
83      \onlySlide*{1}{\begin{center} \includegraphics[height=3cm]{4004.eps} \end{center}}
84      \onlySlide*{2}{\begin{center} \includegraphics[height=3cm]{cray2.eps} \hspace{1pt} \includegraphics[height=3cm]{cray2_i.eps} \end{center}}
85      \onlySlide*{3}{\begin{center} \includegraphics[height=3cm]{apple2.eps} \includegraphics[height=3cm]{c64.eps} \end{center}}
86      \onlySlide*{4}{\begin{center} \includegraphics[height=3cm]{intel1.eps} \includegraphics[height=3cm]{intel2.eps} \end{center}}
87      \onlySlide*{5}{\begin{center} \includegraphics[height=3cm]{mips.eps} \hspace{1pt} \includegraphics[height=3cm]{ppc.eps} \end{center}}
88      \onlySlide*{6}{\begin{center} \includegraphics[height=3cm]{cluster1.eps} \hspace{1cm} \includegraphics[height=3cm]{cluster2.eps} \end{center}}
89   \end{minipage}
90   \begin{minipage}[b]{10cm}
91     \begin{itemstep}
92       \item $1970$: intel 4004 - first single chip $\mu$-processor
93       \item $1977/85$: cray1/2 - vector supercomputer
94       \item $1977/82/85$: 6502/6510/m68k - first pc
95       \item $1978/82/85 $: 8086/80286/80386
96       \item $1985$: mips - first risc design
97       \item $1990/2000$: massive parallel computing
98     \end{itemstep}
99   \end{minipage}
100 \end{slide}}
101
102 \overlays{11}{
103 \begin{slide}{history of computing software}
104   \begin{itemstep}
105     \item $1946$: plankalk"ul - high-level programming language
106     \item $1950$: assembler - translating instruction mnemonics
107     \item $1954$: fortran - {\scriptsize formula translation}
108     \item $1963$: basic - {\scriptsize beginner's all purpose symbolic instruction code}
109     \item $1964$: os/360 - batch processing operating system
110     \item $1969$: unix - multics port to pdp-8, pdp-11/20
111     \item $1972$: c programming language - thompson, ritchie
112     \item $1978/84/85$: apple os/atari, amiga os/mac os
113     \item $1981/85/92/95$: ms-dos/windows 1.0/3.x/95
114     \item $1983$: gnu project - unix-like free software development
115     \item $1991$: linux - open-source kernel
116   \end{itemstep}
117 \end{slide}}
118
119 \overlays{4}{
120 \begin{slide}{warning - machine accuracy $\epsilon_m$}
121   \begin{itemstep}
122     \item numerical precision of 64-bit floating point \\
123           ieee floating point format: $v = -1^s 2^{-e} m$ 
124           \[
125           \begin{array}{lll}
126           s: & \textrm{signe} & \textrm{1 bit} \\
127           m: & \textrm{mantissa} & \textrm{52 bit} \\
128           e: & \textrm{exponent} & \textrm{11 bit} \\
129           \end{array}
130           \]
131     \item $\epsilon_m$: smallest floating point with $1 + \epsilon_m \neq 1$ \\
132           $\epsilon_m \approx 2 \times 10^{-18}$ \hspace{2pt} (roundoff error)
133     \item $N$ arithmetic operations $\Rightarrow$ error of order $N \epsilon_m$
134     \item subtraction of very nearly equal numbers\\
135           (difference in few significant low-order bits)
136   \end{itemstep}
137 \end{slide}}
138
139 \overlays{6}{
140 \begin{slide}{warning - truncation error}
141   \begin{itemstep}
142     \item discrete approximation of continuous quantity
143     \item truncation error $\equiv$ discrepancy between true answer and practical calculation
144     \item persists even on hypothetical perfect computer ($\epsilon_m = 0$)
145     \item machine independent, characteristic of used algorithm
146     \item numerical analysis: minimizing truncation error
147     \item unstable method: roundoff error interacting at early stage
148   \end{itemstep}
149 \end{slide}}
150
151 \overlays{4}{
152 \begin{slide}{warning - recursive functions}
153   \begin{itemstep}
154     \item avoid recursive functions!
155           \verbatiminput{fak1.c}
156     \item better:
157           \verbatiminput{fak2.c}
158   \end{itemstep}
159 \end{slide}}
160
161 \begin{slide}{computational techniques}
162 techniques discussed in the talk:
163 \begin{itemize}
164   \item rough discretization
165   \item solution of linear algebraic equations
166   \item interpolation and extrapolation
167   \item integration of functions
168   %\item evaluation of (special) functions
169   \item monte carlo methods
170   \item eigensystems
171   \item spectral applications
172   %\item modeling of data
173   %\item ordinary differential equations
174   %\item two point boundary value problems
175   %\item partial differential equations
176 \end{itemize}
177 \end{slide}
178
179 \begin{slide}{computational techniques}
180 techniques \textcolor{red}{not yet} discussed in the talk:\footnote{if time is available this will be completed. updates at:\\http://www.physik.uni-augsburg.de/\~{}zirkelfr/download/cp/cp.pdf\\read more at: http://www.nr.com}
181 \begin{itemize}
182   %\item rough discretization
183   %\item solution of linear algebraic equations
184   %\item interpolation and extrapolation
185   %\item integration of functions
186   \item evaluation of (special) functions
187   %\item monte carlo methods
188   %\item eigensystems
189   %\item spectral applications
190   \item modeling of data
191   \item ordinary differential equations
192   \item two point boundary value problems
193   \item partial differential equations
194 \end{itemize}
195 \hspace{6cm}
196 \end{slide}
197
198 \overlays{2}{
199 \begin{slide}{rough discretization}
200   \begin{itemstep}
201     \item example: homogenous field of force $\vec{F} = (0,-mg)$ \\
202           \begin{tabular}{ll}
203           equation of motion: & $\vec{F} = m \vec{a} = m \frac{d^2 \vec{r}}{dt^2}$ \\
204           initial condition: & $\vec{r}(t=0) = \vec{r_0} = (x_0,y_0)$ \\
205                              & $\frac{d \vec{r}}{dt}|_{t=0} = (v_{x_0},v_{y_0})$ \\
206           \end{tabular}
207     \item algorithm using discretized time ($T_{total} = N \tau$):
208           \begin{tabular}{lll}
209           $x^1 = x_0;$ & $y^1 = y_0;$ & \\
210           $v^1_x = v_{x_0};$ & $v^1_y = v_{y_0};$ & \\
211           loop: & $x^2 = x^1 + \tau v^1_x;$ & $y^2 = y^1 + \tau v^1_y;$ \\
212                 & $v^2_x = v^1_x;$ & $v^2_y = v^1_y + (-mg) \tau;$ \\
213                 & $x^1 = x^2;$ & $y^1 = y^2$ \\
214                 & $v^1_x = v^2_x;$ & $v^1_y = v^2_y;$ \\
215           \end{tabular}
216   \end{itemstep}
217 \end{slide}}
218
219 %\overlays{3}{
220 %\begin{slide}{}
221 %  \begin{itemstep}
222 %    \item 
223 %    \item 
224 %    \item
225 %  \end{itemstep}
226 %\end{slide}}
227
228 %\overlays{3}{
229 %\begin{slide}{}
230 %  \begin{itemstep}
231 %    \item 
232 %    \item 
233 %    \item
234 %  \end{itemstep}
235 %\end{slide}}
236
237 %\overlays{3}{
238 %\begin{slide}{}
239 %  \begin{itemstep}
240 %    \item 
241 %    \item 
242 %    \item
243 %  \end{itemstep}
244 %\end{slide}}
245
246 %\overlays{3}{
247 %\begin{slide}{}
248 %  \begin{itemstep}
249 %    \item 
250 %    \item 
251 %    \item
252 %  \end{itemstep}
253 %\end{slide}}
254
255 %\overlays{3}{
256 %\begin{slide}{}
257 %  \begin{itemstep}
258 %    \item 
259 %    \item 
260 %    \item
261 %  \end{itemstep}
262 %\end{slide}}
263
264 %\overlays{3}{
265 %\begin{slide}{}
266 %  \begin{itemstep}
267 %    \item 
268 %    \item 
269 %    \item
270 %  \end{itemstep}
271 %\end{slide}}
272
273 %\overlays{3}{
274 %\begin{slide}{}
275 %  \begin{itemstep}
276 %    \item 
277 %    \item 
278 %    \item
279 %  \end{itemstep}
280 %\end{slide}}
281
282 %\overlays{3}{
283 %\begin{slide}{}
284 %  \begin{itemstep}
285 %    \item 
286 %    \item 
287 %    \item
288 %  \end{itemstep}
289 %\end{slide}}
290
291 %\overlays{3}{
292 %\begin{slide}{}
293 %  \begin{itemstep}
294 %    \item 
295 %    \item 
296 %    \item
297 %  \end{itemstep}
298 %\end{slide}}
299
300 %\overlays{3}{
301 %\begin{slide}{}
302 %  \begin{itemstep}
303 %    \item 
304 %    \item 
305 %    \item
306 %  \end{itemstep}
307 %\end{slide}}
308
309 \end{document}