\documentclass[11 pt,xcolor={dvipsnames,svgnames,x11names,table}]{beamer}

\usepackage[english]{babel} 
\usepackage{polski}         
\usepackage[skins,theorems]{tcolorbox}
\tcbset{highlight math style={enhanced,
  colframe=red,colback=white,arc=0pt,boxrule=1pt}}

\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{emerald}
\usefonttheme{professionalfonts}
\usepackage[no-math]{fontspec}	
\usepackage{listings}
\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:

% 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}}}
\def\pdf{{\rm p.d.f.}}
\def\cdf{{\rm c.d.f.}}
\def\ARROW{{\color{JungleGreen}{$\Rrightarrow$}}\xspace}  
\def\ARROWR{{\color{WildStrawberry}{$\Rrightarrow$}}\xspace}  

\author{ {\fontspec{Trebuchet MS}Marcin Chrz\k{a}szcz} (Universit\"{a}t Z\"{u}rich)}
\institute{UZH}
\title[Specific \pdf~generation]{Specific \pdf~generation}
\date{\fixme}
\newcommand*{\QEDA}{\hfill\ensuremath{\blacksquare}}%
\newcommand*{\QEDB}{\hfill\ensuremath{\square}}%

\author{ {\fontspec{Trebuchet MS}Marcin Chrz\k{a}szcz} (Universit\"{a}t Z\"{u}rich)}
\institute{UZH}
\title[Partial Differential Equation Solving]{Partial Differential Equation Solving}
\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 {Partial Differential Equation Solving, vol 2.}
		\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.44\textwidth}
\flushright \vspace{-1.8em} {\fontspec{Trebuchet MS} \Large Marcin Chrząszcz\\\vspace{-0.1em}\small \href{mailto:mchrzasz@cern.ch}{mchrzasz@cern.ch}}

\end{column}
\begin{column}{0.53\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}{Monte Carlo methods, \\ 12 May, 2016}
\end{center}
\end{frame}
}

\begin{frame}\frametitle{Announcement}

\begin{Large}
There will be no lectures and class on 19$^{th}$ of May
\end{Large}

\end{frame}


\begin{frame}\frametitle{Dirichlet conditions:expected number of steps}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW find the function $u(x_1,x_2,...,x_k)$ such that if fulfils the Laplace equation:
\begin{align*}
\dfrac{\partial^2 u }{\partial x_1^2} + \dfrac{\partial^2 u }{\partial x_2^2}+...+\dfrac{\partial^2 u }{\partial x_k^2}=0,~~~(x_1,x_2,...,x_k) \in D \subset \mathbb{R}^k
\end{align*}
In the domain $D$, on the the $\Gamma(D)$ the $u$ function is given by:
\begin{align*}
U(x_1,x_2,...,x_k)=f(x_1,x_2,...,x_k),~~~~(x_1,x_2,...,x_k) \in \Gamma( D )
\end{align*}
\ARROW Now lets assume that the domain $D$ is a hyperball:
\begin{align*}
0 \leq \sum_{i=1}^k x_i^2 \leq r^2,~~~r={\rm const}
\end{align*}
\ARROW Now $\pi_{\nu}(x_1,x_2,...,x_k)$ is a probability that a particle starting from $(x_1,x_2,...,x_k)$ will end up on the edge after $\nu$ steps. The $\kappa(x_1,x_2,...,x_k)$ is the estimated number of steps for this trajectory.
\begin{tiny}

\begin{align}
\pi_0=\begin{cases}
1,~~& (x_1,x_2,...,x_k) \in \Gamma(D)\\
0,~~& (x_1,x_2,...,x_k) \in D
\end{cases}
\label{eq1}
\end{align}
\begin{align}
\pi_{\nu}=\frac{1}{2k} \sum^{ \prime} \pi_{\nu-1}(x_1\prime,x_2\prime,...,x_k\prime)
\label{eq2}
\end{align}

\end{tiny}



\end{footnotesize}

\end{minipage}

\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}\frametitle{Dirichlet conditions:expected number of steps}
\begin{minipage}{\textwidth}
\begin{footnotesize}

\ARROW From Eq.~\ref{eq1} and \ref{eq2} one gets:
\begin{align*}
\kappa(x_1,x_2,...,x_k)=\sum_{\nu=1}^{\infty} \nu \pi_{\nu}(x_1,x_2,...,x_k)
\end{align*}
one gets:
\begin{align*}
\kappa(x_1,x_2,...,x_k)=\frac{1}{2k}\sum_{\nu=1}^{\infty} \left[ \nu \sum^{\prime}\pi_{\nu -1 }(x_1\prime,x_2\prime,...,x_k\prime) \right]\\ = \frac{1}{2k} \sum_{\nu =1 }^{\infty} \left[ (\nu-1)\sum^{\prime} \pi_{\nu-1}(x_1\prime,x_2\prime,...,x_k\prime) \right] + \frac{1}{2k} \sum_{\nu=1}^{\infty} \sum^{\prime} \pi_{\nu-1}(x_1\prime,x_2\prime,...,x_k\prime)
\end{align*}
\ARROW From which we get:
\begin{align*}
\kappa(x_1,x_2,...,x_k)=\frac{1}{2k}\sum^{\prime}\kappa(x_1\prime,x_2\prime,...,x_k\prime) +1
\end{align*}

\ARROW Now this is equivalent of the Poisson differential equation:
\begin{align*}
\frac{\partial^2 \kappa}{\partial x_1^2}+\frac{\partial^2 \kappa}{\partial x_2^2}+...+\frac{\partial^2 \kappa}{\partial x_k^2} = -2k,~{\rm b.~con.}~~ \kappa(x_1,x_2,...,x_k)=0,~~(x_1,x_2,...,x_k) \in \Gamma(D)
\end{align*}

\end{footnotesize}

\end{minipage}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{frame}\frametitle{Dirichlet conditions:expected number of steps}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW From previous equation: $\kappa(x_1,x_2,...,x_k)=\psi(x_1,x_2,...,x_k)-\sum_{i=1}^k x_i^2$ 
we get the for the $\psi$ function the Laplace equation:
\begin{align*}
\dfrac{\partial^2 \psi }{\partial x_1^2} + \dfrac{\partial^2 \psi }{\partial x_2^2}+...+\dfrac{\partial^2 \psi }{\partial x_k^2}=0
\end{align*}
because on the border ($\Gamma(D)$):
\begin{align*}
\psi(x_1,x_2,...,x_k)=r^2= {\rm const}
\end{align*}
so also inside the $D$:
$\psi(x_1,x_2,...,x_k)=r^2= {\rm const}$
\ARROW From which we can estimate the number steps in the random walk:
\begin{align*}
\kappa(x_1,x_2,...,x_k)=r^2-\sum_{i=1}^k\leq r^2
\end{align*}
\begin{alertblock}{Important conclusion:}
The expected number of steps in the random walk (the time of walk) from the point $(x_1,x_2,...,x_k)$ till the edge od the domain can be estimated by $r$ number (the LINEAR! size). It is completly independent of the $k$!
\end{alertblock}



\end{footnotesize}

\end{minipage}

\end{frame}


\begin{frame}\frametitle{Dirichlet conditions as linear system}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW In the discrete form we can write the Dirichlet conditions as (2-dim case):
\begin{align*}
u(x,y) & =\frac{1}{4} \left[ u(x-1,y)+u(x+1,y)+u(x,y-1)+u(x,y+1) \right],~~(x,y) \in D \\
u(x,y) & =f(x,y),~~~(x,y) \in \Gamma(D)
\end{align*}
\ARROW Now we can order the grid ($(x,y) \in D \cup \Gamma(D)$), we can represente the above equations as a linear system:
\begin{align*}
u_i=a_i+\sum_{j=1}^n h_{i j}u_j, ~~~~i=1,2,....,n
\end{align*}

\begin{exampleblock}{The trick:}
So to solve a differential equation with Dirichlet boundary condition we can use all the methods of solving linear equation systems such as Neumann-Ulam or Wassow.

\end{exampleblock}


\end{footnotesize}

\end{minipage}

\end{frame}


\begin{frame}\frametitle{Dirichlet conditions as linear system - example}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\begin{columns}

\column{3in}
\begin{itemize}
\item To do this we act as following: we number separately the points inside the $D$ domain and on the border $\Gamma(D)$. 
\item We write for each point inside the domain the Laplace equation as system of linear equations:
\end{itemize}
\column{2in}
\includegraphics[width=0.99\textwidth]{images/grid1.png}

\end{columns}
\begin{tiny}
\begin{align*}
&u_1 & -u_2/4 & &-u_4/4 & & & & = (f_1+f_{10})/4\\
&-u_1/4 & u_2 & -u_3/4 & & -u_5/4 & & & = (f_2)/4\\
& & -u_2/4  & ~~~~u_3 &  &  & -u_6/4 & & = (f_3+f_4)/4\\
&-u_1/4 &   &  & u_4 & -u_5/4 & & & = (f_8+f_9)/4\\
&  &  -u_2 /4&  & -u_4/4 &~~~~ u_5 & -u_6/4 & -u_7/4 & = 0\\
&  &  & -u_3/4 &  & -u_5/4 & u_6 &  & = (f_5+f_6)/4\\
&    &  &  &  & -u_5/4 &  &~~~~~ u_7 & = (f_6+f_7 + f_8)/4
\end{align*}
\end{tiny}

%-u_1/4 & u_2 & -u_3/4 & & -u_5/4 & & & = (f_1+f_10)/4\\


\end{footnotesize}

\end{minipage}

\end{frame}


\begin{frame}\frametitle{Dirichlet conditions as linear system - example}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW The above equation we can transform the above equation into the iterative representation:
\begin{align*}
\overrightarrow{u}=\overrightarrow{a}+\textbf{H}\overrightarrow{u}
\end{align*}
where $\overrightarrow{u}=(u_1,u_2,...,u_7)$ is the vector which represent the values of the function inside the $D$ domain, $\overrightarrow{a}$ is the linear combinations of the boundary values. In our example:
\begin{columns}
\column{2in}
\begin{align*}
\textbf{H}=\begin{pmatrix}
0 & \dfrac{1}{4} & 0 & \dfrac{1}{4} & 0 & 0 & 0\\
\dfrac{1}{4} & 0 & \dfrac{1}{4} & 0 & \dfrac{1}{4} & 0& 0\\
0 & \dfrac{1}{4} & 0 & 0 & 0 & \dfrac{1}{4} & 0\\
\dfrac{1}{4} & 0 & 0 & 0 & \dfrac{1}{4} & 0 & 0\\
0 & \dfrac{1}{4} & 0 & \dfrac{1}{4} & 0 & \dfrac{1}{4} & \dfrac{1}{4}\\
0 & 0 & \dfrac{1}{4} & 0 & \dfrac{1}{4} & 0 & 0\\
0 & 0 & 0 & 0 & \dfrac{1}{4} & 0 & 0\\
\end{pmatrix}
\end{align*}
\column{3in}
\ARROW To find the solution to aka $\overline{u}$ one can use the methods we already know: Neumann-Ulam and Wasow, etc.\\
\ARROW There are tricks and tips one can use to make this problem faster as each of the entry is $\frac{1}{4}$. 

\end{columns}


\end{footnotesize}

\end{minipage}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Neumann-Ulam method}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW We put the particle in $(x,y)$. \\
\ARROW We observe the trajectory of the particle until it reaches the boundary. Point $P_k$ is the last point before hitting the boundary.\\
\ARROW For each trajectory we assign a value that the arithmetical mean of the boundary points that are neighbours of the point $P_k$.\\
\ARROW We repeat the above $n$ times and calculate the mean.\\
\ARROW The example solution for $20$ trajectories:
\begin{align*}
u(2,2)=1.0500\pm 0.2756
\end{align*}
\ARROW E 10.1 Solve the above linear system using the Neumann-Ulam method for an assumed boundary conditions.
\end{footnotesize}

\end{minipage}

\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Dual Wasow method}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW We choose the boundary conditions with arbitrary chosen probability \pdf~$p(Q)$ the starting point.\\
\ARROW We choose with equal probability the point inside $D$ where the particle goes.\\
\ARROW With equal probability we choose the next positions and so on until the particle hits the boundary in the point $Q^{\prime}$.\\
\ARROW We count all trajectories $N((x_1,x_2,x_3,...,x_k)$ that that have passed the point $(x_1,x_2,x_3,...,x_k)$.\\
\ARROW For the point $(x_1,x_2,...,x_k)$ we calculate:
\begin{align*}
w(x_1,x_2,...,x_k)=\frac{1}{2k}N(x_1,x_2,...,x_k)\frac{f(Q)}{p(Q)}
\end{align*}
\ARROW The above steps we repeat $N$ times.\\
\ARROW After that we take the arithmetic mean of $w$.

\end{footnotesize}

\end{minipage}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Random walk with different step size}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW If $u(x,y)$ is a harmonic function that obeys the Laplace equation and $S_r(x,y)$ is a circle in with the middle point $(x,y)$ and radius $r$. Then a theorem states:
\begin{align*}
S_r(x,y)=\frac{1}{2 \pi } \int_0^{2\pi} u(x+r \cos \phi ,y+ r \sin \phi) d \phi
\end{align*}
\ARROW The above is true for in all the dimensions.\\
\ARROW The E.Muller method:
\begin{itemize}
\item At the begging we set the point in the initial point: $(x_1,x_2,...,x_k)$. 
\item We construct a $k$ dimensional sphere with center $(x_1,x_2,...,x_k)$ and radius $r$. The $r$ has to be choosen in a way that the whole is inside the $D$: $S_r(\overrightarrow{x}) \in D$. We choose a random point from $\mathcal{U}(0,2\pi)$ on the sphere which is our new point. 
\item We stop the walk when the point is on $\Gamma(D)$.
\end{itemize}
\ARROW We repeat this $N$ times.\\
\ARROW The final result if the arithmetical mean of all trajectories and is equal of the $u(x_1,x_2,...,x_k)$.



\end{footnotesize}

\end{minipage}

\end{frame}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Muller method}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW The method is faster the faster the particle reaches the edge.\\
\ARROW In order to do so we choose the radius that it is the maximal one that allows the sphere to be inside the domain $D$. 
\begin{columns}
\column{2in}
\includegraphics[width=0.95\textwidth]{images/muller.png}
\column{3in}
\ARROW There is a problem!!!! The probability that we choose a point on the edge is $0$!!!!\\
\ARROW An approximation has to be made: we choose a small number $\delta$ and we consider that the particle reached the border when the distance is with $\delta$.  \\
\ARROW We can always choose the $\delta$ such that the estimator error of function is smaller then a given $\epsilon$. 
\end{columns}




\end{footnotesize}

\end{minipage}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Muller method, example}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW An example solution of Laplace equation on square $( 0 \leq x \leq 1,~0 \leq y \leq 1)$ with the boundary conditions: $u(0,y)=1,~u(1,y)=u(x,0)=u(x,1)=1$

\begin{tabular}{||c|c|c|c|c|c||}
\hline  \hline
Method & Points $(x,y)$ & N. trajectories & Ave.n.of.steps &  Time $[s]$ & Solution\\
\hline \hline
\multirow{2}{*}{ Cons. step} & $(0.3,0.3)$ &  2000 & 89.87 & 42.0 & 0.396 \\ 
& $(0.5,0.1)$ &  2000 & 46.05 & 21.5 & 0.075 \\
$(h=0.05)$ & $(0.5,0.5)$ &  2000 & 115.83 & 54.1 & 0.247 \\ \hline
\multirow{3}{*}{ Muller met.} & $(0.3,0.3)$ &  2000 & 6.06 & 17.9 & 0.398 \\ 
& $(0.5,0.1)$ &  2000 & 6.04 & 18.0 & 0.078 \\
& $(0.5,0.5)$ &  2000 & 5.07 & 14.5 & 0.255 \\
\hline \hline
\end{tabular} 







\end{footnotesize}

\end{minipage}

\end{frame}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Other boundary conditions}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW Find the solution to the Laplace equation:
\begin{align*}
\frac{\partial^2 u}{\partial x_1^2}+ \frac{\partial^2 u}{\partial x_2^2} + ..+ \frac{\partial^2 u}{\partial x_k^2}=0, ~~~(x_1,x_2,...,x_k) \in D \subset \mathbb{R}^k
\end{align*}
inside the $D$ domain if on the edge $\Gamma(D)$ the function fulfils the equation:
\begin{align*}
f(x_1,x_2,...,x_k) \frac{\partial u(x_1,x_2,...,x_k)}{\partial n} + g(x_1,x_2,...,x_k)u(x_1,x_2,...,x_k) = h(x_1,x_2,...,x_k)
\end{align*}
where $\frac{\partial u(x_1,x_2,...,x_k)}{\partial n}$ is there derivative in the direction of normal to the $\Gamma(D)$ in the direction inside $D$.\\
\ARROW The cases:
\begin{itemize}
\item $f=0$. \ARROWR Dirichlet boundary condition (1st class condition).
\item $g=0$. \ARROWR Neumann boundary condition (2nd class condition).
\item others. \ARROWR General case (3rd class condition).
\end{itemize}



\end{footnotesize}

\end{minipage}

\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Other boundary conditions}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW In 2-dim:
\begin{align*}
\frac{\partial^2 u}{\partial x^2} + \frac{\partial^2 u}{\partial y^2} =0 ,~~~(x,y) \in D \subset \mathbb{R}^2
\end{align*}
with the boundary condition:
\begin{align*}
f(x,y)\frac{\partial u(x,y)}{\partial n} + g(x,y)u(x,y)=h(x,y),~~~(x,y)\in \Gamma(D)
\end{align*}
\ARROW And the discrete differential equation:
\begin{align*}
u(x,y)=\frac{1}{4}\left[ u(x-h,y)+u(x+h,y)+u(x,y-h)+u(x,y+h)\right]
\end{align*}
\begin{exampleblock}{Reminder:}
If at moment $t$ the point is in $(x,y)$ then in the $t+1$ time the particle moves with equal probability to one of the following points: $(x-h,y)$, $(x+h,y)$, $(x,y-h)$, $(x,y+h)$.


\end{exampleblock}


\end{footnotesize}

\end{minipage}

\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Random walk for boundary points}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW The boundary point $Q$ has only one internal neighbour point $P$.\\
\begin{itemize}
\item If the normal is parallel to the grid axis in the point $Q$:
\begin{align*}
f(Q)\frac{u(P)-u(Q)}{h} + g(Q)u(Q)=h(Q)
\end{align*}
\item Solving the above to get $u(Q)$ we get:
\begin{align*}
u(Q)= \frac{f(Q)u(P)}{f(Q)-hg(Q)} - \frac{h(Q)}{f(Q)-hg(Q)}
\end{align*}
\item To help we assign a temporary values:
\begin{align*}
\phi(Q)=\frac{f(Q)}{p\left[ f(Q)-hg(Q)\right]  },~~~\psi(Q)=-h\frac{h(Q)}{(1-p)\left[ f(Q)-hg(Q) \right]}
\end{align*}
\end{itemize}
\ARROW So:
\begin{align*}
u(Q)=p\phi(Q)u(P)+(1-p)\psi(Q)
\end{align*}
\pause
\ARROW Interpretation:
$u(Q)$ can be seen that with probability $p$ it is equal $\phi(Q)u(P)$ and with provability $(1-p)$  is equal to $\psi(Q)$.



\end{footnotesize}

\end{minipage}

\end{frame}




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{Random walk for boundary points, continued}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW The boundary point $Q$ has only one internal neighbour point $P$.\\
\ARROW The algorithm:
\begin{itemize}
\item We start the walk from a internal point $(X,Y)$ and we assign to it a weight: $W=1$.
\item If a particle at a given moment is sitting on the boundary then with probability $p$ it goes back to previous point $P$ and gets a weight $W \cdot \phi(Q)$ and with probability $(1-p)$ it finishes the walk and gets a weight of $W \cdot \psi(Q).$
\item For each trajectory we assign a value equal to the weight of the last point. So for example if the trajectory: $Q^{(1)},Q^{(2)}, Q^{(3)},...,Q^{(k)}$ we will assign the number:
\begin{align*}
\phi(Q^{(1)}) \phi(Q^{(2)}) \phi(Q^{(3)})... \phi(Q^{(k-1)}) \psi( Q^{(k)})
\end{align*}
\end{itemize}



\ARROWR One again this is only for 1 neighbour point $P$ and that the normal of the boundary is parallel to the grid!\\
\ARROW The general case is more difficult!





\end{footnotesize}

\end{minipage}

\end{frame}



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{More general case}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\begin{columns}
\column{2.2in}
\includegraphics[width=0.95\textwidth]{images/boundary.png}



\column{2.8in}
\ARROW The boundary conditions:
\begin{align*}
f(Q) \frac{1}{h\sqrt{1+c_1^2}} \left[ c_2 u(P_1)+c_1 u(P_2) - u(Q^{\ast} \right] + \\g(Q) u(Q^{\ast})=h(Q)
\end{align*}
\ARROW The trick:
\begin{align*}
\phi_1(Q^{\ast})=\frac{c_1 f(Q)}{p_1 \left[f(Q) - h\sqrt{1+c_1^2}   \right]}\\
\phi_2(Q^{\ast})=\frac{c_2 f(Q)}{p_2 \left[f(Q) - h\sqrt{1+c_1^2}   \right]}\\
\psi_3(Q^{\ast})=-h \frac{ \sqrt{c_1^2+1}h(Q))}{p_3 \left[f(Q) - h\sqrt{1+c_1^2}   \right]}\\
\end{align*}
\end{columns}
\ARROW Putting above new variables we get:
\begin{align*}
u(Q^{\ast})=p_1 \phi_1(Q^{\ast}) u(P_1) + p_2 \phi_2(Q^{\ast}) u(P_2) + p_3 \psi(Q^{\ast})
\end{align*}
\ARROW We will interpret the $p_1$, $p_2$, $p_3$ numbers as probability.

\end{footnotesize}

\end{minipage}

\end{frame}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}\frametitle{More general case, continuation}
\begin{minipage}{\textwidth}
\begin{footnotesize}
\ARROW The rules of random walk:
\begin{itemize}
\item The particle starts in $(X,Y)$ inside the domain with weight: $W=1$.
\item If at some point in time the particle hits the boundary in point $Q^{\ast}$:
\begin{itemize}
\item With probability $p_1$ it goes to point $P_1$ and the weight is $W \cdot \phi_1(Q^{\ast})$
\item With probability $p_2$ it goes to point $P_2$ and the weight is $W \cdot \phi_2(Q^{\ast})$
\item With probability $p_3$ it stops the walk and the weight is $W \cdot \psi(Q^{\ast})$

\end{itemize}
\item For each trajectory we assign the weight at the end point.
\end{itemize}



\end{footnotesize}
\end{minipage}
\end{frame}


\backupbegin   

\begin{frame}\frametitle{Backup}


\end{frame}

\backupend			

\end{document}
