Newer
Older
Lecture_repo / Lectures_my / NumMet / Lecture1 / mchrzasz.tex
@mchrzasz mchrzasz on 19 Sep 2016 22 KB fixed typos
\documentclass[11 pt,xcolor={dvipsnames,svgnames,x11names,table}]{beamer}

\usepackage[english]{babel} 
\usepackage{polski}         


\usetheme[
	bullet=circle,		% Other option: square
	bigpagenumber,		% circled page number on lower right
	topline=true,			% colored bar at the top of the frame 
	shadow=false,			% Shading for beamer blocks
	watermark=BG_lower,	% png file for the watermark
	]{Flip}

%\logo{\kern+1.em\includegraphics[height=1cm]{SHiP-3_LightCharcoal}}
                            

\usepackage[lf]{berenis}
\usepackage[LY1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{cases}
\usepackage{mathtools}
\usepackage{emerald}
\usefonttheme{professionalfonts}
\usepackage[no-math]{fontspec}		
\defaultfontfeatures{Mapping=tex-text}	% This seems to be important for mapping glyphs properly

\setmainfont{Gillius ADF}			% Beamer ignores "main font" in favor of sans font
\setsansfont{Gillius ADF}			% This is the font that beamer will use by default
% \setmainfont{Gill Sans Light}		% Prettier, but harder to read

\setbeamerfont{title}{family=\fontspec{Gillius ADF}}

\input t1augie.fd

%\newcommand{\handwriting}{\fontspec{augie}} % From Emerald City, free font
%\newcommand{\handwriting}{\usefont{T1}{fau}{m}{n}} % From Emerald City, free font
% \newcommand{\handwriting}{}	% If you prefer no special handwriting font or don't have augie

%% Gill Sans doesn't look very nice when boldfaced
%% This is a hack to use Helvetica instead
%% Usage: \textbf{\forbold some stuff}
%\newcommand{\forbold}{\fontspec{Arial}}

\usepackage{graphicx}
\usepackage[export]{adjustbox}

\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{bm}
\usepackage{colortbl}
\usepackage{mathrsfs} 			% For Weinberg-esque letters
\usepackage{cancel}				% For "SUSY-breaking" symbol
\usepackage{slashed}            % for slashed characters in math mode
\usepackage{bbm}                % for \mathbbm{1} (unit matrix)
\usepackage{amsthm}				% For theorem environment
\usepackage{multirow}			% For multi row cells in table
\usepackage{arydshln} 			% For dashed lines in arrays and tables
\usepackage{siunitx}
\usepackage{xhfill}
\usepackage{grffile}
\usepackage{textpos}
\usepackage{subfigure}
\usepackage{tikz}
\usepackage{hyperref}
%\usepackage{hepparticles}    
\usepackage[italic]{hepparticles}     

\usepackage{hepnicenames} 

% Drawing a line
\tikzstyle{lw} = [line width=20pt]
\newcommand{\topline}{%
  \tikz[remember picture,overlay] {%
    \draw[crimsonred] ([yshift=-23.5pt]current page.north west)
             -- ([yshift=-23.5pt,xshift=\paperwidth]current page.north west);}}



% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
\usepackage{tikzfeynman}		% For Feynman diagrams
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{trees}
\usetikzlibrary{matrix,arrows} 				% For commutative diagram
% http://www.felixl.de/commu.pdf
\usetikzlibrary{positioning}				% For "above of=" commands
\usetikzlibrary{calc,through}				% For coordinates
\usetikzlibrary{decorations.pathreplacing}  % For curly braces
% http://www.math.ucla.edu/~getreuer/tikz.html
\usepackage{pgffor}							% For repeating patterns

\usetikzlibrary{decorations.pathmorphing}	% For Feynman Diagrams
\usetikzlibrary{decorations.markings}
\tikzset{
	% >=stealth', %%  Uncomment for more conventional arrows
	vector/.style={decorate, decoration={snake}, draw},
	provector/.style={decorate, decoration={snake,amplitude=2.5pt}, draw},
	antivector/.style={decorate, decoration={snake,amplitude=-2.5pt}, draw},
	fermion/.style={draw=gray, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=gray]{>}}}},
	fermionbar/.style={draw=gray, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=gray]{<}}}},
	fermionnoarrow/.style={draw=gray},
	gluon/.style={decorate, draw=black,
		decoration={coil,amplitude=4pt, segment length=5pt}},
	scalar/.style={dashed,draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{>}}}},
	scalarbar/.style={dashed,draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{<}}}},
	scalarnoarrow/.style={dashed,draw=black},
	electron/.style={draw=black, postaction={decorate},
		decoration={markings,mark=at position .55 with {\arrow[draw=black]{>}}}},
	bigvector/.style={decorate, decoration={snake,amplitude=4pt}, draw},
}

% TIKZ - for block diagrams, 
% from http://www.texample.net/tikz/examples/control-system-principles/
% \usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [draw, rectangle, 
minimum height=3em, minimum width=6em]




\usetikzlibrary{backgrounds}
\usetikzlibrary{mindmap,trees}	% For mind map
\newcommand{\degree}{\ensuremath{^\circ}}
\newcommand{\E}{\mathrm{E}}
\newcommand{\Var}{\mathrm{Var}}
\newcommand{\Cov}{\mathrm{Cov}}
\newcommand\Ts{\rule{0pt}{2.6ex}}       % Top strut
\newcommand\Bs{\rule[-1.2ex]{0pt}{0pt}} % Bottom strut

\graphicspath{{images/}}	% Put all images in this directory. Avoids clutter.

% SOME COMMANDS THAT I FIND HANDY
% \renewcommand{\tilde}{\widetilde} % dinky tildes look silly, dosn't work with fontspec
\newcommand{\comment}[1]{\textcolor{comment}{\footnotesize{#1}\normalsize}} % comment mild
\newcommand{\Comment}[1]{\textcolor{Comment}{\footnotesize{#1}\normalsize}} % comment bold
\newcommand{\COMMENT}[1]{\textcolor{COMMENT}{\footnotesize{#1}\normalsize}} % comment crazy bold
\newcommand{\Alert}[1]{\textcolor{Alert}{#1}} % louder alert
\newcommand{\ALERT}[1]{\textcolor{ALERT}{#1}} % loudest alert
%% "\alert" is already a beamer pre-defined
\newcommand*{\Scale}[2][4]{\scalebox{#1}{$#2$}}%

\def\Put(#1,#2)#3{\leavevmode\makebox(0,0){\put(#1,#2){#3}}}

\usepackage{gmp}
\usepackage[final]{feynmp-auto}

\usepackage[backend=bibtex,style=numeric-comp,firstinits=true]{biblatex}
\bibliography{bib}
\setbeamertemplate{bibliography item}[text]

\makeatletter\let\frametextheight\beamer@frametextheight\makeatother

% suppress frame numbering for backup slides
% you always need the appendix for this!
\newcommand{\backupbegin}{
	\newcounter{framenumberappendix}
	\setcounter{framenumberappendix}{\value{framenumber}}
}
\newcommand{\backupend}{
	\addtocounter{framenumberappendix}{-\value{framenumber}}
	\addtocounter{framenumber}{\value{framenumberappendix}} 
}


\definecolor{links}{HTML}{2A1B81}
%\hypersetup{colorlinks,linkcolor=,urlcolor=links}

% For shapo's formulas:
\def\lsi{\raise0.3ex\hbox{$<$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}}
\def\gsi{\raise0.3ex\hbox{$>$\kern-0.75em\raise-1.1ex\hbox{$\sim$}}}
\newcommand{\lsim}{\mathop{\lsi}}
\newcommand{\gsim}{\mathop{\gsi}}
\newcommand{\wt}{\widetilde}
%\newcommand{\ol}{\overline}
\newcommand{\Tr}{\rm{Tr}}
\newcommand{\tr}{\rm{tr}}
\newcommand{\eqn}[1]{&\hspace{-0.7em}#1\hspace{-0.7em}&}
\newcommand{\vev}[1]{\rm{$\langle #1 \rangle$}}
\newcommand{\abs}[1]{\rm{$\left| #1 \right|$}}
\newcommand{\eV}{\rm{eV}}
\newcommand{\keV}{\rm{keV}}
\newcommand{\GeV}{\rm{GeV}}
\newcommand{\im}{\rm{Im}}
\newcommand{\disp}{\displaystyle}
\def\be{\begin{equation}}
\def\ee{\end{equation}}
\def\ba{\begin{eqnarray}}
\def\ea{\end{eqnarray}}
\def\d{\partial}
\def\l{\left(}
\def\r{\right)}
\def\la{\langle}
\def\ra{\rangle}
\def\e{{\rm e}}
\def\Br{{\rm Br}}
\def\fixme{{\color{red} FIXME!}}
\def\mc{{\color{Magenta}{MC}}\xspace}
\def\pdf{{\rm p.d.f.}}
\def\ARROW{{\color{JungleGreen}{$\Rrightarrow$}}\xspace}
\def\ARROWR{{\color{WildStrawberry}{$\Rrightarrow$}}\xspace} 

\author{ {\fontspec{Trebuchet MS}Marcin Chrz\k{a}szcz, Danny van Dyk} (UZH)}
\institute{UZH}
\title[Introduction to \\Numerical Methods]{Introduction to \\Numerical Methods}
\date{\fixme}


\begin{document}
\tikzstyle{every picture}+=[remember picture]

{
\setbeamertemplate{sidebar right}{\llap{\includegraphics[width=\paperwidth,height=\paperheight]{bubble2}}}
\begin{frame}[c]%{\phantom{title page}} 
\begin{center}
\begin{center}
	\begin{columns}
		\begin{column}{0.9\textwidth}
			\flushright\fontspec{Trebuchet MS}\bfseries \Huge {Introduction to \\numerical Methods}
		\end{column}
		\begin{column}{0.2\textwidth}
		  %\includegraphics[width=\textwidth]{SHiP-2}
		\end{column}
	\end{columns}
\end{center}
	\quad
	\vspace{3em}
\begin{columns}
\begin{column}{0.6\textwidth}
\flushright \vspace{-1.8em} {\fontspec{Trebuchet MS} \large Marcin Chrząszcz, Danny van Dyk\\\vspace{-0.1em}\small \href{mailto:mchrzasz@cern.ch}{mchrzasz@cern.ch}, \href{mailto:dany.van.dyk@gmail.com}{danny.van.dyk@gmail.com}}

\end{column}
\begin{column}{0.4\textwidth}
\includegraphics[height=1.3cm]{uzh-transp}
\end{column}
\end{columns}

\vspace{1em}
%		\footnotesize\textcolor{gray}{With N. Serra, B. Storaci\\Thanks to the theory support from M. Shaposhnikov, D. Gorbunov}\normalsize\\
\vspace{0.5em}
	\textcolor{normal text.fg!50!Comment}{Numerical Methods, \\ 19 September, 2016}
\end{center}
\end{frame}
}



\begin{frame}\frametitle{Course plan}
\begin{small}
\ARROW The course consists of 2 hours lecture and 2 hours of exercise.\\
\ARROW TA will explain to you how you will get points for the class exercise (you will be coding the algorithms) described on the lecture and applying them to some problems.\\
\ARROW After passing the class exercise ($>66\%$ of points) you will have an exam (oral).\\


\begin{columns}
\column{0.7\textwidth}
\ARROW The final mark:
\vspace{0.1cm}
\begin{footnotesize}
\begin{equation*}
{\rm mark}= 0.5~ {\rm exam} + 0.5 ~ {\rm class}
\end{equation*}
\ARROW The final exam will be average of exam and class marks.
\end{footnotesize}
\column{0.05\textwidth}
{~}
\column{0.25\textwidth}
\begin{footnotesize}

\begin{tabular}{|c|c|}
\hline
Mark & Range\\\hline
$6$ & $84-100~\%$ \\
$5$ & $67-83~\%$ \\ 
$4$ & $50-67~\%$ \\ \hline
$3$ & $33-50~\%$ \\ 
$2$ & $16-33~\%$ \\
$1$ & $0-16~\%$ \\
\hline
\end{tabular}

\end{footnotesize}


\end{columns}
\end{small}
\end{frame}

\begin{frame}\frametitle{Course plan}
\begin{enumerate}
\item Numerical precision, floating point representation.
\item Numerical stability.
\item Function interpolation, multidim. function interpolation.
\item Function approximation. 
\item Linear equation solving with elimination methods and iteration methods.
\item Non-linear system of equation solving.
\item Numerical integration.
\item Differential equations solving.
\item Chaos theorem.
\end{enumerate}

\end{frame}


\begin{frame}\frametitle{Why do we need numerical methods?}
\begin{exampleblock}{Prose:}
\ARROWR Most of the problems that one tackles on daily basis cannot be computed analytically! During the university studies the problems you were solving were tailor suited to be analytically solvable!\\
\ARROWR Even if the problem is solvable analytically in daily work one needs to repeat the calculations many times changing some conditions. Solving $n^{\rm th}$ time a similar integral on paper can have deadly consequences on your sanity.\\
\ARROWR Let's face is computers are just much much faster then us in this kind of computations.\\
\end{exampleblock}
\begin{alertblock}{Cons:}
\ARROW One disadvantage of numerical methods is the fact that they don't give you an exact solution. The reason for that is that the computers don't operate on real numbers but just on their representation which we will learn during today’s lecture.
\end{alertblock}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Errors, fast reminder}
\ARROW As you already know there are two types of errors:
\begin{itemize}
\item Absolute error $\Delta$.
\item Relative error $\delta$.
\end{itemize}

\begin{align*}
\Delta = \vert A - a \vert~~~~~~~~~~~\delta = \vert \frac{A- a}{A} \vert, ~~A \neq 0,
\end{align*}
where $A$ is the exact number, $a$ its approximation.\\ \pause
\ARROW Now since we know what are errors lets look into the sources of errors:\\
\ARROWR Input errors.\\
\ARROWR Cut-off errors.\\
\ARROWR Rounding errors.


\end{frame}

\begin{frame}\frametitle{Input Errors}
\begin{small}


\ARROW Input errors are errors that are associated with the inputs to the computer. We can have different types of this errors:
\begin{columns}
\column{0.6\textwidth}
\begin{itemize}
\item Mathematical model errors. A canonical example of such simplification is the pendulum, where we make an approximation of $\sin x =x$ for small $x$:
\begin{align*}
l \frac{d^2x}{dt^2} + g x =0 
\end{align*}
\item Errors associated to a given numerical algorithm: a choice of a numerical algorithm is indeed an very important step of solving a given problem. As we will see during the course the simplest models that are fast to implement to execute on the machine can lead to large numerical errors.
\end{itemize}


\column{0.4\textwidth}
\includegraphics[width=0.75\textwidth]{images/pen.jpg}

\begin{itemize}
\item Input data errors. For many computations one needs tome inputs: constants, starting points, etc. There are errors that are associated to those as well. This kind of errors are super the easiest to control and usually are negligible.

\end{itemize}

\end{columns}

\end{small}

\end{frame}



\begin{frame}\frametitle{Cut-off Errors}
\begin{small}
\ARROW This kind of errors arise where the true mathematical problem have some kind of infinite sum.\\
\ARROWR Computers are stupid creatures and they don't understand what is $\infty$ so we need to cut of computations at some point. Example:
\begin{exampleblock}{Maclaurin series:}
We know that an $e^x$ function can be Taylor expanded:
\begin{align*}
e^x = \sum_{n=0}^{n=\infty} \frac{x^n}{n!}=1 +x +\frac{x^2}{2!} + \frac{x^3}{3!}+\frac{x^4}{4!}+...
\end{align*}
We can replace the infinite sum with a finite one:
\begin{align*}
e^x \approx =1 +x +\frac{x^2}{2!} + \frac{x^3}{3!}+\frac{x^4}{4!}+...+\frac{x^N}{N!}
\end{align*}


\end{exampleblock}
\ARROW This kind of errors are unfortunately very common in the field. We will have to deal with them every time we have some kind of $\lim$, $\sum^{\infty}$, etc.


\end{small}

\end{frame}


\begin{frame}\frametitle{Rounding Errors}
\begin{small}
\ARROW This kind of errors occur during calculations on machines.\\
\ARROW Machine represents the number with a final precision.\\
\ARROW During the calculations the errors accumulate with every operation.\\
\ARROW This errors can be avoided or reduced by proper algorithm or by changing the precision of computations.
\pause
\begin{center}
\includegraphics[width=0.8\textwidth]{images/prec.png}

\end{center}


\end{small}

\end{frame}


\begin{frame}\frametitle{Integer numbers on our PC}
\begin{small}
\ARROW The integer numbers are very easy to represent on PC:
\begin{align*}
a=\pm (c_1N^0 + c_2N^1 +...+ c_dN^{d-1}),
\end{align*}
where $N$ is the base of the system. Computers of course use $2$.
\begin{columns}
\column{3in}
\ARROW For example:
\begin{align*}
101011 \rightleftarrows & 1 \cdot 2^0 + 1 \cdot 2^1 +0 \cdot 2^2 + 1 \cdot 2^3 +\\ & 0 \cdot 2^4 +1 \cdot 2^5\\ & =  43
\end{align*}
\ARROW Now the first bit can be used for sign determination ($0$ plus $1$ minus) \texttt{int} or can be used to extend the range of numbers \texttt{unsigned}\\
\ARROW \texttt{int} - $-2147483648 - 2147483647$\\
\ARROW \texttt{unsigned} - $0 - 4294967295$


\column{2in}
\includegraphics[width=0.95\textwidth]{images/joke.jpg}

\end{columns}

\end{small}

\end{frame}



\begin{frame}\frametitle{Floating numbers on our PC}
\begin{small}
\ARROW Computers are using so-called ''classical floating point representation'':
\begin{align*}
a=\pm M \cdot N^C,~a \neq 0,
\end{align*}
\begin{itemize}
\item $M$ - mantissa or significand
\item $N$ - base of the system
\item $C$ - exponent 
\end{itemize}
\ARROW In such system the mantissa is always normalized:
\begin{align*}
M \in \left[ \frac{1}{N}, 1 \right)
\end{align*}
\ARROW Using the definition we can write the mantissa and exponent in the following way:
\begin{align*}
M=(m_1N^{-1}+m_2N^{-2}+...+m_t N^{-t})\\
C=\pm(c_1 N^0+ c_2 N^1 + c_3 N^2 + ...+c_d N^{d-1})
\end{align*}
\ARROW The most often know base are $2,8,10,16$.
\end{small}

\end{frame}

\begin{frame}\frametitle{Numbers on our PC: binary system }
\begin{small}
\ARROW For example let's construct numbers using binary system:
\begin{align*}
M=\pm(m_1 2^{-1}+m_2 2^{-2}+...+m_t 2^t)\\
C=\pm(c_1 2^0+ c_2 2^1 + c_3 2^2 + ...+c_d 2^{d-1})
\end{align*}
where:
\begin{itemize}
\item $t$ - length of mantissa, $d$ - length of exponent
\item $m_i$ - mantissa digits; $m_i \in \lbrace 0,1\rbrace$
\item $c_i$ - exponent digits; $c_i \in \lbrace 0,1\rbrace$
\end{itemize}
\begin{exampleblock}{Example: $11110001~(s)mmmm(s)cc$}
Lets say we are representing a number with a byte. First 5 digits are the mantissa the next 3 are exponent.
\begin{align*}
M=-(1 \cdot 2^{-1} + 1 \cdot 2^{-2} + 1 \cdot 2^{-3} + 0 \cdot 2^{-4} = -\frac{7}{8}\\
C=  + (0 \cdot 2^0 + 1 \cdot 2^1)=2\\
x=-\frac{7}{8} \cdot 2^2=-3.5
\end{align*}

\end{exampleblock}

\end{small}

\end{frame}


\begin{frame}\frametitle{IEEE754-2008}
\begin{small}
\ARROW The rules of the binary systems are defined by the \texttt{ISO-IEEE754} standard (updated in 2008 of the 1985 standard). 

\begin{center}
\includegraphics[width=0.9\textwidth]{images/table.png}
\end{center}
\ARROW There is a minimum and maximum number we can represent in the current system.\\
\ARROW There are some tricks you can play: use subnormal \\
\ARROW In general we can represent numbers from: $\langle -a, -b \rangle \cup \lbrace 0 \rbrace \cup \langle b,a \rangle$\\
\ARROW The standard also defines the rounding procedures for numbers.

\end{small}

\end{frame}

\begin{frame}\frametitle{Error propagation: sum}
\begin{small}
\ARROW Let's consider we have two numbers $x$ and $y$. \\
\ARROW Their representation are not exact so: $x=\overline{x} + \epsilon_x$ and $y=\overline{y}+\epsilon_y$\\
\ARROW Now if we want to sum them:
\begin{align*}
x+y=\overline{x}+\overline{y} + \epsilon_x+\epsilon_y=\overline{x}+\overline{y}+\epsilon
\end{align*}
\ARROW If each of the $\epsilon_i$ numbers have a constant distribution on $\left[-\frac{1}{2} 10^{-d}, \frac{1}{2} 10^{-d} \right]$, where $d$ is the precision.\\
\ARROW Then $\epsilon$ has a triangular distribution on $\left[-10^{-d}, 10^{-d} \right]$\\
\ARROW Repeating $N$ times this we will approach the Gaussian distribution with a width of $\sim \sqrt{N} 10^{-d}$

\end{small}

\end{frame}

\begin{frame}\frametitle{Error propagation: multiplication, division}
\begin{small}
\ARROW Let's consider we have two numbers $x$ and $y$. \\
\ARROW Their representation are not exact so: $x=\overline{x} + \epsilon_x$ and $y=\overline{y}+\epsilon_y$\\
\ARROW Now if we want to multiply them (we can neglect $\epsilon_x \epsilon_y$ terms):
\begin{align*}
x \cdot y=\overline{x} \cdot \overline{y} + \epsilon_x \cdot \overline{y}+\epsilon_y \cdot \overline{x}
\end{align*}
\ARROW If $\vert \overline{x} \vert \gg (\ll) \vert \overline{y} \vert$ then the error might explode. \\

\ARROW Now if we want to divide them:
\begin{align*}
x / y=\overline{x} / \overline{y} + \frac{\epsilon_x}{\overline{y}}+  \frac{\epsilon_y \overline{x}}{\overline{y}^{ {\color{red} 2}}}
\end{align*}

\ARROW If $\vert y \vert \ll \vert x \vert$ then the division is will have large errors.
\end{small}

\end{frame}


\begin{frame}\frametitle{Application}
\begin{small}
\ARROW When we implement a current algorithm we need to ensure that our algorithm is ''backward stable'', ''well-conditioned'' and ''numerically stable''.\\
\begin{exampleblock}{Numerical stability}
We say that the algorithm is numerically stable if the the results does not change if we increase the computation precision.

\end{exampleblock}
\begin{alertblock}{Backward stability}
Backward stability means that our algorithm will gives us the true answer if we move to infinite precision of the machine. In practice we look if we can conserve the errors of the representation.
\end{alertblock}
\begin{exampleblock}{Well-conditioned}
Each algorithm has some input parameters. If we introduce a slight difference in those parameters (of the order of the representation precision), the results should not change significantly.

\end{exampleblock}
\ARROWR The numerical precision lead to discovery of chaos. If we have time we will discuss this during our lectures.

\end{small}

\end{frame}
\begin{frame}\frametitle{Rounding error}
\begin{small}
\ARROW Imagine we want to calculate:
\begin{align*}
1.0000+\sum_{i=1}^{10} 0.0001
\end{align*}
\ARROW Now imagine we will carry the calculations with $4$ digit precision.\\
\ARROW If we calculate the:
\begin{align*}
1.0000+\sum_{i=1}^{10} 0.0001=1.000
\end{align*}
\ARROW If we calculate the:
\begin{align*}
\sum_{i=1}^{10}0.0001+1.0000=1.001
\end{align*}
\ARROW The order matters!
\end{small}

\end{frame}


\begin{frame}\frametitle{Condition parameter}
\begin{small}

\begin{exampleblock}{The condition parameter}
\ARROWR Let $\phi : \mathcal{R}^n \to \mathcal{R}^m$ be a function and $x \in \mathcal{R}^n$ be a precise value and $\overline{x}  \in \mathcal{R}^n$ its computer representation.\\
\ARROWR If there $\kappa \in \mathcal{R}$ exists that:
\begin{align*}
\forall_{x,\overline{x}}: \frac{\Vert \psi(x)- \psi(\overline{x} \Vert}{\Vert \psi(x) \Vert} \leq \kappa \frac{\Vert x- \overline{x} \Vert}{ \Vert x \Vert}
\end{align*}
\ARROWR The $\kappa$ is called the condition parameter. 
\end{exampleblock}

\ARROW If the value of $\kappa$ is large then small difference cause by computer representation will explode in the final result.


\end{small}
\end{frame}



\begin{frame}\frametitle{Examples 1}
\begin{small}
\ARROW Let's calculate the $\pi$ number accordingly to the following formula for couple of $i$:
\begin{align*}
G_p=\frac{1}{p}\left[ 10^p \left(1+p\pi 10^{-p} \right) - 10^p \right]
 \end{align*}
with a simple program one can see:
\begin{center}
\includegraphics[width=0.5\textwidth]{images/ex1.png}
\end{center}


\end{small}

\end{frame}



\begin{frame}\frametitle{Example 1}
\begin{small}
\ARROWR How to fix this?!\\
\ARROW Change \texttt{double} to \texttt{long double}

\begin{center}
\includegraphics[width=0.5\textwidth]{images/ex2.png}
\end{center}


\end{small}

\end{frame}





\begin{frame}\frametitle{Example 2}
\begin{small}



\begin{columns}
\column{2.5in}
\begin{align*}
\begin{cases}
x + 3y  = 4 \\ 
x + 3.00001y  = 4.00001 
\end{cases}
\end{align*}


\column{2.5in}

\begin{align*}
\begin{cases}
x + 3y  = 4 \\ 
x + 2.99999y  = 4.00002 
\end{cases}
\end{align*}



\end{columns}
{~}\\{~}\\

\ARROW The coefficients of this equations are different by maximum of $0.00002$.\\
\ARROW The solutions to the first one is $(1,1)$ and to the second $(10,-2)$. \\
\ARROW So clearly we have a big $\kappa$ as changes $\mathcal{O}(10^{-5})$ are causing differences of $\mathcal{O}(10)$.


\end{small}

\end{frame}




\begin{frame}\frametitle{Summary}
\begin{small}

\ARROW Computers use only representations of the floating points!\\
\ARROW Numerical methods suffer from computer precision!\\
\ARROW It's YOUR responsibility to ensure that what you are doing will not explode the error.\\



\end{small}

\end{frame}


\backupbegin   

\begin{frame}\frametitle{Backup}


\end{frame}




\backupend			
\end{document}