\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, amssymb} \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 patternsfx \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] \def\ARROW{{\color{JungleGreen}{$\Rrightarrow$}}\xspace} \def\ARROWR{{\color{WildStrawberry}{$\Rrightarrow$}}\xspace} \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}}} \def\pdf{{\rm p.d.f.}} \def\cdf{{\rm c.d.f.}} \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}}% \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 {Specific \pdf~generation} \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, \\ 14 April, 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{Exponential \pdf } \begin{footnotesize} % \begin{exampleblock}{~} \ARROWR The $X(\theta, \lambda)$:\\ \begin{align*} \rho_{\theta , \lambda}=\frac{1}{\lambda} e^{- \frac{x- \theta}{\lambda}} \end{align*} \ARROWR One can transform the variable: \begin{align*} x \to x^{\prime} =\frac{x-\theta}{\lambda}~~ \Rightarrow~~ E(\theta, \lambda) \to E(0,1): \rho_{0,1}=e^{-x^{\prime},} x^{\prime} \geq 0 \end{align*} % \end{exampleblock} \begin{columns} \column{0.1in} {~}\\x \column{3.5in} \begin{block}{ \begin{footnotesize}Reverting the \cdf \end{footnotesize}} \begin{align*} X^{\prime} = - \ln R,~R \in\mathcal{U}(0,1),~~~\Rightarrow X=\lambda X^{\prime} + \theta \end{align*} \end{block} \begin{block}{ \begin{footnotesize}Monolitic series method\end{footnotesize}} \begin{enumerate} \item Generate a sequence: $U_1,U_2,... \in \mathbb{U}(0,1)$ \item We look at series: $U_1 \geq U_2 \geq U_3 ...\geq U_n < U_{n+1}$, which we then order with numbers: $0,1,2,3,...$. \item First series which length $n$ is odd we take as integral part of a number. The decimal part is taken as $R_1$. \end{enumerate} \end{block} \column{0.1in} {~}\\ \column{1.3in} \ARROW E7.1 Write the two above generators of $E(0,1)$. Compare \cdf~and \pdf \end{columns} \end{footnotesize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}\frametitle{Gaussian \pdf } \begin{footnotesize} \only<1>{ % \begin{exampleblock}{~} \ARROW The \pdf: \begin{align*} \phi_{\mu,\sigma}(x)=\frac{1}{\sigma\sqrt{2\pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}~~ - \infty <x < \infty \end{align*} \ARROW Now we can always transform the variables: \begin{align*} x \to x'=(x-\mu)/\sigma~~ \Rightarrow~~ N(\mu,\sigma) \to N(0,1) \end{align*} \ARROW First method of based on Central limit theorem. See Lecture 2.\\ Bad for the tails.\\ \ARROW Reverting the \cdf \begin{itemize} \item In 1 dim the \cdf~is not revertible :( One can use an approximation (Odeh,Evans 1974): \end{itemize} \begin{columns} \column{3in} \begin{align*} \Phi^{-1}(u)=\begin{cases} g(u),~~~~~~~10^{-20}<u<0.5\\ -g(1-u)~~~0.5<u<1-10^{-20} \end{cases} \end{align*} \column{2in} \begin{align*} g(u)=t-\dfrac{L(t)}{M(t)},\\ t=\sqrt{-2 \ln u} \end{align*} \end{columns} \begin{align*} L(t)=0.322232431088 + t + 0.342242088547 t^2\\ + 0.0204231210245 t^3 + 0.0000453642210148 t^4 \end{align*} \begin{align*} M(t)=0.099348462606 + 0.588581570495 t + 0.531103462366 t^2\\ + 0.10353775285 t^3 + 0.0038560700634 t^4 \end{align*} } \only<2>{ \ARROW Reverting the \cdf~in 2 dim: \begin{align*} \phi(x,y)=\frac{1}{\sqrt{2\pi}}e^{-\frac{x^2+y^2}{2}},~~~ - \infty <x,y < \infty \end{align*} \begin{itemize} \item We change the coordinates: $(x,y)=(r\cos \phi,r \sin \phi)$ \item And we factorize: $\widehat{\rho}(\phi,r)=f(\phi)g(r)$, where $f(\phi)=\frac{1}{2 \pi}$,~$g(r)=re^{\frac{-r^2}{2}}$. \item The angles is generated flat: $\mathcal{U}(0,2\pi)$ and the $r$ with reverting the \cdf. \end{itemize} \ARROW If $U_1,U_2 \in \mathcal{U}(0,1)$: \begin{align*} x=\sqrt{-2 \ln U_1}\cos (2\pi U_2)\\ y=\sqrt{-2 \ln U_1}\sin (2\pi U_2) \end{align*} \ARROW Accurate and simple to use.\\ \ARROW Time consuming calculations of trigonometrical and logarithm function. } \only<3> { \ARROW The Marsaglia \& Bray method (1964): \begin{itemize} \item If $U_1,U_2 \in \mathcal{U}(-1,1)$ are independent random variables, and $U_1^2+U_2^2 \leq 1$ then: \begin{align*} X_1=U_1\sqrt{\frac{-2 \ln (U_1^2+U_2^2)}{U_1^2+U_2^2}},~~Y_1=X_1\frac{U_2}{U_1} \end{align*} have the distribution of $N(0,1)$. \end{itemize} \ARROW The algorithm: \begin{itemize} \item Generate $R_1,R_2 \in \mathcal{U}(0,1)$ and calculate the $U_1=2R_1-1,~U_2=2R_2-1$ \item Calculate $W=U_1^2+U_2^2$. \item If $W>1$ start over. \item Calculate the $X=U_1 Z$ and $Y=U_2 Z$, where $Z=\sqrt{\frac{-2 \ln W}{W}}$ \end{itemize} \ARROW E7.2 Generate $N(0,1)$ using \cdf~reverting and Marsaglia \& Bray method. } \end{footnotesize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}\frametitle{Breit-Wigner \pdf } \begin{footnotesize} \only<1>{ \ARROW The \pdf : \begin{align*} f_{\theta,\lambda}(x)=\frac{\lambda}{\pi} \frac{1}{\lambda^2+(x-\theta)^2},~~~~- \infty < x< \infty \end{align*} \ARROW The variable transformation: \begin{align*} x \to x^{\prime}~~~ \Rightarrow~~~ C(\theta,\lambda) \to C(0,1) \end{align*} \ARROW The reverting \cdf : \begin{itemize} \item The \cdf \begin{align*} F(x)=\frac{1}{\pi} \arctan x + \frac{1}{2}\\ \Rightarrow X= \tan \left( \pi \left[U-\frac{1}{2}\right]\right),~~~U \in \mathcal{U}(0,1) \end{align*} \end{itemize} \ARROW A statistical digression: There is no expected value of the Cauchy function. The variance is infinite. } \only<2>{ \ARROW One can use a cut-off Cauchy method $C_u(0,1)$: \begin{align*} f_u(x)=\begin{cases} \frac{2}{\pi} \frac{1}{1+x^2},~~~\vert x \vert \leq 1,\\ 0,~~~~~~~~~~~\vert x \vert> 1,\\ \end{cases} \end{align*} \begin{exampleblock}{Theorem:} If a random variable $X$ has a cuf-off Cauchy distribution $C_u(0,1)$, then the new random variable $Y$, which is with $50~\%$ equal $X$ and with $50\%$ equal $1/X$ has a ''normal'' Cauchy distribution. \end{exampleblock} \ARROW Prove $(y \leq -1)$: \begin{align*} \mathcal{P}\lbrace Y\leq y\rbrace = \frac{1}{2} \mathcal{P}\lbrace X \leq y \rbrace + \frac{1}{2} \mathcal{P}\lbrace \frac{1}{X} \leq \rbrace = 0+\frac{1}{2}\lbrace \frac{1}{y} \leq X <0 \rbrace \\ = \frac{1}{2} \frac{2}{\pi} \int_{1/y}^0 \frac{dr }{1+t^2}=\frac{1}{\pi} \arctan y +\frac{1}{2}~~~{\rm c.d.f~of~}C(0,1) \end{align*} \ARROW The cut-off Breit-Wigner distribution we generate with elimination method using $\mathcal{U}(-1,1)$\\ \ARROW E7.3 Generate the Brei-Wigner distribution with all described methods. } \end{footnotesize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}\frametitle{$x^n$ \pdf } \begin{footnotesize} \only<1>{ \ARROW The \pdf : \begin{align*} f_{1}(x) &=n x^{n-1}\\ f_{2}(x) &=n(1-x)^{n-1} \end{align*} where $0\leq x \leq 1,~n\in \mathbb{N}$ \ARROW Revert the \cdf: \begin{align*} X=U^{1/n}~~~\longrightarrow &f_1,~~~& U\in \mathcal{U}(0,1)\\ Y=1-U^{1/n}~~~\longrightarrow &f_2,~~~& U\in \mathcal{U}(0,1) \end{align*} \ARROWR Disadvantage: The operation $U^{1/n}$ is time consuming. \ARROW Second method: \begin{itemize} \item Generate $U_1,U_2,...U_n \in \mathcal{U}(0,1)$. \item $X=\max\lbrace U_1,U_2,...U_n \rbrace$ has \pdf~of $f_1$. \item $Y=\min\lbrace U_1,U_2,...U_n \rbrace$ has \pdf~of $f_2$. \end{itemize} \ARROW E7.4 Generate the $f_1$ and $f_2$ \pdf~ with two methods. } \end{footnotesize} \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{frame}\frametitle{Bernoulli \pdf } \begin{footnotesize} \only<1>{ \ARROW The \pdf~$b(n,p)$ : \begin{align*} \mathcal{P}\lbrace X=m\rbrace ={n \choose m} p^m (1-p)^{n-m},~~~~m=0,1,2,...,n. \end{align*} \ARROWR The interpretation: number of success with the probability $p$.\\ \ARROW The algorithm (buffon needle):\\ \includegraphics[width=0.45\textwidth]{images/buff.png}\\ \ARROW It requires many ''trials'' } \only<2> { \ARROW If $n$ is large, we can use a discrete \pdf : \begin{align*} p_k=\sum_{i=0}^k \mathcal{P}\lbrace X=i\rbrace \end{align*} and use the algorithm:\\ \includegraphics[width=0.45\textwidth]{images/buff2.png} \begin{exampleblock}{Theory hack:} If $n$ is big one can write it in a form: $n=kl$, where $l$ is NOT a big number. In this case one can generate $k$ numbers from distribution $b(l,p)$ and calculate $m$ as sum of the generated numbers. \end{exampleblock} } \only<3> { \begin{exampleblock}{Theory:} If $U \in \mathcal{U}(0,1)$ then: \begin{align*} Y=\Theta(p-U)~~~~~~~~V=\min \lbrace \frac{U}{p},\frac{1-U}{1-p} \rbrace \end{align*} are independent and $V \in \mathcal{U}(0,1)$. \end{exampleblock} \ARROW This is super nice! We can treat $Y$ as the indicator of success in the Bernoulli trials. And have a new random variable :)\\ \begin{center} \includegraphics[width=0.45\textwidth]{images/bern.png} \end{center} \ARROW E7.5 Please code the above mention Bernaulli \pdf~generation. } \end{footnotesize} \end{frame} \begin{frame}\frametitle{Poisson \pdf } \begin{footnotesize} \ARROW The \pdf~$P(\lambda)$: \begin{align*} \mathcal{P}(X=n)=\frac{\lambda^n}{n!}e^{-\lambda},~~~n=0,1,2,... \end{align*} \begin{exampleblock}{Theory:} If $\epsilon_1$, $\epsilon_2$, $\epsilon_3$,..., are from $E(0,1)$ then the random variable: \begin{align*} X=\min \lbrace k:\sum_{i=0}^k \epsilon_i > \lambda \rbrace \end{align*} has the distribution of $P(\lambda)$. \end{exampleblock} \only<1>{ \ARROW The algorithm:\\ \begin{center} \includegraphics[width=0.45\textwidth]{images/al1.png} \end{center} } \only<2>{ \ARROW The algorithm 2:\\ \begin{center} \includegraphics[width=0.45\textwidth]{images/al2.png} \end{center} } %\ARROW E7.6 Code the $P(\lambda)$ generation. \end{footnotesize} \end{frame} \begin{frame}\frametitle{Poisson \pdf } \begin{footnotesize} \ARROW Reverting the \cdf : \begin{center} \includegraphics[width=0.4\textwidth]{images/al3.png} \end{center} \ARROW It has problem with large values of $\lambda$, at you need many generations which causes numerical instabilities.\\ \ARROW E7.6 Implement the abovementioned ways of generating $P(\lambda)$. \end{footnotesize} \end{frame} \begin{frame}\frametitle{Geometric \pdf } \begin{footnotesize} \ARROW The \pdf of $G(p)$ : \begin{align*} \mathcal{P}(X=n)=(1-p) p^n,~~~~n=0,1,2,3... \end{align*} \begin{exampleblock}{Theorem:} If a random variable has a \pdf~of \begin{align*} f_{\alpha}(x)=\alpha e^{-\alpha x} \end{align*} then $\lfloor x \rfloor$ has a geometric~\pdf: \begin{align*} G(e^{-\alpha}) \end{align*} \end{exampleblock} \ARROW Algorithm: \begin{enumerate} \item Generate a number $U$ from $\mathcal{U}(0,1)$ \item Calculate $X=\lfloor \ln U / \ln p \rfloor$ \end{enumerate} \ARROW E7.7 Implement the above algorithm. \end{footnotesize} \end{frame} \begin{frame}\frametitle{Equal division of interval} \begin{footnotesize} \ARROW The method of equal division of an $(0,1)$ interval (the \pdf ): \begin{align*} \mathcal{P}(X=k)=p_k,~~~~k=1,2,3...,K \end{align*} \ARROW Some times the inverting the \cdf~might be slow. This happens for large values of $K$. \\ \ARROW A more efficient method: \\ \begin{itemize} \item The interval $(0,1)$ we divide in $K+1$ bins: $(\frac{i-1}{K+1}, \frac{i}{K+1})$, which are equal size and we number them: $1,2,...,K+1$. . \item The random variable $U \in \mathcal{U}(0,1)$ falls into bin $\lfloor (K+1)U \rfloor$. \item We create a sequence: $ q_j =\sum_{k=0}^j p_k$, $j=0,1,....,K$. \item And a companioning one: $g_j = \max \lbrace j:q_j < \frac{i}{K+1} \rbrace$, $i=0,1,2,...$ \end{itemize} \begin{center} \includegraphics[width=0.45\textwidth]{images/al4.png} \end{center} \end{footnotesize} \end{frame} \begin{frame}\frametitle{Multidimensional generation} \begin{footnotesize} \ARROW Let $\overrightarrow{X}$ be a $m$ dimensional variable with a \pdf~of $f(x_1,x_2,x_3,...,x_m)$.\\ \ARROW To generate a \pdf like that we use the elimination method. \\ \ARROW The problem with this is that for large dimensions we can have problems :(\\ \ARROW Example:\\ \begin{itemize} \item Generate a flat \pdf~on the hyper circle $K_m(0,1)$ with the accept reject method. \item The probability of accepting event: \begin{align*} p_m=\pi^{m/2} / \left[ 2^m \Gamma(m/2+1) \right] \end{align*} \end{itemize} \begin{center} \begin{tabular}{||c|c|c||} \hline \hline $m$ & $p_m$ & $N_m=1/p_m$ \\ \hline $2$ & $7.854 \cdot 10^{-1}$ & $1.27$\\ $5$ & $1.645 \cdot 10^{-1}$ & $6.08$\\ $10$ & $2.490 \cdot 10^{-3}$ & $4.015 \cdot 10^2$ \\ $20$ & $2.461 \cdot 10^{-8}$ & $4.063 \cdot 10^7$ \\ $50$ & $1.537 \cdot 10^{-28}$ & $6.507 \cdot 10^{28}$ \\ \hline \hline \end{tabular}\\{~}\\ \end{center} \ARROW Good luck simulating $10^{28}$ points ;) \end{footnotesize} \end{frame} \begin{frame}\frametitle{Multidimensional generation} \begin{footnotesize} \only<1>{ \ARROW Uniform distribution on a simplex: \begin{exampleblock}{Theorem:} If $U_1,U_2,...,U_m~\in~\mathcal{U}(0,1)$ and $U_{1:m},U_{2:m},...,U{m:m}$. The a random variable: \begin{align*} X_1=U_{1:m},~X_2=U_{2:m}-U_{1:m},...,X_m=U_{m:m}-U_{m-1:m} \end{align*} has a uniform distribution on a simplex: \begin{align*} W_m=\lbrace (x_1,x_2,...,x_m): \sum_{j=1}^m x_j \leq 1,~x_j\geq 0,~j=1,2,...,m \end{align*} \end{exampleblock} } \only<2>{ \ARROW Uniform distribution on a simplex surface: \begin{exampleblock}{Theorem:} If $U_1,U_2,...,U_{m-1}~\in~\mathcal{U}(0,1)$ and $U_{1:m-1},U_{2:m-1},...,U{m-1:m-1}$. The a random variable: \begin{align*} X_1=U_{1:m-1},~X_{m-1}=U_{m-1:m-1}-U_{m-2:m-1},~X_m=1-U_{m-1:m-1} \end{align*} has a uniform distribution on a simplex surface: \begin{align*} W_m=\lbrace (x_1,x_2,...,x_m): \sum_{j=1}^m x_j = 1,~x_j \geq 0,~j=1,2,...,m \end{align*} \end{exampleblock} } \end{footnotesize} \end{frame} \backupbegin \begin{frame}\frametitle{Backup} \end{frame} \backupend \end{document}