aboutsummaryrefslogtreecommitdiff
path: root/src/Lecture7/slides/X2-StudentsRequests.tex
diff options
context:
space:
mode:
Diffstat (limited to 'src/Lecture7/slides/X2-StudentsRequests.tex')
-rw-r--r--src/Lecture7/slides/X2-StudentsRequests.tex309
1 files changed, 309 insertions, 0 deletions
diff --git a/src/Lecture7/slides/X2-StudentsRequests.tex b/src/Lecture7/slides/X2-StudentsRequests.tex
new file mode 100644
index 0000000..787e7fb
--- /dev/null
+++ b/src/Lecture7/slides/X2-StudentsRequests.tex
@@ -0,0 +1,309 @@
1\documentclass[11pt]{beamer}
2\usetheme{Madrid}
3\usepackage[utf8]{inputenc}
4\usepackage{amsmath}
5
6\usepackage{svg}
7\usepackage{color}
8\usepackage{listings}
9\usepackage{mathtools}
10\usepackage{tikz-cd}
11\usepackage{adjustbox}
12
13\definecolor{myblue}{rgb}{0,0,0.5}
14\lstset{
15 language=Python,
16 tabsize=4,
17 basicstyle=\footnotesize,
18 keywordstyle=\bf\color{myblue},
19 commentstyle=\it\color{gray},
20 numbers=left,
21 numbersep=3pt,
22 numberstyle=\tiny\color{gray},
23}
24
25\author[\texttt{sebastiano.tronto@uni.lu}]{Sebastiano Tronto}
26\title[Students requests]%
27{Students requests}
28\logo{\includegraphics[scale=0.1]{img/unilu.jpg}}
29%\institute{University of Luxembourg}
30
31\date{2021-05-21}
32
33\begin{document}
34
35\begin{frame}
36 \titlepage
37\end{frame}
38
39\begin{frame}[plain]
40 \begin{center} {\Huge More cryptography} \end{center}
41\end{frame}
42
43\begin{frame}{Cryptography}
44 What we have seen:
45
46 \vspace{0.3cm}
47 \begin{itemize}
48 \item \textbf{RSA:}
49 sending messages using a private key / public key pair
50 \item \textbf{Flip-a-coin:}
51 cryptographic ``proof'' that the opponent is not cheating
52 \end{itemize}
53\end{frame}
54
55\begin{frame}{Cryptography}
56 \begin{itemize}
57 \item Rely on integer factorization being hard
58
59 \vspace{0.3cm}
60 \textbf{Example:} the best-known factorization algorithm
61 (\href{https://en.wikipedia.org/wiki/General\_number\_field\_sieve}%
62 {\emph{General number field sieve}}) has complexity
63 \begin{align*}
64 \sim O\left(
65 e^{\sqrt[3]{\frac{64}{9}\log_2n\cdot(\log_2\log_2n)^2}}
66 \right)
67 \end{align*}
68
69 Factoring a number with $300$ digits:
70 \begin{itemize}
71 \item Your laptop: $10^{13}$ billion years
72 \item Best supercomputer: $13$ billion years
73 (age of the universe)
74 \end{itemize}
75 \end{itemize}
76\end{frame}
77
78\begin{frame}{Symmetric and asymmetric cryptography}
79 \begin{itemize}
80 \item Our examples are \emph{asymmetric}: different public/private keys
81 \item Safe against eavesdroppers
82 \item Symmetric protocols can be faster and simpler, but you need
83 a secure way to exchange a key
84 \end{itemize}
85\end{frame}
86
87\begin{frame}{Diffie-Hellman key exchange}
88 \begin{itemize}
89 \item Generate a ``password'' without communicating it directly
90 \item It can then be used for symmetric cryptography
91 \item Based on a different hard problem:
92 \href{https://en.wikipedia.org/wiki/Discrete\_logarithm}%
93 {\emph{discrete logarithm}}
94 \end{itemize}
95\end{frame}
96
97\begin{frame}{Diffie-Hellman key exchange}
98 \begin{itemize}
99 \item Alice and Bob agree on a prime number $p$ and an integer $g$
100 \item Alice picks an integer $a$ and sends $(g^a\bmod p)$ to Bob
101 \item Bob picks an integer $b$ and sends $(g^b\bmod p)$ to Alice
102 \item Alice can compute $(g^b)^a\bmod p$ and Bob can compute
103 $(g^a)^b\bmod p$. This is their shared secret (key).
104 \end{itemize}
105\end{frame}
106
107\begin{frame}{Diffie-Hellman with colors (from Wikipedia)}
108 \begin{center}\includesvg[scale=0.45]{img/DH}\end{center}
109\end{frame}
110
111\begin{frame}{Diffie-Hellman key exchange}
112 \begin{itemize}
113 \item Knowing $h$ and $a$, it is hard to find $g$ such that
114 $g^a \bmod p =h$ (discrete logarithm problem)
115 \item Very simple, many variants
116 \item Any group can be used, e.g. Elliptic Curves (see
117\href{https://en.wikipedia.org/wiki/Elliptic-curve_Diffie\%E2\%80\%93Hellman}%
118 {Wikipedia: elliptic-curve Diffie-Hellman})
119 \end{itemize}
120\end{frame}
121
122
123\begin{frame}[plain]
124 \begin{center} {\Huge Numerical methods for PDEs} \end{center}
125\end{frame}
126
127\begin{frame}{Solving partial differential equations}
128 \begin{itemize}
129 \item Very, very hard
130 \item Very important in practical applications (physics and such)
131 \item Approximations are necessary, might as well use numerical methods
132 \end{itemize}
133\end{frame}
134
135\begin{frame}{Numerical methods for ODEs}
136 \begin{block}{Problem}
137 Given $f(x,y)$, $x_0$ and $y_0$, find an approximation
138 for $y(x)$ such that
139 \begin{align*}
140 \begin{cases}
141 y'(x) = f(x, y(x))\\
142 y(x_0) =y_0
143 \end{cases}
144 \end{align*}
145 \end{block}
146
147 \begin{block}{Approximation}
148 We can describe $y(x)$ in an interval $[x_0,x_1]$ by giving the
149 (approximate) values $y(s_0)$, \dots, $y(s_n)$ for many
150 values of $s_i\in [x_0, x_1]$.
151 \end{block}
152\end{frame}
153
154\begin{frame}{Euler's method}
155 \begin{block}{Idea}
156 For $h$ small
157 \begin{align*}
158 y'(x)\approx\frac{y(x+h)-y(x)}{h}
159 \end{align*}
160 which implies
161 \begin{align*}
162 y(x+h) \approx y(x) + h\cdot f(x, y(x))
163 \end{align*}
164 \end{block}
165\end{frame}
166
167\begin{frame}{Euler's method}
168 \begin{block}{Algorithm}
169 \textbf{Input:} the data $f(x,y)$, $x_0$, $y_0$ and $x_1$ describing
170 the problem and the desired range for the solution.
171
172 \vspace{0.3cm}
173 \textbf{Output:} $x_0=s_0 < s_1 < \dots < s_n=x_1$ and
174 $y_0, \dots, y_n$ such that $y_i\approx y(s_i)$.
175
176 \vspace{0.3cm}
177 \begin{enumerate}
178 \item Choose a value $n$ and let
179 $h=\frac{x_1-x_0}{n}$ and $s_i=x_0+ih$
180 \item For $i=0,\dots, n-1$ compute
181 $y_{i+1}=y_i+h\cdot f(s_i, y_i)$
182 \item Return $s_0, \dots, s_n$ and $y_0, \dots, y_n$
183 \end{enumerate}
184 \end{block}
185\end{frame}
186
187\begin{frame}{Euler's method}
188 \begin{itemize}
189 \item Very simple and fast
190 \item Generalization for higher-order equations: Runge-Kutta methods
191 \item A similar idea works for some PDEs
192 \end{itemize}
193\end{frame}
194
195\begin{frame}{The heat equation (PDE)}
196 \begin{align*}
197 \frac{\partial u}{\partial t} = \frac{\partial^2 u}{\partial x_1^2} +
198 \frac{\partial^2 u}{\partial x_2^2} + \cdots +
199 \frac{\partial^2 u}{\partial x_n^2}
200 \end{align*}
201
202 Where
203 \[u(x_1,x_2,\dots,x_n,t): \mathbb R^n\times \mathbb R_+\to \mathbb R\]
204 describes the quantity of heat at the point $(x_1,\dots x_n)$ at time $t$.
205
206 \vspace{0.3cm} It appears also outside thermodynamics: mathematical finance
207 (\href{https://en.wikipedia.org/wiki/Black\%E2\%80\%93Scholes\_equation}%
208 {Black-Scholes equation}), quantum mechanics
209 (\href{https://en.wikipedia.org/wiki/Schr\%C3\%B6dinger\_equation}%
210 {Schrödinger equation}), image analysis\dots
211\end{frame}
212
213\begin{frame}{A simple case ($n=1$, in $[0,1]^2$)}
214 \begin{block}{Problem}
215 Given $u_0(t)$, $u_1(t)$ and $u^0(x)$, find an approximation
216 for $u(x,t)$ such that
217 \begin{align*}
218 \begin{cases}
219 \frac{\partial u}{\partial t} =
220 \frac{\partial^2 u}{\partial x^2} \\
221 u(0,t) = u_{(0)}(t) \quad \text{(boundary condition)}\\
222 u(1,t) = u_{(1)}(t) \quad \text{(boundary condition)}\\
223 u(x,0) = u^0(x) \quad \text{(initial condition)}
224 \end{cases}
225 \end{align*}
226 \end{block}
227
228 \begin{block}{Approximation}
229 Values $u_i^j\approx u(s_i, r^j)$ for
230 $(s_i,r^j)\in [0,1]\times [0,1]$
231 \end{block}
232\end{frame}
233
234\begin{frame}{Idea}
235 For $k$ small:
236 \begin{align*}
237 \frac{\partial u(x,t)}{\partial t} \approx \frac{u(x,t+k)-u(x,t)}{k}\\
238 \end{align*}
239 For $h$ small (left limit + right limit):
240 \begin{align*}
241 \frac{\partial^2 u(x,t)}{\partial x^2} &\approx
242 \frac{\partial}{\partial x}\left(
243 \frac{u(x,t) - u(x-h,t)}{h}
244 \right)\\
245 &\approx \frac1h\left(
246 \frac{\partial u(x,t)}{\partial x} -
247 \frac{\partial u(x-h,t)}{\partial x}
248 \right)\\
249 &\approx \frac1h\left(
250 \frac{u(x+h,t) - u(x,t)}{h} - \frac{u(x,t)-u(x-h,t)}{h}
251 \right)\\
252 &\approx \frac{u(x+h,t)-2u(x,t)+u(x-h,t)}{h^2}
253 \end{align*}
254\end{frame}
255
256\begin{frame}{Idea}
257 From the equation
258 \begin{align*}
259 \frac{u_i^{j+1}-u_i^j}{k}= \frac{u_{i+1}^j-2u_{i}^j+u_{i-1}^j}{h^2}
260 \end{align*}
261 we find the formula
262 \begin{align*}
263 u_i^{j+1} = \frac{k}{h^2}\left(u_{i+1}^j - 2u_i^j + u_{i-1}^j\right)
264 + u_i^j
265 \end{align*}
266\end{frame}
267
268\begin{frame}{Finite difference method for the heat equation}
269 \begin{block}{Algorithm}
270 \textbf{Input:} $u_{(0)}^j$, $u_{(1)}^j$ (boundary)
271 and $u_i^0$ (initial).
272
273 \vspace{0.3cm}
274 \textbf{Output:} values $u_i^j$ approximating a solution.
275
276 \vspace{0.3cm}
277 \begin{enumerate}
278 \item Let $m=\operatorname{len}(u_0)-1$,
279 $n=\operatorname{len}(u^0)-1$ and $k=1/m$, $h=1/n$
280 %\begin{align*}
281 % \begin{array}{cccc}
282 % k=\frac{t_1-t_0}{m}, & h=\frac{x_1-x_0}{n}, &
283 % r^j = t_0 +jk, & s_i = x_0+ih
284 % \end{array}
285 %\end{align*}
286 \item For $j=0,\dots, m-1$ do the following:
287 \begin{itemize}
288 \item For $i=1,\dots, n-1$ compute
289 \begin{align*}
290 u_i^{j+1} = \frac{k}{h^2}\left(u_{i+1}^j -
291 2u_i^j + u_{i-1}^j\right) + u_i^j
292 \end{align*}
293 \end{itemize}
294 \item Return the $u_i^j$
295 \end{enumerate}
296 \end{block}
297\end{frame}
298
299\begin{frame}{Other PDEs}
300 \begin{itemize}
301 \item In general, there is no generic method
302 \item You might need to write specific code for your equation
303 \item Some packages exists
304 (e.g. \href{https://wiki.octave.org/Fem-fenics}{fem-fenics} for
305 \href{https://www.gnu.org/software/octave/index}{Gnu Octave})
306 \end{itemize}
307\end{frame}
308
309\end{document}

Generated with cgit - Back to sebastiano.tronto.net