\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[Numerical Integration II]{Numerical Integration II}
\date{21 September 2016}


\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 {Numerical Integration II}
		\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, \\ 31 October, 2016}
\end{center}
\end{frame}
}


\begin{frame}\frametitle{Reminder}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW On the last lecture with prof. van Dyk :P we learned how to do numerical integration. \\
\ARROW The standard solution is to use the Newton-Coates Quadrature:\\
\begin{align*}
I^{\rm NC}=\sum_{k=0}^K \omega_k f(x_k),~~x_k=a+(b-a)\frac{k}{K}
\end{align*}

\ARROW In practical application we use low order quadratures:
\begin{itemize}
\item Simplicity.
\item Not easy to calculate high order differentials.
\item Rundge effect.
\item It's more effective to use the composite quadratures.
\end{itemize}


\end{small}

\end{minipage}

\end{frame}


\begin{frame}\frametitle{Practical information}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW There are 4 closed Newton-Cotes methods you need to remember (no more nor less):\\
\only<1>{
\ARROW Trapezoid rule:
\begin{center}
\includegraphics[width=0.8\textwidth]{images/trap.png}
\end{center}
\ARROW Simpson rule:
\begin{center}
\includegraphics[width=0.8\textwidth]{images/simp.png}
\end{center}
}
\only<2>{
\ARROW 3/8 rule:
\begin{center}
\includegraphics[width=0.8\textwidth]{images/38.png}
\end{center}
\ARROW Boole rule:
\begin{center}
\includegraphics[width=0.8\textwidth]{images/bool.png}
\end{center}
}
\end{small}

\end{minipage}

\end{frame}



\begin{frame}\frametitle{Composite quadratures}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW In practice instead of using high order interpolating polynomial it's beneficial to divide the domain $\left[ a ,b \right]$ into smaller domains and use lower order Newton-Cotes method.\\
\ARROW The procedure can be iterated $\mapsto$ more divisions.\\
\ARROW When dividing we can re-use the old points $\mapsto$ evaluating function is the most expensive part of the calculation.\\
\ARROW To re-use the points we need the close versions of the Newton-Cotes methods.



\end{small}

\end{minipage}

\end{frame}

\begin{frame}\frametitle{Error reduction}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Division of the integration domain leads towards reduction of the error of the integral.\\
\ARROW For example let's say we calculate the integral with trapezoid rule. We are getting an error:
\begin{align*}
\hat{E} = - \frac{1}{12} (b-a)^3 f^{(2)}(\xi_0)
\end{align*}
\ARROW Now let's divide the domain in two:
\begin{align*}
I= \int_a^b f(x)dx = \int_{a}^{(a+b)/2}f(x)dx + \int_{(a+b)/2}^b f(x) dx
\end{align*}
\ARROW And the error:
\begin{align*}
\hat{E} = - \frac{1}{12} (\frac{b-a}{2}-a)^3 f^{(2)}(\xi_1)- \frac{1}{12} (b-\frac{a+b}{2})^3 f^{(2)}(\xi_2)=\\ -\frac{1}{4} \frac{1}{12} (b-a)^3 f^{(2)} \frac{f^{(2)}(\xi_1) +f^{(2)}(\xi_2) }{2}
\end{align*}


\end{small}

\end{minipage}

\end{frame}
\begin{frame}\frametitle{Error reduction}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW Now using the average value theorem:
\begin{align*}
\xi_1 \in \left[a, (a+b)/2 \right],~~\xi_2 \in \left[ (a+b)/2,b \right]\\
\frac{f^{(2)}(\xi_1) +f^{(2)}(\xi_2) }{2}  = f^{(2)}(\xi_3)
\end{align*}
\ARROW We get in the end:
\begin{align*}
\hat{E} =  - \frac{1}{4} \frac{1}{12} (b-a)^3 f^{(2)}(\xi_3)
\end{align*}
\ARROW We reduced the error by factor of 4!\\
\ARROW In general for $n$  divisions:
\begin{align*}
\hat{E} =\sum_{i=1}^n (- \frac{1}{12}) \left(\frac{b-a}{2}\right)^n f^{(2)}(\xi_i) = - \frac{1}{12} \frac{\left(b-a \right)^3}{n^2} \frac{1}{n}\sum_{i=1}^n   f^{(2)}(\xi_i)= \\ - \frac{1}{n^2} \frac{\left(b-a\right)^3}{12} f^{(2)}(\xi_i) 
\end{align*}

\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Error reduction}
\begin{minipage}{\textwidth}
\begin{small}
\begin{center}
\includegraphics[width=0.9\textwidth]{images/denst.png}
\end{center}

\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Error reduction}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Remember for trapezoid formula we need to just to remember the sum when we will make the domain more dense:
\begin{align*}
I_N \sim h (\frac{1}{2}f_0 + f_1 +f_2 + .... + f_{N-1}+ \frac{1}{2}f_N )
\end{align*}
\ARROW The division can be stopped when we reach the wanted precision:
\begin{align*}
\frac{\vert I_{k+1} - I_k \vert}{ \vert I_{k} \vert + \epsilon^{\prime} } < \epsilon
\end{align*}
\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Richardson extrapolation}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW Using the composite quadratures we are getting sequence of numbers that will converge to the value of the integral.\\
\ARROW Now in the ''normal'' composite quadrature we just use the final value, but in principle the previous calculated one might be also useful!\\
\ARROW The simplest algorithm that uses them is the Richardson extrapolation:
\begin{itemize}
\item We divide the $\left[a,b \right]$ in the $n$ and $2n$ divisions:
\begin{align*}
I=I_n- \frac{(b-a)^3}{12n^2} f^{(2)} (\xi_n)\\
I=I_{2n}- \frac{(b-a)^3}{12(2n)^2} f^{(2)} (\xi_{2n})
\end{align*}
\ARROW Now if we assume that $f^{(2)} (\xi_{2n}) \simeq f^{(2)} (\xi_{2n})$ we can calculate:
\begin{align*}
I \simeq \frac{4I_{2n} - I_n}{3}
\end{align*}

\end{itemize}



\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Richardson extrapolation}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW Now this will work only if the assumption is true: $f^{(2)} (\xi_{2n}) \simeq f^{(2)} (\xi_{2n})$.\\
\ARROW This is true if the sequence $I_k$ is monotonically approaching the true value.\\
\pause
\ARROW Aka. the function always underestimates the integral.\\
\pause
\ARROW Aka. Convex of the function doesn't change much.
{~}\\
\ARROW If the convex of teh function changes the application of Richardson extrapolation might now be a good  idea.




\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Richardson extrapolation}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW For example let's try to calculate:
\begin{align*}
I=\int_1^2 \frac{dx}{x}
\end{align*}
\ARROW the exact solution is $I=\ln 2 = 0.69314718...$\\
\ARROW now using the trapezoid method:
\begin{align*}
I_1=\frac{1}{2}\left( f(1) + f(2) \right)=0.75
\end{align*}
\ARROW making more dense domain:
\begin{align*}
I_2=\frac{1}{2} \left( \frac{1}{2} f(1) + f(1.5) + \frac{1}{2} f(2) \right)= \frac{1}{2} \frac{17}{12} = 0.708333...
\end{align*}

\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Richardson extrapolation}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW making more$^2$ dense domain:
\begin{align*}
I_4=\frac{1}{4} \left( \frac{1}{2} f(1) + f(1.5) + \frac{1}{2} f(2) \right) + \frac{1}{4}\left(f(1.25)+f(1.75)\right)  = \\\frac{1}{4} \frac{17}{12} + \frac{1}{4}\left(\frac{4}{5}+\frac{4}{7}\right) = 0.69702381
\end{align*}
\ARROW The $I_1$, $I_2$, $I_4$ make a monotonic sequnce of integral approximations. Applying the Richardson extrapolation to $I_4$ and $I_2$:
\begin{align*}
\frac{4 \cdot  69702381 + 0.708333 }{3} = 0.69325397
\end{align*}
\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Romberg method}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW There is a way to do better the Richardson extrapolation. The prove of this is non trivial but let's just see how this works.\\
\ARROW Let $A_{0,k}$ be trapezoid approximation with $2^k$ subdivisions.\\
\ARROW We know that:
\begin{align*}
\lim_{k\to \infty} A_{0,k}=I
\end{align*}
\ARROW Now if we define the:
\begin{align*}
A_{n,k} = \frac{1}{4^n-1} \left( 4^n A_{n-1,k+1} - A_{n-1,k}\right)
\end{align*}

\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Romberg method}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Now the order to calculate the $A_{n,k}$ is:
\begin{center}
\includegraphics[width=0.8\textwidth]{images/rom.png}
\end{center}
\ARROW Arrows indicate which elements are needed to calculate the next one.\\
\ARROW In practice we don't need to remember all of them, but the last row.\\

\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Romberg method}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW One can show:
\begin{align*}
\begin{pmatrix}
A_{00}\\
A_{10}\\
A_{20}\\
... \\
A_{k0}
\end{pmatrix}=
\begin{pmatrix}
c_{00} && 0 && 0 & ... & 0\\
c_{11} && c_{10} && 0 & ... & 0\\
c_{22} && c_{21} && c_{20} & ... & 0\\
... \\
c_{kk} && c_{k,k-1} && c_{k,k-2} & ... & c_{k,0}
\end{pmatrix} 
\begin{pmatrix}
A_{00}\\
A_{01}\\
A_{02}\\
...\\
A_{0,k}
\end{pmatrix}
\end{align*}
\ARROW If it is true: $\lim_{k\to \infty} A_{0,k}=I$ then $\lim_{k\to \infty} A_{k,0}=I$\\
\ARROW Now the numbers $A_{k,0}$ are the extrapolation of the extrapolation :) Yes I know how this sounds :P\\
\ARROW The convergence of $A_{k,0}$ is much faster then $A_{0,k}$ 

\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Romberg method, in practice}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW The algorithm works as follows: we start from calculating the $A_{0,k}$ and our current estimator of the integral is $A_{k,0}$. (remember we have $2^k$ divisions) \\
\ARROW Now we calculate the $A_{0,k+1}$ using the trapezoid method with $2^{k+1}$ divisions.\\
\ARROW We calculate the whole row using eq. from two slides up.\\
\ARROW The whole procedure is finished when the $A_{k,0}$ and $A_{k+1,0}$ are similar.\\

\begin{exampleblock}{Warning:}
There is not guarantee that the algorithm will converge! One has to set a maximum number of steps. If the algorithm doesn't converge since then the method might not be converging.

\end{exampleblock}


\ARROW If the method converges the convergence is much faster then the trapezoid method.

\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Romberg method, example}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Lest calculate the integral:
\begin{align*}
I = \int_1^{1.5} \frac{dx}{1+2x^2 -0.25 \sin(9x)}
\end{align*}
with $10^{-8}$ accuracy.
\begin{center}
\includegraphics[width=0.7\textwidth]{images/table.png}
\end{center}
\ARROW To reach the required precision we need $2^5+1=33$ function evaluations. If we use classical Romberg method we would need $2^12+1=4097$.\\
\ARROW This numbers are just an example. This is hugely case dependent.


\end{small}
\end{minipage}
\end{frame}




\begin{frame}\frametitle{Romberg method, example 2}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Lest calculate the integral from previous example:
\begin{align*}
I = \int_1^{2} \frac{dx}{x} = \ln 2
\end{align*}
\ARROW We get:
\begin{center}
\includegraphics[width=0.7\textwidth]{images/table2.png}
\end{center}
\ARROW Now we see that evaluating the function $5$ times we got precision of $3 \cdot 10^{-5}$
\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Integrals with $\infty$ boundary}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW What if we want to find an integral (we know it exists):
\begin{align*}
\int_0^{\infty} f(x)dx
\end{align*}

\ARROW To do so we use an old trick:
\begin{align*}
\int_0^{\infty}f(x) dx = \int_{0}^A f(x) dx + \int_{A}^{\infty}f(x) dx
\end{align*}


\ARROW With the information that the function has to approach 0 very fast at $\infty$. \\
\ARROW in practice we need to choose $A$ to be large.\\
\ARROW The $A$ we choose in a way that for $x>A$ the function $\vert f(x)\vert \leq B g(x)$, where $g(x)$ is fastly converging to $0$ and $\int g(x) dx$ can be calculated analytically.
\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Multidimensional integrals}
\begin{minipage}{\textwidth}
\begin{small}

\ARROW Most of the time we need to calculate integrals like:
\begin{align*}
\int_{a_1}^{b_1}dx_1 \int_{a_2}^{b_2}dx_2 ... \int_{a_n}^{b_n}dx_n f(x_1,x_2,...,x_n)
\end{align*}
\ARROW For $n\leq3$ use Monte Carlo methods to calculate this!\\
\ARROW So in practice we need to know how to calculate this in 2D.

\begin{exampleblock}{Triangularization}
Any multidimensional polygon can be covered by triangles $\Omega_i$ such that:
\begin{itemize}
\item $D= \cup_i \Omega_i$
\item $\Omega_i \cap \Omega_j$, $i \neq j$ is :
\begin{itemize}
\item empty
\item common vertex
\item common edge
\end{itemize}

\end{itemize}
\end{exampleblock}



\end{small}
\end{minipage}
\end{frame}


\begin{frame}\frametitle{Triangularization example}
\begin{minipage}{\textwidth}
\begin{small}
\begin{center}
\includegraphics[width=0.8\textwidth]{images/train.png}
\end{center}

\ARROW Which is correct which is not correct?
\end{small}
\end{minipage}
\end{frame}

\begin{frame}\frametitle{Multidimensional integral, algorithm}
\begin{minipage}{\textwidth}
\begin{small}
\ARROW After we do triangulation of the domain.\\
\ARROW Calculate the integral using Prism volume.\\
\ARROW Do the traingularization again and calculate the next iteration of the integral.\\
\ARROW Stop when the improvement is getting small.


\end{small}
\end{minipage}
\end{frame}

\backupbegin   

\begin{frame}\frametitle{Backup}


\end{frame}







\backupend			
\end{document}
