Newer
Older
Lecture_repo / Lectures_my / NumMet / Lecture3 / dvandyk.tex
@Danny van Dyk Danny van Dyk on 19 Sep 2016 13 KB add preliminary lecture 3
\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{pgfplots}

\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{26. 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 {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, \\ 26. September, 2016}
\end{center}
\end{frame}
}

\begin{frame}{When Interpolation fails}
So far, you have been confronted with examples in which interpolation
works nicely. Let us now discuss an example, which behaves pathologically.\\[\medskipamount]

\begin{columns}
\begin{column}[t]{.5\textwidth}
\begin{overlayarea}{\textwidth}{5cm}
Consider the classical example by Runge:
\begin{equation*}
    f(x) = \left[1 + 25 x^2\right]^{-1}
\end{equation*}

Let us plot
\begin{itemize}
    \item the true function $f(x)$
    \item<2-> {\color{blue}the interpolating polynomial to degree $4$}
    \item<3-> {\color{red}the interpolating polynomial to degree $6$}
\end{itemize}
\end{overlayarea}
\end{column}
\begin{column}[t]{.5\textwidth}
\begin{tikzpicture}
    [
        scale=0.75
    ]
    \begin{axis}[%
        samples=500,
        xmin=-1,xmax=+1,
        ymin=-1,ymax=+1
    ]
        \addplot+[black,mark=none]
            {1.0 / (1.0 + 25.0 * \x^2)};
        \only<2->{
        \addplot+[blue,domain=-1:+1,y domain=-1:+1,mark=none]
            {1 - (3225 * \x^2) / 754 + (1250 * \x^4) / 377};
        }
        \only<3->{
        \addplot+[red,domain=-1:+1,y domain=-1:+1,mark=none]
            {1 - (211600 * \x^2)/24089 + (2019375 * \x^4)/96356 - (1265625 * \x^6)/96356};
        }
    \end{axis}
\end{tikzpicture}
\end{column}
\end{columns}
\end{frame}

\begin{frame}{Interpolation in more than $D=1$ dimensions}
In lecture 2 we discussed various ways to interpolate a
univariate function $f(x)$  A very nice fact for
polynomial interpolations in $D=1$ dimension is that the
interpolating polynomial is \emph{unique}: For two polynomials
$g(x)$ and $h(x)$ of identical degree one has
\begin{equation*}
    f_i = g(x_i) = h(x_i) \Rightarrow g(x) \equiv h(x)\,.
\end{equation*}

In $D=2$ dimensions, this ceases to be true. There can be
two non-identical polynomials $g(x, y)$ and $h(x, y)$
to identical, and fulfilling the same interpolation
conditions
\begin{equation*}
    f_i = g(x_i, y_i) = h(x_i, y_i)\,.
\end{equation*}
\end{frame}

\begin{frame}{Interpolation in $D=2$ dimensions}
    linear splines $\to$ bilinear
    cubic splines $\to$ bicubic splines
\end{frame}

\begin{frame}{Interpolation in $D=3$ dimensions}
\end{frame}

\begin{frame}{Interpolation in $D$ dimensions}
No ``fits it all'' recipe available

Nearest Neighbor
\end{frame}

\begin{frame}{Extrapolation (I): Basics}
    In many numerical applications a common class of problems arises:
    In the valuation of a function $f(x)$, we are interested in the value
    $f(x_0)$. However, at $x_0$ the function $f(x)$ is numerically instable,
    or maybe even ill-posed.\\

    However, in an environment around $x_0$, $x \approx x_0 + h$, we can evaluate $f$.
    Usually, one now discusses $f(h) \equiv f(x_0 + h)$, or rather the limit
    $\lim_{h \to 0} f(h)$. [Note: in all generality we can map problems with
    limits to either $\infty$ or a finite value to limits to $0$.]\\

    Interpolation, as discussed previously, can not directly help, since $h = 0$
    is not part of the domain of data points. Instead, one can take an interpolation
    at finite $h > 0$, $f_\text{int}(h)$, and simply approximate $f(h = 0) \approx f_\text{int}$.
    This step of using the interpolation of $f$ outside the domain of data points is
    called \emph{extrapolation}.\\

    To extrapolate an arbitrary function might work very well, but also might
    fail spectacularly. In this part of the course, we will briefly discuss
    examples of both cases, and what mathematical requirements make extrapolations
    work.
\end{frame}

\begin{frame}{Extrapolation (II): Working example}
$\cos(x)$ as a differential quotient

\begin{tikzpicture}
    [
        scale=0.75
    ]
    \begin{axis}[%
    ]
        \addplot+[black, mark=*, only marks] coordinates {
            (1, 0.877583)
            (2, 1.06024)
            (3, 1.00056)
            (4, 0.99996)
            (5, 1.00000)
            (6, 1.00000)
        };
    \end{axis}
\end{tikzpicture}
\end{frame}

\begin{frame}{Extrapolation (III): Pathological example}
\begin{equation*}
    f(x) = \exp(-x^{-1/2}) / x^4\,,\quad\text{with}\quad \lim_{x\to 0} f(x) = 0
\end{equation*}
show log of $f(x = 2^{-k})$ for $k=1$ to $10$ (with arbitrary numerical precision!).
\begin{tikzpicture}
    [
        scale=0.75
    ]
    \begin{axis}[%
        ymode=log
    ]
        \addplot+[black, mark=*, only marks] coordinates {
            (1,  1.94493)
            (2,  15.3780)
            (3,  64.0244)
            (4,  153.618)
            (5,  169.579)
            (6,  4.61491)
            (7,  94.4333)
            (8,  0.598657)
            (9,  9.77146)
            (10, 1.16233)
        };
    \end{axis}
\end{tikzpicture}
\end{frame}

\begin{frame}{Foundations: Necessary prerequisite for extrapolation}
existance of an asymptotic expansion
\end{frame}

\backupbegin   

\begin{frame}\frametitle{Backup}


\end{frame}




\backupend			
\end{document}