\documentclass[class=report, float=false, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}

\input{preamble}

\graphicspath{{figures/images/}}

% \begin{cbunit}

\begin{document}

\chapter{Elastic force between ellipsoids}
\label{appendix:force}

\section{Reduced belonging matrix}

An ellipsoid $\mathcal{A}$ of centre $\vec{v}$ and semi-axes $(R_i)_{i=1:3}$ can be described by the matrix
\begin{equation}
\bar{B}(O,(R_i)_{i=1:3}) \equiv O \text{diag}(R_i^{-2})_{i=1:3} O^T
\end{equation}
where $O$ is the symmetric rotation matrix corresponding to the change of basis from the ellipsoid frame to the reference frame, such as
\begin{equation}
\forall \vec{r} \in \mathbb{R}^3, \begin{cases} (\vec{r} - \vec{v})^T \bar{B} (\vec{r} - \vec{v}) < 1 &\text{ if } \vec{r} \in \mathcal{A} \setminus \bar{\mathcal{A}} \\ (\vec{r} - \vec{v})^T \bar{B} (\vec{r} - \vec{v}) = 1 &\text{ if } \vec{r} \in \bar{\mathcal{A}} \\ (\vec{r} - \vec{v})^T \bar{B} (\vec{r} - \vec{v}) > 1 &\text{ if } \vec{r} \notin \mathcal{A} \end{cases}
\end{equation}
and with which we can write
\begin{equation}
\mu^2(\vec{r}\in\mathbb{R}^3) = (\vec{r}-\vec{v})^T\bar{B}(O,(R_i)_{i=1:3})(\vec{r}-\vec{v})
\label{rescaling_factor_squared}
\end{equation}
where $\mu(\vec{r})$ is the rescaling factor that has to be applied to the axes of $\mathcal{A}$ for $\vec{r}$ to be on its surface.\\

For simplicity, we will write $\bar{B}_{\mathcal{A}} \equiv \bar{B}(O,(R_i)_{i=1:3})$.\\

We have for all $\vec{r}$ on the surface of $\mathcal{A}$ that $\mu^2(\vec{r})=1$, therefore the surface of $\mathcal{A}$ is an isosurface of $\mu^2$. Therefore, we can conclude that the vector
\begin{equation}
\vec{\nabla}\mu^2(\vec{r}) = 2\bar{B}_{\mathcal{A}}(\vec{r}-\vec{v})
\end{equation}
is orthogonal to the surface of $\mathcal{A}$ in $\vec{r}$.

\section{Force}

We assumed that the force exerted on an ellipsoid $\mathcal{A}$ by an ellipsoid $\mathcal{B}$ of centre $\vec{r}_{\mathcal{A}}$ and $\vec{r}_{\mathcal{B}}$ respectively is
\begin{equation}
\vec{f}_{\mathcal{A}\mathcal{B}}^{\text{el}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = k_e (1 - \mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}))\frac{d\mu}{d\vec{r_{\mathcal{A}}}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})
\end{equation}
according to equation \ref{pre_force_el_ellipsoids}, where $\mu(\vec{r}_{\mathcal{A}},\vec{r}_{\mathcal{B}})$ is the rescaling factor that has to be applied to both $\mathcal{A}$ and $\mathcal{B}$ for them to be externally tangent.\\

Contrarily to the case of spheres, we have for ellipsoids that the rescaling factor $\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})$ is not uniquely determined by the positions of their centres. Indeed, if we were to add $\vec{dr_{\mathcal{A}}}$ to the position $\vec{r_{\mathcal{A}}}$ of the centre of ellipsoid $\mathcal{A}$, the contact point $\vec{r_C}$ with ellipsoid $\mathcal{B}$ would move as well.\\

Since we are looking for the first derivative of the quantity $\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})$, we will approximate rescaled ellipsoids by their respective tangent planes at $\vec{r_C}$ as suggested by \cite{donev}.\\

\begin{figure}[h!]
\centering
\includestandalone{figures/tikz/derivative_rescaling_factor}
\caption{Ellipsoids rescaled with rescaling factor $\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})$ and their contact plane in plain thick trait. Ellipsoids rescaled with rescaling factor $\mu(\vec{r_{\mathcal{A}}} + \vec{dr_{\mathcal{A}}},\vec{r_{\mathcal{B}}})$ and their contact plane in dashed trait.}
\label{contact_points_fig}
\end{figure}

If ellipsoid $\mathcal{A}$ is moved by $\vec{dr_{\mathcal{A}}}$, there appears a gap $dh$ between the tangent planes of the rescaled ellipsoids with
\begin{equation}
dh = \vec{dr_{\mathcal{A}}}\cdot\vec{n}_{\mathcal{A}}(\vec{r_C})
\label{dh}
\end{equation}
where $\vec{n}_{\mathcal{A}}(\vec{r_C})$ is the outward-facing unitary surface vector of ellipsoid $\mathcal{A}$ in $\vec{r_C}$.\\

To close this gap, we have to rescale the -- yet rescaled -- ellipsoids with a factor $\nu$ so that
\begin{align*}
% &d\nu~(\vec{r_C} - \vec{r_{\mathcal{A}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C}) - d\nu~(\vec{r_C} - \vec{r_{\mathcal{B}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C}) = dh\\
% \Leftrightarrow~ &d\nu~ (\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C}) = dh\\
% \Leftrightarrow~ &d\nu = \frac{dh}{(\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C})}
\left((\vec{r_C} - \vec{r_{\mathcal{A}}}) - \nu (\vec{r_C} - \vec{r_{\mathcal{A}}})\right)\cdot\vec{n}_{\mathcal{A}}(\vec{r_C}) - \left((\vec{r_C} - \vec{r_{\mathcal{B}}}) - \nu (\vec{r_C} - \vec{r_{\mathcal{B}}})\right)\cdot\vec{n}_{\mathcal{A}}(\vec{r_C}) = dh \Rightarrow 1 - \nu = \frac{dh}{(\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C})}
\end{align*}
and
\begin{align*}
\mu(\vec{r_{\mathcal{A}}} + \vec{dr_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = \nu\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) \Rightarrow \vec{dr_{\mathcal{A}}}\cdot\frac{d\mu}{\vec{dr_{\mathcal{A}}}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = -\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})(1 - \nu)
\end{align*}
which, with equation \ref{dh}, leads to
\begin{align*}
\frac{d\mu}{d\vec{r_{\mathcal{A}}}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = -\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})\frac{\vec{n}_{\mathcal{A}}(\vec{r_C})}{(\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})\cdot\vec{n}_{\mathcal{A}}(\vec{r_C})}
\end{align*}
We can then conclude, with equation \ref{surface_vec_reduced}, that
\begin{equation}
\frac{d\mu}{d\vec{r_{\mathcal{A}}}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = -\frac{\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})}{(\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})^T\bar{B}_{\mathcal{A}}(\vec{r_C} - \vec{r_{\mathcal{A}}})}\bar{B}_{\mathcal{A}}(\vec{r_C} - \vec{r_{\mathcal{A}}})
\end{equation}
Therefore, with equation \ref{pre_force_el_ellipsoids}, we finally have that
\begin{equation}
\boxed{\vec{f}_{\mathcal{A}\mathcal{B}}^{\text{el}}(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}}) = -k_e \frac{\mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})\left(1 - \mu(\vec{r_{\mathcal{A}}},\vec{r_{\mathcal{B}}})\right)}{(\vec{r_{\mathcal{B}}} - \vec{r_{\mathcal{A}}})^T\bar{B}_{\mathcal{A}}(\vec{r_C} - \vec{r_{\mathcal{A}}})}\bar{B}_{\mathcal{A}}(\vec{r_C} - \vec{r_{\mathcal{A}}})}
\label{fel_ellipsoids}
\end{equation}

% \input{references/biblio}

\end{document}

% \end{cbunit}


\documentclass[aspectratio=1610]{beamer}
\usetheme[sectionpage=progressbar, progressbar=foot]{metropolis}
\usefonttheme{professionalfonts}   % required for mathspec
\usepackage{mathspec}
\usepackage{bm}
\usepackage{color}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{float}

% ALGORITHMIC
\renewcommand{\algorithmicrequire}{\textbf{Input:}}
\renewcommand{\algorithmicensure}{\textbf{Output:}}

% THEME COLORS REDEF.
\definecolor{Magenta}{HTML}{B50B1E}
\definecolor{deBlue}{HTML}{0E2646}
\setbeamercolor{alerted text}{fg=Magenta}
\setbeamercolor{frametitle}{bg=deBlue}

% ENUM ITEM
\usepackage{fontawesome}
\usepackage{enumitem}
\setitemize{label=\usebeamerfont*{itemize item}%
\usebeamercolor[fg]{itemize item}
\usebeamertemplate{itemize item}}
%\SetLabelAlign{center}{\strut\smash{\parbox[t]\labelwidth{\centering#1}}}
\definecolor{ProGreen}{RGB}{56,146,94}
\definecolor{ConRed}{RGB}{209,28,22}
\newcommand*\pro{%
  \item[\color{ProGreen}\scalebox{1.5}{\faThumbsOUp}]}
\newcommand*\con{%
  \item[\color{ConRed}\scalebox{1.5}{\faThumbsODown}]}

% FONT
%\setsansfont[BoldFont={Fira Sans},
%Numbers={OldStyle}]{Fira Sans Light}
%\setmathsfont(Digits)[Numbers={Lining, Proportional}]{FiraSans Light}

% BIBLIO
\usepackage[backend=bibtex,style=authoryear-icomp,maxbibnames=9,maxcitenames=2]{biblatex}
\renewcommand*{\nameyeardelim}{\addcomma\addspace}
\bibliography{3DRegistration.bib}
%\setbeamertemplate{bibliography item}{\insertbiblabel} %Removes icon in bibliography
\renewcommand*{\cite}{\parencite}

% INTRO
\title{3D Rigid Registration}
\subtitle{Algorithms survey}
% \date{\today}
\author{Pasquale Antonante}
%\institute{United Technology Research Center}
%\titlegraphic{\hfill\includegraphics[height=0.8cm]{imgs/logo_utrc.png}}

%% UTILITIES
\newcommand{\norm}[1]{\left\lVert#1\right\rVert}
\newcommand{\Ealign}{\bm{q}_i-\bm{T}\bm{p}_i}
\DeclareMathOperator*{\argmin}{argmin}
\DeclareMathOperator*{\argmax}{argmax}

\begin{document}
\maketitle

% ===== BEGIN =====

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Introduction                                      %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}
%%
\begin{frame}[fragile]{Problem definition}
  \begin{alertblock}{Surface registration}
  Surface registration \textbf{transforms} multiple sets of 3D data points into the same coordinate system so as to \textbf{align overlapping} components of these sets.
\end{alertblock}
\end{frame}

%%
\begin{frame}[allowframebreaks]{Basic notation}
Let's consider two point sets $\bm{P}$ and $\bm{Q}$ we want to find a rigid transformation $\bm{T}$ (rotation $\bm{R}$ and translation $\bm{t}$) that aligns $\bm{Q}$ to $\bm{P}$.

In general we want to minimize the error $E(\bm{T})$
\[
%E(\bm{T})=\sum_i{\norm{q_i-\bm{T}p_i}}+E_{\text{reg}}, \quad \text{where}~
E(\bm{T})=E_{\text{align}}+E_{\text{reg}}, \quad \text{where}
\bm{T} = \begin{bmatrix}
   \bm{R} & \bm{t} \\
   \bm{0}^{T} & 1
\end{bmatrix}
\]
$E_{\text{align}}$ measure the \textbf{alignment error} while $E_{\text{reg}}$ is a \textbf{regularization} term.

\framebreak

There are two main metrics to measure the $E_{\text{align}}$
%\begin{equation}
\begin{align}
E_\text{pt-to-pt} &= \sum_i{\norm{\Ealign}^2} \label{pt2pt} \\
E_\text{pt-to-plane} & = \sum_i{\big((\Ealign)\cdot\bm{n}_{q_i}\big)^2} \label{pt2pl}
\end{align}
%\end{equation}

\framebreak

\begin{figure}[htbp]
\begin{center}
\begin{minipage}[b]{0.45\linewidth}
  \centering
  \includegraphics[width=\textwidth,keepaspectratio]{imgs/pt2pt.png}
  \caption{Point-to-Point Distance}
  \label{fig:pt2pt}
\end{minipage}
\begin{minipage}[b]{0.45\linewidth}
  \centering
  \includegraphics[width=\textwidth,keepaspectratio]{imgs/pt2plane.png}
  \caption{Point-to-Plane Distance}
  \label{fig:pt2pl}
\end{minipage}
\end{center}
\caption{Error metrics \cite{bellekens2014survey}}
\end{figure}

\framebreak

Point-to-plane proved to be more stable and faster to converge but\ldots\textbf{Least Sum of Square Errors} has a closed-form solution!

If we know the \textbf{perfect correspondence} of a subset of points (at least 3) we can compute the rigid transformation
\begin{itemize}
  \item Rotation matrix, e.g. \cite{schonemann1966generalized}, \cite{arun1987least}, \cite{horn1988closed}, \cite{umeyama1991least}
  \item Quaternions, e.g. \cite{horn1987closed}
\end{itemize}

But \textbf{true correspondences} are difficult do be found.
\end{frame}

\begin{frame}[allowframebreaks]{(Non)-Convexity Analysis}
Let's focus on the \textbf{point-to-point} formulation.

Define
\begin{itemize}
\item Transformation function as $T_x(\alpha)$ that \textbf{affinely transforms} a point $x$, according to some parameter $\alpha=(\bm{R},\bm{t})$
\item The \textbf{distance-to-a-set operator} $d(x)=\inf_{y\in\mathcal{Y}}\norm{x-y}$
\end{itemize}

The \textbf{residual function} $E(\alpha)=d(T_x(\alpha))$ is \emph{convex} if
\begin{itemize}
  \item \emph{(Condition 1)}. Domain $D_{\alpha}$ is a convex set
  \item \emph{(Condition 2)}. The set $\mathcal{Y}$ is convex\footnote{Proof in~\cite{olsson2009branch}}
\end{itemize}

\framebreak

In our case
\begin{itemize}
  \item \emph{Condition 1} cannot be fulfilled for registration with rotation (due to the constraint $\bm{R}\bm{R}^T=\bm{I}$)
  \item \emph{Condition 2} is rarely fulfilled because set $\mathcal{Y}$  is a scan of complex surfaces
\end{itemize}
Therefore, $E(\alpha)$ is \textbf{non-convex}.
\end{frame}

%\begin{frame}{Closed-Form Solution}

%\end{frame}

\begin{frame}{Global vs Local}
\begin{alertblock}{Global vs. Local}
3D Rigid Registration can be classified according to the used \textbf{underlying optimization method}~\cite{rusu2009fast}:
\begin{itemize}
\item \textbf{Global}% (e.g. Genetic Algorithms)
\item \textbf{Local} (e.g. Iterative Closest Point (ICP))
\end{itemize}
\end{alertblock}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Iterative Closest Points                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Iterative Closest Points (ICP)} %[Besl & McKay 92]
\begin{frame}[shrink=10]{Basic ICP}
\begin{algorithm}[H]
\begin{algorithmic}[1]
%\STATE Estimate initial registration states
%\STATE Apply initial registration
%\WHILE{Alignment MSE greater than threshold}
%\STATE Compute closest points
%\STATE Compute registration $T$
%\STATE Apply registration
%\ENDWHILE
\REQUIRE $\bm{P}$, $\bm{Q}$ and initial estimation $\bm{T}_0$
\ENSURE $\bm{T}$
\STATE $\bm{T}\gets\bm{T}_0$
\WHILE{not converged}
  \FOR{$i\gets 1$ \TO $N$}
    \STATE $\bm{m}_i\gets\text{FindClosestPointInQ}(\bm{T}\bm{p}_i$)
    \IF{$\norm{\bm{m}_i-\bm{T}\bm{p_i}}\leq d_{\text{max}}$}
      \STATE $\omega_i\gets 1$
    \ELSE
      \STATE $\omega_i\gets 0$
    \ENDIF
  \ENDFOR
  \STATE $\bm{T}\gets\argmin\limits_T \sum\limits_i \omega_i \norm{\bm{m}_i-\bm{T}\bm{p}_i}$
\ENDWHILE
\end{algorithmic}
\caption{Iterative Closest Points (ICP)}
\label{alg:ICP}
\end{algorithm}
\end{frame}

\begin{frame}{Considerations}
\begin{itemize}[wide, labelsep=2em]
  \pro Solves the correspondence problem
  \con May get caught in local minima
  \con Require (and depends) an initial registration guess
  \con Computes closest points set each iteration
\end{itemize}
\end{frame}

\begin{frame}{Local Optimization Method}
%ICP is a \textbf{local optimization algorithm} and may get caught in local minima.

There is a lot of work around ICP addressing the local minima issue, some relevant methods are:
\begin{itemize}
	\item \textbf{Robustified Local Methods}
	\item \textbf{Global Methods} (GA, Particle filtering, Simulated Annealing)
	\item \textbf{Globally Optimal Methods} (i.e. BnB)
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Global Go-ICP                                     %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{GO-ICP (2016)}
%%
\begin{frame}{Introduction}
Global-ICP (GO-ICP)~\cite{goicp} optimally solves 3D registration by mixing ICP and BnB.
\begin{figure}[htbp]
\begin{center}
  \includegraphics[width=\textwidth,height=0.45\textheight,keepaspectratio]{imgs/GOICP_collaboration.png}
  \caption{Collaboration of BnB and ICP.}
  \label{fig:goicp_collaboration}
\end{center}
\end{figure}
\end{frame}

\begin{frame}[allowframebreaks]{Domain Parametrization}
To parametrize the search space let's consider the \textbf{angle-axis} representation of rotations, obtaining
\begin{itemize}
	\item the rotation space $SO(3)$ is parametrized in a solid radius-$\pi$ ball
	\item the translation is assumed to be within the cube $[-\xi,\xi]^3$ (denoted as $C_t$)
\end{itemize}
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=\textwidth,height=0.3\textheight,keepaspectratio]{imgs/GOICP_parametrization.png}
\caption{$SE(3)$ space parametrization in GO-ICP}
\label{default}
\end{center}
\end{figure}
\end{frame}

%%
\begin{frame}[allowframebreaks]{Bounding Functions}
For ease of manipulation, let's use the minimum cube $[−\pi,\pi]^3$ that encloses the $\pi$-ball centered in $\bm{r}_0$ as $C_r$.

\begin{theorem}[Uncertainty radius]
Given a 3D point $\bm{p}$, a rotation cube $C_r$ of half side-length $\sigma_r$ with $r_0$ as the center and examining the maximum distance from $\bm{R}_{\bm{r}}\bm{p}$ to $\bm{R}_{\bm{r_0}}\bm{p}$, we have $\forall\bm{r}\in C_r$,
\[ \norm{\bm{R}_r\bm{p}-\bm{R}_{r_0}\bm{p}} \leq 2\sin(\min(\sqrt{3}\sigma_r/2,\pi/2))\norm{\bm{p}} = \gamma_r \]
Or similarly, given a translation cube $C_t$ with half side-length $\sigma_t$ centered at $\bm{t_0}$, we have $\forall\bm{t}\in C_t$
\[ \norm{(\bm{p}+\bm{t}) - (\bm{p}-\bm{t}_0)} \leq \sqrt{3}\sigma_t = \gamma_t \]
\end{theorem}
\end{frame}

%%
\begin{frame}{BnB Bounds}
%Instead of direct 6D space exploration, a \textbf{nested BnB} search is proposed:
%\begin{itemize}
%  \item \textbf{Outer BnB} searches the rotation space of $SO(3)$
%  \item \textbf{Inner BnB} called by the outer BnB, solves the translation problem
%\end{itemize}

%The upper $\overline{E}$ bound and the lower bound $\underline{E}$ for both BnB can be derived~\cite{goicp}.

%\framebreak
For a given rotation cube $C_r$
\begin{equation}
  \begin{array}{ll}
  \overline{E}_r &= \min\limits_{\forall\bm{t}\in\mathcal{C}_t} \sum\limits_i e_i (\bm{R}_{\bm{r}_0}, \bm{t})^2 \\
  \underline{E}_r &= \min\limits_{\forall\bm{t}\in\mathcal{C}_t} \sum\limits_i \max \big(e_i(\bm{R}_{\bm{r}_0},t)-\gamma_{r_i},0\big)^2
  \end{array}
\end{equation}
Similarly, for a given translation cube $C_t$
\begin{equation}
\begin{array}{ll}
  \overline{E}_t &= \sum\limits_i \max\big( e_i(\bm{R}_{\bm{r}_0},\bm{t_0})-\gamma_{r_i}, 0 \big)^2 \\
  \underline{E}_t &= \sum\limits_i \max \big( e_i(\bm{R}_{\bm{r}_0},\bm{t_0}) - (\gamma_{r_i} + \gamma_t),0 \big)^2
\end{array}
\label{eq:goicp_outerbound}
\end{equation}
where $e_i(\bm{R},\bm{t})=\norm{\bm{q}_{j^*}-\bm{R}\bm{p}_i}$, with $\bm{q}_{j^*}$ denoted as optimal correspondence of $\bm{p}_i$; $\mathcal{C}_r$ and $\mathcal{C}_t$ are the initial cubes.
\end{frame}

%%
\begin{frame}[shrink=36]{Go-ICP algorithm}
\begin{columns}
\begin{column}{0.5\textwidth}
  \begin{algorithm}[H] %% outer
  \begin{algorithmic}[1]
  \REQUIRE $\bm{P}$, $\bm{Q}$, threshold $\epsilon$, initial cubes $\mathcal{C}_r$, $\mathcal{C}_t$
  \ENSURE Globally minimal error $E^*$ and corresponding $\bm{r}^*$, $\bm{t}^*$
  \STATE Put $\mathcal{C}_r$ into priority queue $Q_r$
  \STATE Set $E^*=+\infty$
  \LOOP
    \STATE Read out a cube with lowest $\underline{E}_r$ from $Q_r$
    \STATE Quit if $E^*-\underline{E}_r<\epsilon$
    \STATE Divide the cube into 8 sub-cubes
    \FORALL{sub-cube $C_r$}
      \STATE Compute $\overline{E}_r$ for $C_r$ and corresponding optimal $\bm{t}$ by calling alg.\ref{alg:goicp_inner} with $\bm{r}_0$, $\gamma_r=0$ and $E^*$
      \IF{$\overline{E}_r<E^*$}
        \STATE Run ICP with initialization $(\bm{r}_0,\bm{t})$
        \STATE Update $E^*$, $r^*$ and $t^*$ with ICP results
      \ENDIF
      \STATE Compute $\underline{E}_r$ for $C_r$ by calling alg.\ref{alg:goicp_inner} with $\bm{r}_0$, $\gamma_r$ and $E^*$
      \IF{$\underline{E}_r \geq E^*$}
        \STATE Discard $C_r$ and continue the loop
      \ENDIF
      \STATE Put $C_r$ into $Q_r$
    \ENDFOR
  \ENDLOOP
  \end{algorithmic}
  \caption{Go-ICP -- Outer BnB}
  \label{alg:goicp_outer}
  \end{algorithm}
\end{column}

\begin{column}{0.5\textwidth}

  \begin{algorithm}[H] %% inner
  \begin{algorithmic}[1]
  \REQUIRE $\bm{P}$, $\bm{Q}$, threshold $\epsilon$, initial cube $\mathcal{C}_t$, rotation $r_0$, rotation uncertainty radii $\gamma_r$, so-far-best-error $E^*$
  \ENSURE Minimal error $E_t^*$ and corresponding $\bm{t}^*$
  \STATE Put $\mathcal{C}_t$ into priority queue $Q_t$
  \STATE Set $E^*_t = E^*$
  \LOOP
    \STATE Read out a cube with lowest $\underline{E}_t$ from $Q_t$
    \STATE Quit the loop if $E_t^*-\underline{E}_t<\epsilon$
    \STATE Divide the the cube into 8 sub-cubes
    \FORALL{sub-cube $C_T$}
      \STATE Compute $\overline{E}_t$ for $C_t$ by~\ref{eq:goicp_outerbound} with $\bm{r}_0$, $\bm{t}_0$ and $\gamma_r$
      \IF{$\overline{E}_t<E_t^*$}
        \STATE Update $E_t^*=\overline{E}_t$, $t^*=t_0$
      \ENDIF
      \STATE Compute $\underline{E}_t$ for $C_t$ by~\ref{eq:goicp_outerbound} with $\bm{r}_0$, $\bm{T}_0$ and $\gamma_t$
      \IF{$\underline{E}_t \geq E_t^*$}
        \STATE Discard $C_t$ and continue the loop
      \ENDIF
      \STATE Put $C_t$ into $Q_r$
    \ENDFOR
  \ENDLOOP
  \end{algorithmic}
  \caption{Go-ICP -- Inner BnB}
  \label{alg:goicp_inner}
  \end{algorithm}

\end{column}
\end{columns}
\end{frame}

%%
\begin{frame}[allowframebreaks]{Experiment}
\begin{figure}[htbp]
\begin{center}
  \includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{imgs/GOICP_eval.png}
  \caption{Running time of the Go-ICP method on the bunny and dragon point-sets with respect to different factors.}
  \label{fig:goicp_evaluation}
\end{center}
\end{figure}
\hspace{2em}
\begin{figure}[htbp]
\begin{center}
  \includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{imgs/GOICP_timehistogram.png}
  \caption{Running time histograms of Go-ICP for the bunny (left) and dragon (right) point-sets.}
  \label{fig:goicp_timehistogram}
\end{center}
\end{figure}
\end{frame}

%%
\begin{frame}{Go-ICP Trimming}
In \cite{goicp} a \textbf{trimmed} version of the algorithm is also proposed. Specifically, in each iteration, only a subset $\bm{S}$ of the data points are used for motion computation.

This is a strategy to obtain a more robust statistic by excluding some of the extreme values.
\end{frame}

\begin{frame}{Considerations}
\begin{itemize}[wide, labelsep=2em]
  \pro Finds the global optimal solution
  \pro Defines upper and lower bound in domain regions
  \pro Not constrained to ICP variants
  \pro Parallelism can speed up computation a lot
  \con Limited to pt-to-pt distance
  \con Computes closest points set each iteration
  \con Computationally demanding
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Generalized ICP                                   %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Generalized ICP (2009)}
%%
\begin{frame}[allowframebreaks]{Derivation}
The Generalized-ICP~\cite{gicp} uses \textbf{probabilistic approach} to increase robustness by changing
\[ \bm{T}\gets\argmin\limits_T \sum\limits_i \omega_i \norm{\bm{m}_i-\bm{T}\bm{p}_i} \]
in the basic ICP algorithm (alg.~\ref{alg:ICP}).

\framebreak

For the purpose of this section let's assume that:
\begin{itemize}
  \item $\bm{p}_i$ is a correspondence for $\bm{q}_i$ (and vice versa) - W.L.O.G.
  \item $\hat{\bm{P}}=\{\hat{\bm{p}}_i\}, \quad \bm{p}_i \sim \mathcal{N}(\hat{\bm{p}}_i,\bm{C}_i^P)$
  \item $\hat{\bm{Q}}=\{\hat{\bm{q}}_i\}, \quad \bm{q}_i \sim \mathcal{N}(\hat{\bm{q}}_i,\bm{C}_i^Q)$
\end{itemize}
where $\bm{C}_i^P$ and $\bm{C}_i^Q$ are covariance matrices associated with the measured points.

%\framebreak
%%(geometrically consistent with no errors due to occlusion or sampling)
%Assuming \textbf{perfect correspondences} we have a transformation $\bm{T}^*$ such that
%\[\hat{\bm{q}_i}=\bm{T}^*\hat{\bm{p}_i} \]

%For an arbitrary rigid transformation, $\bm{T}$, define
%\[ d_i^{(\bm{T})}=\bm{q}_i-\bm{T}\bm{p}_i \]

%Consider the distribution from which $d(\bm{T}^*)$ is drawn. Since $\bm{p}_i$ and $\bm{q}_i$ are assumed to be drawn from independent Gaussians,
%\[
%\begin{array}{ll}
%d_i^{(\bm{T}^*)} &\sim \mathcal{N}\Big(\bm{q}_i - (\bm{T}^*)\bm{p}_i,~ \bm{C}_i^Q +(\bm{T}^*)\bm{C}_i^P(\bm{T}^*)^T \Big) \\
%&= \mathcal{N}\Big( 0,~ \bm{C}_i^Q +(\bm{T}^*)\bm{C}_i^P(\bm{T}^*)^T \Big)
%\end{array}
%\]

\framebreak

%We can use \textbf{Maximum likelihood estimation} to iteratively compute $\bm{T}$
%\[ \bm{T} = \argmax\limits_{\bm{T}} \prod\limits_i p\big( d_i^{(\bm{T})} \big)
%     = \argmax\limits_{\bm{T}} \sum\limits_i \log \big(
%     p\big( d_i^{(\bm{T})} \big) \big)
%\]
%that can be simplified to
%\begin{equation}
%\bm{T} = \argmin\limits_{\bm{T}} \sum\limits_i {d_i^{(\bm{T})}}^T ( \bm{C}_i^Q+ \bm{T} \bm{C}_i^P \bm{T}^T)^{-1} d_i^{(\bm{T})}
%\end{equation}
%This defines the \textbf{key step} of the Generalized-ICP algorithm.

We can use \textbf{Maximum likelihood estimation} to iteratively compute $\bm{T}$
\[ \bm{T} = \argmax\limits_{\bm{T}} \prod\limits_i p\big( \Ealign \big)
     = \argmax\limits_{\bm{T}} \sum\limits_i \log \big(
     p\big( \Ealign \big) \big)
\]
that can be simplified to
\begin{equation}
\bm{T} = \argmin\limits_{\bm{T}} \sum\limits_i (\Ealign)^T ( \bm{C}_i^Q+ \bm{T} \bm{C}_i^P \bm{T}^T)^{-1} (\Ealign)
\end{equation}
This defines the \textbf{key step} of the Generalized-ICP algorithm (Mahalanobis distance).
\end{frame}

\begin{frame}{Results}
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=\textwidth,keepaspectratio]{imgs/gicp.png}
\caption{Average error}
\label{fig:gicp}
\end{center}
\end{figure}
\end{frame}

\begin{frame}{Considerations}
\begin{itemize}[wide, labelsep=2em]
  \pro Probabilistic approach
  \pro Covariance matrices give good flexibility
  \con Covariance matrices can be complex to compute
  \con Might get caught in local minima
  \con Still dependent on initial guess
  \con No closed form solution for $\bm{T}$ is available
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Learning Anisotropic ICP                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Learning Anisotropic ICP (2016)}

\begin{frame}{Principle}
%Within the generalized ICP framework, we need to have some strategies to determine the values of covariances.

\begin{figure}[htbp]
\begin{center}
  \includegraphics[height=0.5\textheight,keepaspectratio]{imgs/LAICP.png}
  %\caption{LA-ICP}
  \label{fig:LAICP}
\end{center}
\end{figure}
\textbf{Idea:} Learning Anisotropic ICP \cite{lee2016learning}, assumes anisotropic Gaussian, and estimates the covariance. The learning scheme does not require manual tuning and the covariance is continually updated from observed data.
\end{frame}

\begin{frame}{Pros and Cons}
\begin{itemize}[wide, labelsep=2em]
\setlength\itemsep{1em}
\pro Assumes anisotropic noise
\pro Reduces computational overhead due to covariance matrices
\con Still local optimization method
\end{itemize}
\end{frame}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%       Fast Global Registration                          %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Fast Global Registration (2016)}
%%
\begin{frame}{Introduction}
Let $\mathcal{K}=\{(p,q)\}$ be a set of \textbf{correspondences} collected by matching points from $\bm{P}$ and $\bm{Q}$.% as described in slide \ref{fpfh_correspondences}.

We want to minimize:
\begin{equation}
\label{eq:fastgo_obj}
E(\bm{T})=\sum_{(p,q)\in\mathcal{K}}\rho({\norm{q_i-\bm{T}p_i}})
\end{equation}
where $\rho(\cdot)$ is a \textbf{robust penalty function}, i.e. \alert{scaled Geman-McClure estimator}.
\end{frame}

%%
\begin{frame}{Scaled Geman-McClure estimator}
Using this estimator small residuals are penalized in the LS sense:
\begin{equation}
\rho(x)=\frac{\mu x^2}{\mu+x^2}
\end{equation}
\begin{figure}[htbp]
\begin{center}
\includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{imgs/geman_estimator.png}
\caption{Geman-McClure estimator vs. Objective function (\ref{eq:fastgo_obj})}
\label{fig:geman}
\end{center}
\end{figure}
%The parameter $\mu$ controls the range within which residuals have a significant effect on the objective.
\end{frame}

%%
\begin{frame}[allowframebreaks]{Black-Ragarajan duality}
Objective function (\ref{eq:fastgo_obj}) is difficult to optimize directly, so the authors used \textbf{Black-Ragarajan duality} between line process and robust estimation \cite{black1996unification}.

Let's $\mathbb{L}=\{l_{(p,q)}\}$ a line process over the correspondences, we can write a new objective function optimized over $\bm{T}$ and $\mathbb{L}$.
\begin{equation}
\label{eq:fastgo_fullobj}
E(\bm{T},\mathbb{L})=\sum_{(p,q)\in\mathcal{K}}\big(l_{(p,q)}\norm{p-\bm{T}q}^2+\Psi(l_{(p,q)})\big)
\end{equation}
where
\[ \Psi(l_{(p,q)}) = \mu \big( \sqrt{l_{(p,q)}} -1 \big)^2 \]

Minimizing (\ref{eq:fastgo_fullobj}) over $\mathbb{L}$ we have:
\[ \frac{\partial{E}}{\partial{l_{(p,q)}}} = \norm{p-\bm{T}q} +\mu\frac{\sqrt{l_{(p,q)}} -1}{\sqrt{l_{(p,q)}}}  = 0 \]
Solving for $l_{(p,q)}$ yields
\begin{equation}\label{eq:fgr_lattice}
 l_{(p,q)} =  \Bigg( \frac{\mu}{\mu + \norm{p-\bm{T}q}^2}  \Bigg)^2
 \end{equation}

Substituting $l_{(p,q)}$ in (\ref{eq:fastgo_fullobj}) we obtain (\ref{eq:fastgo_obj}). Thus \textbf{optimizing objective (\ref{eq:fastgo_fullobj}) yields a solution $\bm{T}$ that is also optimal for the original objective (\ref{eq:fastgo_obj})}.

\alert{What about the correspondences?}
\end{frame}

%%

\begin{frame}[allowframebreaks]{Fast Point Feature Histogram (FPFH)}
\begin{itemize}
\item The goal of FPFH is to encode a point's \textbf{k-neighborhood geometrical properties}.
\item The complexity is $O(kN)$, where $k$ is the number of neighbors for each point~\cite{rusu2009fast}
\item It is based on the \textbf{Simple Point Feature Histogram (SPFH)}
\end{itemize}

\framebreak

\textbf{Simple Point Feature Histogram (SPFH)}
\par
For each query point $\bm{p}_q$,
\begin{itemize}
\item Compute the $k$-neighborhood set $P_k^q$
\item Compute the tuple $(\alpha,\phi,\theta)$ between $\bm{p}_q$ and each $\bm{p}_k\in P_k^q$
\begin{equation}
\begin{array}{ll}
\bm{u} & = \bm{n}_q \\
\bm{v} & = \bm{u} \times \frac{(\bm{p}_k-\bm{p}_q)}{\norm{\bm{p}_k-\bm{p}_q}} \\
\bm{w} & = \bm{u} \times \bm{v}
\end{array}	\qquad \Rightarrow \qquad
\begin{array}{ll}
\alpha & = \bm{v}\cdot\bm{n}_k \\
\phi & = \bm{u} \cdot \frac{(\bm{p}_k-\bm{p}_q)}{\norm{\bm{p}_k-\bm{p}_q}_2} \\
\theta & = \arctan(\bm{w}\cdot\bm{n}_q, \bm{u}\cdot\bm{n}_k)
\end{array}
\end{equation}
\item Bin all $(\alpha,\phi,\theta)$ into a histogram
\end{itemize}

\framebreak

To compute the FPFH histogram feature:
\begin{itemize}
  \item for each query point $\bm{p}_q$ compute the SPFH
  \item for each point its $k$ neighbors are re-determined, and the neighboring SPFH values are used to weight the final histogram of $\bm{p}_q$ (called FPFH) as in eq.\ref{eq:fpfh}
\end{itemize}

\begin{equation}
\label{eq:fpfh}
\text{FPFH}(\bm{p}_q)=\text{SPFH}(\bm{p}_q)+\frac{1}{k}\sum_{i=1}^{k}\frac{1}{\omega_k}\cdot\text{SPFH}(\bm{p}_k)
\end{equation}
where the weight $\omega_k$ represents a distance between the query point $\bm{p}_q$ and a neighbor point $\bm{p}_k$ in some given metric space.

%\begin{figure}[htbp]
%\begin{center}
%\begin{minipage}[b]{0.45\linewidth}
%            \centering
%            \includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{imgs/DarbouxFrame.png}
%	    \caption{Darboux Frame}
%            \label{fig:DarbouxFrame}
%        \end{minipage}
%        \hspace{0.5cm}
%        \begin{minipage}[b]{0.45\linewidth}
%            \centering
%             \includegraphics[width=\textwidth,height=0.3\textheight,keepaspectratio]{imgs/FPFH_NN.png}
%	    \caption{The influence region diagram for a Point Feature Histogram.}
%            \label{fig:FPFH_NN}
%        \end{minipage}
%\end{center}
%\end{figure}
\end{frame}

%%
\begin{frame}[allowframebreaks]{Correspondences set}\label{fpfh_correspondences}
The correspondence set is build as following, let
\begin{itemize}
\item $F(\bm{P})=\{F(\bm{p}):\bm{p}\in\bm{P}\}$ the FPFH of points in $\bm{P}$
\item $F(\bm{Q})=\{F(\bm{q}):\bm{q}\in\bm{Q}\}$ the FPFH of points in $\bm{Q}$
\end{itemize}

$\mathcal{K}_1$ is the set containing the nearest neighbor of $F(\bm{p})$ among $F(\bm{Q})$, and vice versa.

\framebreak

We can improve the correspondences set by applying:
\begin{description}
\item[Reciprocity test] A correspondence pair $(\bm{p}, \bm{q})$ is selected from $\mathcal{K}_1$ if and only if $F(\bm{p})$ is the nearest neighbor of $F(\bm{q})$ among $F(\bm{P})$ and $F(\bm{q})$ is the nearest neighbor of $F(\bm{p})$ among $F(\bm{Q})$. The resulting correspondence set is denoted by $\mathcal{K}_2$
\item[Tuple test] Randomly pick 3 correspondence pairs $(\bm{p_1}, \bm{q_1})$, $(\bm{p_2}, \bm{q_2})$, $(\bm{p_3}, \bm{q_3})$ from $\mathcal{K}_2$ and check if the tuples $(\bm{p_1}, \bm{p_2}, \bm{p_3})$ and $(\bm{q_1}, \bm{q_2}, \bm{q_3})$ are compatible
\[ \forall i\neq j, \quad \tau \le \frac{\norm{p_i-p_j}}{\norm{q_i-q_j}} \le \frac{1}{\tau}, \quad \tau=0.9 \]
This is the set used by the algorithm $\mathcal{K} = \mathcal{K}_3$
\end{description}
\end{frame}

%%
\begin{frame}{Fast Global Registration Algorithm}
Let $D$ be the diameter of the largest surface and $\delta$ the distance threshold for genuine correspondence
\begin{algorithm}[H]
\begin{algorithmic}[1]
\STATE{Compute normals $\{\bm{n}_p\}$ and $\{\bm{n}_q\}$}
\STATE{Compute $F(\bm{P})$ and $F(\bm{Q})$}
\STATE{Compute $\mathcal{K}=\mathcal{K}_3$}
%\STATE{Build $\mathcal{K}_1$ by computing nearest neighbors between $\bm{F}(\bm{P})$ and $\bm{F}(\bm{Q})$}
%\STATE{Apply reciprocity test on $\mathcal{K}_1$ to get $\mathcal{K}_2$}
%\STATE{Apply tuple test on $\mathcal{K}_2$ to get $\mathcal{K}_3$}
\STATE{$\bm{T}\gets \bm{I},~\mu\gets D^2$}
\WHILE{not converged or $\mu>\delta^2$}
\FOR{$(p,q)\in\mathcal{K}$}
\STATE{Compute $l_{(p,q)}$ using equation~\ref{eq:fgr_lattice}}
\ENDFOR
\STATE{Compute $\bm{T}$ (closed form~\cite{horn1987closed})}
\STATE{Every four iterations $\mu\gets \mu/2$}
\ENDWHILE
\end{algorithmic}
\caption{Fast Global Registration}
\label{alg:fastglobalregistration}
\end{algorithm}
\end{frame}

%%
\begin{frame}[allowframebreaks]{Performance}
\begin{figure}[htbp]
\begin{center}
\centering
\includegraphics[width=1.5\textheight,keepaspectratio]{imgs/RMSE_fgr.png}
\caption{Average and maximal RMSE achieved by global registration algorithms on synthetic range images with noise level $\sigma$}
\label{fig:fastgo_RMSR}
\end{center}
\end{figure}
\begin{figure}[htbp]
\begin{center}
\centering
\includegraphics[width=1.5\textheight,keepaspectratio]{imgs/Time_fgr.png}
\caption{Running times of global registration methods, measured in seconds}
\label{fig:fastgo_time}
\end{center}
\end{figure}

%\framebreak

%\begin{figure}[htbp]
%\begin{center}
%\centering
%\includegraphics[width=1.5\textheight,keepaspectratio]{imgs/LocalRMSE_fgr.png}
%\caption{Controlled comparison with local methods. Perturbation refers to initialization}
%\label{fig:fastgo_lacalRMSE}
%\end{center}
%\end{figure}
\begin{figure}[htbp]
\begin{center}
\centering
\includegraphics[width=1.5\textheight,keepaspectratio]{imgs/LocalTime_fgr.png}
\caption{Timing comparison with local algorithms, measured in seconds}
\label{fig:fastgo_lacalTime}
\end{center}
\end{figure}
\end{frame}

%%
\begin{frame}{Pros and Cons}
\begin{itemize}[wide, labelsep=2em]
\setlength\itemsep{1em}
\pro Global optimization
%\pro Matches ICP performance (both local and global)
\pro One order of magnitude faster
\pro Does not require initialization
\pro Correspondences computed only once but their weight change
\con No proof of global convergence in the paper
\end{itemize}
\end{frame}

% ===== BIB =====

\begin{frame}[allowframebreaks]{References}
\printbibliography
\end{frame}

\end{document}


% MARINA VON STEINKIRCH, SPRING/2013
% http://mysbfiles.stonybrook.edu/~mvonsteinkir/
\documentclass[11pt]{article}

\usepackage{epsfig}
\usepackage{color}
\usepackage{amsmath}    % Package  for subequations
\usepackage{graphicx}   % Package for figures
\usepackage{verbatim}   % Package  for program listings
\usepackage{hyperref}   % Package  for hypertext links, external documents and URLs
\usepackage{amssymb} % For mathematical constructions
\usepackage{latexsym} % Package to generate mathematical symbols
\usepackage{makeidx} % Package to generate an index in the end

\newcommand{\ie}{{\it i.e., }}
\newcommand{\eg}{{\it e.g., }}

\title{CSE 590: Computational Photography\\  Homework \#2: Image Blending }
\author{ \texttt{ Marina von Steinkirch, steinkirch@gmail.com}\\
	   \texttt{State University of New York at Stony Brook}}
\date{\today}

\begin{document}
\maketitle
\numberwithin{equation}{section}

\section{Introduction}

This project explores the gradient-domain processing, a technique with many applications including:
\begin{itemize}
\item blending,
\item tone-mapping,
\item and non-photorealistic rendering.
\end{itemize}

\quad

The  goal of this assignment is to {\it seamlessly blend} an object  from a source image into a target image. If we naively tried a simple cut and paste, we would see noticeable {\it seams}.  However, using the {\it Poisson blending technique} \cite{pois}, we are able  to achieve better results than just cutting and pasting.  The technique consists on finding values for the target pixels that {\it maximally preserve the gradient} of the source region, without changing any of the background pixels. In other words, we preserve the integrity of the gradient at the seams.

\quad

The Poisson blending technique is solved as a {\it least squares problem}, \ie given the pixel intensities of the source image, $s$, and of the target image, $t$, we  solve for {\it new intensity values},  $v$, within the source region $S$:

\begin{equation}
v = \mbox{ argmin} \sum_{i \in S, j \in N_i, S} \Bigg ( \Big ( v_i -v_j\Big) - \Big (s_i - s_j \Big) \Bigg)^2 +  \sum_{i \in S, j \in N_i, -S} \Bigg ( \Big ( v_i -t_j\Big) - \Big (s_i - s_j \Big) \Bigg)^2.
\label{aa}
\end{equation}

\quad

The idea is to recover an image that is best reflected by this edited gradient. Since the gradient provides us with linear constraints for every pixel in every color channel,
$$I_{i,j} - I_{i+1,j} = \frac{\partial}{\partial x},$$
and
$$I_{i,j} - I_{i,j+1} = \frac{\partial}{\partial y},$$
 we can formulate a {\it overdetermined system of linear equations}. Moreover, we set the desired {\it gradient field} $A x$ equals to the constraints defined by the vector field $b$ of the two images. The matrix $A$ can be seen as the representation of the gradient as a  {\it linear transformation} of the original image $x$. The result is a {\it large linear system} for each color channel with {\it one variable per pixel}, $Ax=b$.

\quad

\section{Results}

\quad

\subsection*{Toy Model: Reconstruction of an Image from its Gradient}

We start by showing that an image can be reconstructed by its gradient values, where we:
\begin{itemize}
\item preserve x-y gradients, and
\item preserve intensity of one pixel.
\end{itemize}

\quad

For this objective, we denote the {\it intensity of the source image} at $(x, y)$ as $s(x,y)$ and the value to solve for as $v(x,y)$ and, for each pixel, we had three objectives:
\begin{itemize}
\item minimize $\Bigg (v(x+1,y)-v(x,y)\Big) - \Big(s(x+1,y)-s(x,y)\Big) \Bigg)^2 $,
\item minimize $\Bigg( \Big(v(x,y+1)-v(x,y)\Big) - \Big(s(x,y+1)-s(x,y)\Big) \Bigg)^2 $,
\item minimize $\Big(v(1,1)-s(1,1)\Big)^2 $, \ie adding any constant value to $v$.
\end{itemize}

\quad

Processing the sample image with this recipe return an identical image, with  {\it root square} equal to $2.3631\times 10^{-5}$.

\quad

\subsection*{Poisson Blending}

To solve the Poisson blending for two images, we implement the following steps:
\begin{enumerate}
\item we select source and target regions (Fig. \ref{1}-1 and  \ref{1}-2),
\item we get a mask for the source image, and align the two images and the mask (Fig. \ref{1}-3 and \ref{1}-4),
\item we solve the blending constraints described in the Eq. \ref{aa},
\item we copy the solved values into the target image, where for RGB images each channel is processed separately. The cut and past and the final blending results can be seen in the Fig. \ref{1}-5 and  \ref{1}-6.
\end{enumerate}

\quad

In the Figs. \ref{1}, we see that the Poisson blending worked nicely (no seams). This is due the fact that  the penguin is surrounded by snow in the source image, matching the snow in the background of the target image. We also notice that  the overall intensity of the penguin is darker with the Poisson blending technique. This is due the fact that the intensity of the surrounding snow is slightly darker in the target area.

\quad

The same successful result can be see in the Fig. \ref{2}. The figures also  illustrate the noticeable seam in the naive cut and paste cropping.  In the other hand, in the Figs. \ref{3} and \ref{4} we see some failure examples of the Poisson blending. This is due the fact that the background of the two chosen images do not match even when taking the gradients.

\quad

\begin{figure} [ht]
\begin{center}
\includegraphics[scale=0.44]{results_poisson/set1/im1.png}
\includegraphics[scale=0.44]{results_poisson/set1/im2.png}
\includegraphics[scale=0.44]{results_poisson/set1/im3.png}
\includegraphics[scale=0.44]{results_poisson/set1/im4.png}
\includegraphics[scale=0.44]{results_poisson/set1/im5.png}
\includegraphics[scale=0.44]{results_poisson/set1/im6.png}
\caption{Sample example of Poisson blending. (left, top) Source object, (middle, top) background image, (right, top) aligned source, (left, bottom) user input mask, (middle, bottom) cut and paste result, (right, bottom) Poisson blending final result.}
\label{1}
\end{center}
\end{figure}

\quad

\begin{figure} [ht]
\begin{center}
\includegraphics[scale=0.29]{results_poisson/set4/im1.jpg}
\includegraphics[scale=0.155]{results_poisson/set4/im2.jpg}\\
\includegraphics[scale=0.54]{results_poisson/set4/im4.png}
\includegraphics[scale=0.39]{results_poisson/set4/im5.png}
\caption{My favorite blending result. (left, top) Source object, (right, top) background image,   (left, bottom) cut and paste result, (right, bottom) Poisson blending final result.}
\label{2}
\end{center}
\end{figure}

\quad

\begin{figure} [ht]
\begin{center}
\includegraphics[scale=0.2]{results_poisson/set2/im1.jpg}
\includegraphics[scale=0.2]{results_poisson/set2/im2.jpg}
\includegraphics[scale=0.49]{results_poisson/set2/im4.png}
\includegraphics[scale=0.44]{results_poisson/set2/im5.png}
\caption{An failure example of Poisson example: the texture of the background of the two images are too distant for a simple gradient mixing. (left, top) Source object, (right, top) background image,   (left, bottom) cut and paste result, (right, bottom) Poisson blending final result.}
\label{3}
\end{center}
\end{figure}

\quad

\begin{figure} [ht]
\begin{center}
\includegraphics[scale=0.12]{results_poisson/set5/im1.jpg}
\includegraphics[scale=0.28]{results_poisson/set5/im2.jpg}
\includegraphics[scale=0.54]{results_poisson/set5/im4.png}
\includegraphics[scale=0.47]{results_poisson/set5/im5.png}
\caption{Another failure  example of Poisson example, here the gradient literally changes the color of the Sun, however in the object are not corrected.(left, top) Source object, (right, top) background image,   (left, bottom) cut and paste result, (right, bottom) Poisson blending final result.}
\label{4}
\end{center}
\end{figure}

\quad

\subsection*{Mixed Blending}
To improve cases where we see failure in the Poisson bending,  we try to implement an adaptation of the Eq. \ref{aa},
\begin{equation}
v = \mbox{ argmin} \sum_{i \in S, j \in N_i, S} \Bigg ( \Big ( v_i -v_j\Big) - d_{i,j} \Bigg)^2 +  \sum_{i \in S, j \in N_i, -S} \Bigg ( \Big ( v_i -t_j\Big) - d_{i,j} \Bigg)^2,
\end{equation}
where $d_{i,j}$ is the value of the gradient from the source or the target image with {\it larger magnitude}. However this technique  did not show any improvement in the above examples.

\newpage

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%		Ref		%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{thebibliography}{}

\bibitem{mike}{\it Tamara Berg's Class}, {\it http://www.tamaraberg.com/teaching/Spring13/compphotog/3}

\bibitem{pois} {\it Poisson Editing}, Patrick Perez, Michel Gangnet, $\&$ Andrew Blacke, 2003

\end{thebibliography}

\end{document}


\chapter{Small oscillations-solutions}
\begin{abox}
	Practice set 1
\end{abox}
\begin{enumerate}
		\item  A particle of unit mass moves in a potential $V(x)=a x^{2}+\frac{b}{x^{2}}$, where $a$ and $b$ are positive constants. The angular frequency of small oscillations about the minimum of the potential is
		{\exyear{NET JUNE 2011}}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\sqrt{8 b}$
		\task[\textbf{B.}]$\sqrt{8 a}$
		\task[\textbf{C.}] $\sqrt{8 a / b}$
		\task[\textbf{D.}]$\sqrt{8 b / a}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		V(x)&=a x^{2}+\frac{b}{x^{2}} \Rightarrow \frac{\partial V}{\partial x}=0 \Rightarrow 2 a x-\frac{2 b}{x^{3}}=0 \Rightarrow a x^{4}-b=0 \Rightarrow x_{0}=\left(\frac{b}{a}\right)^{\frac{1}{4}}\\
		\text { Since } \omega&=\sqrt{\frac{k}{m}}, m=1\\
		k&=\left.\frac{\partial^{2} V}{\partial x^{2}}\right|_{x=x_{0}} \text { where } x_{0} \text { is stable equilibrium point. }\\
		\text { Hence } k&=\frac{\partial^{2} V}{\partial x^{2}}=2 a+\frac{6 b}{x_{0}^{4}}=2 a+\frac{6 b}{b /}=8 a \text { at } x=x_{0}=\left(\frac{b}{a}\right)^{\frac{1}{4}}\\
		\text { Thus, } \omega&=\sqrt{8 a} \text {. }
		\end{align*}
		The correct option is \textbf{(b)}
	\end{answer}
		\item Consider the motion of a classical particle in a one dimensional double-well potential $V(x)=\frac{1}{4}\left(x^{2}-2\right)^{2} .$ If the particle is displaced infinitesimally from the minimum on the $x$-axis (and friction is neglected), then
		{\exyear{NET JUNE 2012}}
	\begin{tasks}(1)
		\task[\textbf{A.}] the particle will execute simple harmonic motion in the right well with an angular frequency $\omega=\sqrt{2}$
		\task[\textbf{B.}]the particle will execute simple harmonic motion in the right well with an angular frequency $\omega=2$
		\task[\textbf{C.}]the particle will switch between the right and left wells
		\task[\textbf{D.}]the particle will approach the bottom of the right well and settle there
	\end{tasks}
	\begin{answer}
		\begin{align*}
		V(x)&=\frac{1}{4}\left(x^{2}-2\right)^{2} \Rightarrow \frac{\partial V}{\partial x}=\frac{2}{4}\left(x^{2}-2\right) \times 2 x=0 \Rightarrow x=0, x=\pm \sqrt{2}\\
		\frac{\partial^{2} V}{\partial x^{2}}&=3 x^{2}-2\\
		\text { At } x=0, \frac{\partial^{2} V}{\partial x^{2}}&<0 \text { so } V \text { is maximum. Thus it is unstable point }\\
		\left.\frac{\partial^{2} V}{\partial x^{2}}\right|_{x=\pm \sqrt{2}}&=4 \text { and it is stable equilibrium point with } \omega=\sqrt{\frac{\left.\frac{\partial^{2} V}{\partial x^{2}}\right|_{x=x_{0}}}{\mu}}=2 \quad \because \mu=1 \text {. }
		\end{align*}
		The correct option is \textbf{(b)}
	\end{answer}

		\item Three particles of equal mass $(\mathrm{m})$ are connected by two identical massless springs of stiffness constant $(K)$ as shown in the figure\\
		\begin{figure}[H]
			\centering
			\includegraphics[height=1cm,width=5cm]{problem1}
		\end{figure}
		If $x_{1}, x_{2}$ and $x_{3}$ denote the horizontal displacement of the masses from their respective equilibrium positions the potential energy of the system is
		{\exyear{NET DEC 2012}}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\frac{1}{2} K\left[x_{1}^{2}+x_{2}^{2}+x_{3}^{2}\right]$
		\task[\textbf{B.}]$\frac{1}{2} K\left[x_{1}^{2}+x_{2}^{2}+x_{3}^{2}-x_{2}\left(x_{1}+x_{3}\right)\right]$
		\task[\textbf{C.}]$\frac{1}{2} K\left[x_{1}^{2}+2 x_{2}^{2}+x_{3}^{2}-2 x_{2}\left(x_{1}+x_{3}\right)\right]$
		\task[\textbf{D.}]$\frac{1}{2} K\left[x_{1}^{2}+2 x_{2}^{2}-2 x_{2}\left(x_{1}+x_{3}\right)\right]$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		V&=\frac{1}{2} K\left(x_{2}-x_{1}\right)^{2}+\frac{1}{2} K\left(x_{3}-x_{2}\right)^{2}\\
		V&=\frac{1}{2} K\left(x_{2}^{2}+x_{1}^{2}-2 x_{2} x_{1}\right)+\frac{1}{2} K\left(x_{3}^{2}+x_{2}^{2}-2 x_{3} x_{2}\right)\\
		V&=\frac{1}{2} K\left[x_{1}^{2}+2 x_{2}^{2}+x_{3}^{2}-2 x_{2}\left(x_{1}+x_{3}\right)\right]
		\end{align*}
		The correct option is \textbf{(c)}
	\end{answer}
		\item The time period of a simple pendulum under the influence of the acceleration due to gravity $g$ is $T$. The bob is subjected to an additional acceleration of magnitude $\sqrt{3} g$ in the horizontal direction. Assuming small oscillations, the mean position and time period of oscillation, respectively, of the bob will be
		{\exyear{NET JUNE 2014}}
	\begin{tasks}(2)
		\task[\textbf{A.}] $0^{\circ}$ to the vertical and $\sqrt{3} T$
		\task[\textbf{B.}]$30^{\circ}$ to the vertical and $T / 2$
		\task[\textbf{C.}]$60^{\circ}$ to the vertical and $T / \sqrt{2}$
		\task[\textbf{D.}]$0^{\circ}$ to the vertical and $T / \sqrt{3}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		T&=2 \pi \sqrt{\frac{l}{g}}\\
		g^{\prime}&=\sqrt{3 g^{2}+g^{2}}=\sqrt{4 g^{2}}=2 g\\
		T^{\prime}&=2 \pi \sqrt{\frac{l}{2 g}} \Rightarrow T^{\prime}=2 \pi \sqrt{\frac{l}{g}} \cdot \frac{1}{\sqrt{2}} \Rightarrow T^{\prime}=\frac{T}{\sqrt{2}}\\
		T \cos \theta&=m g, T \sin \theta=\sqrt{3} m g \Rightarrow \tan \theta=\sqrt{3} \Rightarrow \theta=60^{\circ}
		\end{align*}
		The correct option is \textbf{(c)}
	\end{answer}
		\item A particle of mass $m$ is moving in the potential $V(x)=-\frac{1}{2} a x^{2}+\frac{1}{4} b x^{4}$ where $a, b$ are positive constants. The frequency of small oscillations about a point of stable equilibrium is
		{\exyear{NET DEC 2014}}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\sqrt{a / m}$
		\task[\textbf{B.}]$\sqrt{2 a / m}$
		\task[\textbf{C.}]$\sqrt{3 a / m}$
		\task[\textbf{D.}]$\sqrt{6 a / m}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		\because V(x)&=-\frac{1}{2} a x^{2}+\frac{1}{4} b x^{4}	\\
		\frac{\partial V}{\partial x}&=0 \Rightarrow-a x+b x^{3}=0 \Rightarrow x\left[-a+b x^{2}\right]=0 \Rightarrow x=\pm\left(\frac{a}{b}\right)^{\frac{1}{2}}, 0\\
		\because \frac{\partial^{2} V}{\partial x^{2}}&=-a+3 b x^{2}\\
		\text { At } x=0, \frac{\partial^{2} V}{\partial x^{2}}&=-a \text { (Negative so it is unstable point) }\\
		\left.\frac{\partial^{2} V}{\partial x^{2}}\right|_{x=\pm\left(\frac{a}{b}\right)^{\frac{1}{2}}}&=-a+3 b \frac{a}{b}=2 a \text { (Positive so it is stable point) }\\
		\Rightarrow \omega&=\sqrt{\frac{\frac{\partial^{2} V}{\partial x^{2}}}{m}}=\sqrt{\frac{2 a}{m}}
		\end{align*}
		The correct option is \textbf{(b)}
	\end{answer}
		\item A particle of mass $m$, kept in potential $V(x)=-\frac{1}{2} k x^{2}+\frac{1}{4} \lambda x^{4}$ (where $k$ and $\lambda$ are positive constants), undergoes small oscillations about an equilibrium point. The frequency of oscillations is
		{\exyear{NET JUNE 2018}}
	\begin{tasks}(2)
		\task[\textbf{A.}] $\frac{1}{2 \pi} \sqrt{\frac{2 \lambda}{m}}$
		\task[\textbf{B.}]$\frac{1}{2 \pi} \sqrt{\frac{k}{m}}$
		\task[\textbf{C.}]$\frac{1}{2 \pi} \sqrt{\frac{2 k}{m}}$
		\task[\textbf{D.}]$\frac{1}{2 \pi} \sqrt{\frac{\lambda}{m}}$
	\end{tasks}
	\begin{answer}
		\begin{align*}
		V&=-\frac{1}{2} k x^{2}+\frac{1}{4} \lambda x^{4}\\
		\frac{d V}{d x}&=0 \quad-k x+\lambda x^{3}=0\\
		x=0, \quad x^{2}&=\frac{k}{\lambda} \Rightarrow x=x_{0}=\sqrt{\frac{k}{\lambda}}\\
		\frac{d^{2} V}{d x^{2}}&=-k \quad \text { at } x=0 \quad \text { so } x=0 \text { is unstable part }\\
		\frac{d^{2} V}{d x^{2}}&=2 k \text { at } x_{0}=\sqrt{\frac{k}{\lambda}} \text { so } x_{0}=\sqrt{\frac{k}{x}} \text { is stable equation point }\\
		\omega&=\sqrt{\frac{\left.\frac{d^{2} V}{d x^{2}}\right|_{x=x_{0}}}{m}}=\sqrt{\frac{2 k}{m}} \quad f=\frac{1}{2 \pi} \sqrt{\frac{2 k}{m}}
		\end{align*}
		The correct option is \textbf{(c)}
	\end{answer}
\end{enumerate}
\newpage
\begin{abox}
Practice set 2 solutions
\end{abox}
\begin{enumerate}
  \item A particle is placed in a region with the potential $V(x)=\frac{1}{2} k x^{2}-\frac{\lambda}{3} x^{3}$, where $k, \lambda>0$.
  Then,
	{\exyear{GATE 2010}}
\begin{tasks}(1)
	\task[\textbf{A.}] $x=0$ and $x=\frac{k}{\lambda}$ are points of stable equilibrium
	\task[\textbf{B.}]$x=0$ is a point of stable equilibrium and $x=\frac{k}{\lambda}$ is a point of unstable equilibrium
	\task[\textbf{C.}]$x=0$ and $x=\frac{k}{\lambda}$ are points of unstable equilibrium
	\task[\textbf{D.}]There are no points of stable or unstable equilibrium
\end{tasks}
\begin{answer}
\begin{align*}
V&=\frac{1}{2} k x^{2}-\frac{\lambda x^{3}}{3} \Rightarrow \frac{\partial V}{\partial x}=k x-\lambda x^{2}=0 \Rightarrow x=0, x=\frac{k}{\lambda}\\
&=\frac{\partial^{2} V}{\partial x^{2}}=k-2 \lambda x\\
A t x&=0, \frac{\partial^{2} V}{\partial x^{2}}=+v e(\text { Stable })\\
\text { at } x&=\frac{k}{\lambda}, \frac{\partial^{2} V}{\partial x^{2}}=-v e \text { (unstable) }
\end{align*}
The correct option is \textbf{(b)}
\end{answer}
	\item Two bodies of mass $m$ and $2 m$ are connected by a spring constant $k$. The frequency of the normal mode is
	{\exyear{GATE 2011}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\sqrt{3 k / 2 m}$
	\task[\textbf{B.}]$\sqrt{k / m}$
	\task[\textbf{C.}] $\sqrt{2 k / 3 m}$
	\task[\textbf{D.}]$\sqrt{k / 2 m}$
\end{tasks}
\begin{answer}
	\begin{align*}
\omega=\sqrt{\frac{k}{\mu}}&=\sqrt{\frac{k}{\frac{2 m}{3}}}=\sqrt{\frac{3 k}{2 m}}\\
\text { where reduce mass } \mu&=\frac{2 m m}{2 m+m}=\frac{2 m}{3} \text {. }
	\end{align*}
The correct option is \textbf{(a)}
\end{answer}
	\item A particle of unit mass moves along the $x$-axis under the influence of a potential, $V(x)=x(x-2)^{2}$. The particle is found to be in stable equilibrium at the point $x=2$. The time period of oscillation of the particle is
{	\exyear{GATE 2012}}
\begin{tasks}(2)
	\task[\textbf{A.}] $\frac{\pi}{2}$
	\task[\textbf{B.}]$\pi$
	\task[\textbf{C.}]$\frac{3 \pi}{2}$
	\task[\textbf{D.}]$2 \pi$
\end{tasks}
\begin{answer}
\begin{align*}
V(x)&=x(x-2)^{2} \Rightarrow \frac{\partial V}{\partial x}=(x-2)^{2}+2 x(x-2)=0 \Rightarrow x=2, x=\frac{2}{3}\\
\frac{\partial^{2} V}{\partial x^{2}}&=2(x-2)+2(x-2)+\left.2 x \Rightarrow \frac{\partial^{2} V}{\partial x^{2}}\right|_{x=2}=2 \times 2=4\\
\omega&=\sqrt{\left.\frac{\partial^{2} V}{\partial x^{2}}\right|_{x=2}} \Rightarrow \omega=\frac{2 \pi}{T}=2 \Rightarrow T=\pi
\end{align*}
The correct option is \textbf{(b)}
\end{answer}
	\item Consider two small blocks, each of mass $M$, attached to two identical springs. One of the springs is attached to the wall, as shown in the figure. The spring constant of each spring is $k$. The masses slide along the surface and the friction is negligible. The frequency of one of the normal modes of the system is,
	{\exyear{GATE 2013}}
	\begin{figure}[H]
		\centering
		\includegraphics[height=3cm,width=5cm]{GATE1}
	\end{figure}
\begin{tasks}(2)
	\task[\textbf{A.}] $\sqrt{\frac{3+\sqrt{2}}{2}} \sqrt{\frac{k}{M}}$
	\task[\textbf{B.}]$\sqrt{\frac{3+\sqrt{3}}{2} \sqrt{\frac{k}{M}}}$
	\task[\textbf{C.}]$\sqrt{\frac{3+\sqrt{5}}{2}} \sqrt{\frac{k}{M}}$
	\task[\textbf{D.}]$\sqrt{\frac{3+\sqrt{6}}{2}} \sqrt{\frac{k}{M}}$
\end{tasks}
\begin{answer}
	\begin{align*}
		T&=\frac{1}{2} m \dot{x}_{1}^{2}+\frac{1}{2} m \dot{x}_{2}^{2}\\
		V&=\frac{1}{2} k x_{1}^{2}+\frac{1}{2} k\left(x_{2}-x_{1}\right)^{2}\\
		&=\frac{1}{2} k x_{1}^{2}+\frac{1}{2} k\left(x_{2}^{2}+x_{1}^{2}-2 x_{2} x_{1}\right)=\frac{1}{2} k\left(2 x_{1}^{2}+x_{2}^{2}-2 x_{2} x_{1}\right)\\
		T&=\left(\begin{array}{cc}
		m & 0 \\
		0 & m
		\end{array}\right) ; \quad V=\left(\begin{array}{cc}
		2 k & -k \\
		-k & k
		\end{array}\right)\\
		\left|\begin{array}{cc}
		2 k-\omega^{2} m & -k \\
		-k & k-\omega^{2} m
		\end{array}\right|&=0 \Rightarrow\left(2 k-\omega^{2} m\right)\left(k-\omega^{2} m\right)-k^{2}=0 \Rightarrow \omega=\sqrt{\frac{3+\sqrt{5}}{2}} \sqrt{\frac{k}{m}}
	\end{align*}
THe correct option is \textbf{(c)}
\end{answer}
	\item Two masses $m$ and $3 m$ are attached to the two ends of a massless spring with force constant $K$. If $m=100 \mathrm{~g}$ and $K=0.3 \mathrm{~N} / \mathrm{m}$, then the natural angular frequency of oscillation is $H z$.
	{\exyear{GATE 2014}}

\begin{answer}
	\begin{align*}
	f&=\frac{1}{2 \pi} \sqrt{\frac{k}{\mu}}\\
	\mu&=\frac{m_{1} \cdot m_{2}}{m_{1}+m_{2}}=\frac{3 m \cdot m}{4 m}=\frac{3 m}{4}\\
	\omega&=\sqrt{\frac{4 k}{3 m}}=2 \Rightarrow f=0.318 \mathrm{~Hz}
	\end{align*}
\end{answer}

	\item A particle of mass $m$ is in a potential given by
	$$
	V(r)=-\frac{a}{r}+\frac{a r_{0}^{2}}{3 r^{3}}
	$$
	where $a$ and $r_{0}$ are positive constants. When disturbed slightly from its stable equilibrium position it undergoes a simple harmonic oscillation. The time period of oscillation is
	{\exyear{GATE 2014}}
\begin{tasks}(2)
	\task[\textbf{A.}] $2 \pi \sqrt{\frac{m r_{0}^{3}}{2 a}}$
	\task[\textbf{B.}]$2 \pi \sqrt{\frac{m r_{0}{ }^{3}}{a}}$
	\task[\textbf{C.}]$2 \pi \sqrt{\frac{2 m r_{0}^{3}}{a}}$
	\task[\textbf{D.}]$4 \pi \sqrt{\frac{m r_{0}^{3}}{a}}$
\end{tasks}
\begin{answer}
\begin{align*}
V(r)&=-\frac{a}{r}+\frac{a r_{0}^{2}}{3 r^{3}}\\
\intertext{For equilibrium}
\frac{\partial V}{\partial r}&=\frac{a}{r^{2}}-\frac{3 a r_{0}^{2}}{3 r^{4}}=0, \quad r=\pm r_{0}\\
\frac{\partial^{2} V}{\partial r^{2}}&=-\frac{2 a}{r^{3}}+\left.\frac{4 a r_{0}^{2}}{r^{5}}\right|_{r_{0}}=-\frac{2 a}{r_{0}^{3}}+\frac{4 a r_{0}^{2}}{r_{0}^{5}}=\frac{2 a}{r_{0}^{3}}\\
\omega&=\sqrt{\frac{\left.\frac{\partial^{2} V}{\partial r^{2}}\right|_{r_{0}}}{m}} \Rightarrow T=2 \pi \sqrt{\frac{m r_{0}^{3}}{2 a}}
\end{align*}
The correct option id \textbf{(a)}
\end{answer}
	\item Two identical masses of $10 \mathrm{gm}$ each are connected by a massless spring of spring constant $1 \mathrm{~N} / \mathrm{m}$. The non-zero angular eigenfrequency of the system is. $. \mathrm{rad} / \mathrm{s} .$ (up to two decimal places)
	{\exyear{GATE 2017}}
\begin{answer}
\begin{align*}
\omega=\sqrt{\frac{k}{\mu}}, \quad \text { where } \mu=\frac{m}{2}=\frac{10}{2 \times 1000}=\frac{1}{200} \text { and } k=1 N / m, \quad \omega=14.14
\end{align*}
\end{answer}
	\item In the context of small oscillations, which one of the following does NOT apply to the normal coordinates?
{	\exyear{GATE 2018}}
\begin{tasks}(1)
	\task[\textbf{A.}] Each normal coordinate has an eigen-frequency associated with it
	\task[\textbf{B.}]The normal coordinates are orthogonal to one another
	\task[\textbf{C.}]The normal coordinates are all independent
	\task[\textbf{D.}]The potential energy of the system is a sum of squares of the normal coordinates with constant coefficients
\end{tasks}
\begin{answer}
 Normal co-ordinate must be independent. It is not necessary that it should orthogonal.\\
 The correct option is \textbf{(b)}
\end{answer}

\end{enumerate}

Classical Mechanics  -CSIR/chapter/small oscillations solutions.tex


\documentclass[class=report, float=false, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}

\input{preamble}

\graphicspath{{figures/images/}}

% \begin{cbunit}

\begin{document}

\chapter{Renormalisation group theory}
\label{appendix:rg}

The renormalisation group (RG) theory, attributed to Kenneth G. Wilson \cite{wilson1971renormalization,wilson1974renormalization,wilson1975renormalization}, relies on coarse-graining arguments near critical points and gives a genuine way of thinking about critical phenomena and provides a theoretical motivation for scaling assumptions. Moreover, this theory allows one to calculate critical exponent although being particularly technical.\\

In this appendix, we mean to present the renormalisation group theory and how it leads to the scaling hypothesis we made, focusing on its implications on numerical simulations scaling. All demonstrations and discussions are based on \cite{goldenfeld1992lectures} and unpublished documents by Peter Olsson.

\section{Coarse-graining argument}

\subsection{Block spins}
\label{block_spins}

We can easily illustrate the RG theory with the Ising model for spins with nearest neighbours interactions. In this model, a system of spins displays a ferromagnetic transition at the temperature $T=T_C$, where the correlation length diverges.\\

Consider a system $\Omega$ of spins on a $d$-dimensional hypercubic lattice, with spacing $a$. We have that the spins are correlated on lengths scales of order $\xi$, the basic idea is thus to consider that spins on a length scale $la$, with $l$ satisfying
\begin{align*}
a \ll la \ll \xi
\end{align*}
act as a single spin, which we will call a \textit{block spin}.\\

We can then make the assumptions that block spins interact with their nearest block spin neighbours, as do the single spins, with coupling constants -- between spins, and between spins and external field -- somewhat different. Our block spin system is then described by the same Hamiltonian than the single spin spin. However, the spacing between block spins is $l$ times larger than the spacing between single spins, leading to the correlation length
\begin{align*}
\xi_l = \frac{\xi}{l}
\end{align*}
smaller than the correlation length of the original system. This tells us that the latter system is further from criticality than the former, leading to a reduced temperature
\begin{align*}
t_l \equiv 1 - \frac{T}{T_{C,l}} = s(l) \underbrace{\left(1 - \frac{T}{T_C}\right)}_{t} < t
\end{align*}
with $s$ a function to determine.\\

Since two consecutive scale changes with the factors $l_1$ and $l_2$ are equivalent to a single scale change of factor $l_1l_2$, we have that
\begin{align*}
s(l_1l_2) = s(l_1)s(l_2)
\end{align*}
which is satisfied by
\begin{align*}
s(l) = l^y
\end{align*}
for any $y$, hence the scaling assumptions.\\

Furthermore, we realise that the critical temperature, characterising a state where the correlation length is infinite, is a fixed point of the scaling transformation.

\subsection{Renormalisation group transformations}

We need to formalise the scaling transformation we have introduced.\\

Consider a system $\Omega$ described by the general Hamiltonian
\begin{equation}
\mathcal{H} \equiv -\beta H_{\Omega} = \sum_n K_n \Theta_n\{S\}
\end{equation}
where $\beta = 1/kT$ with $k$ the Boltzmann constant and $T$ the temperature, $K_n$ are the coupling constants, and $\Theta\{S\}$ the local operators on the degrees of freedom $\{S\}$.\\

We introduce $\forall l>1$ the \textit{renormalisation group transformation} $R_l$ which acts on the coupling constants $[K] \equiv (K_n)_n$
\begin{equation}
R_l[K] \equiv [K']
\end{equation}
and which is most often complicated and non-linear. These transformations verify
\begin{equation}
\forall l_1, l_2 > 1,~ R_{l_1l_2}[K]=R_{l_2}\cdot R_{l_1}[K]
\label{semi_group}
\end{equation}
and do not admit inverses since $l$ has to be greater or equal to $1$, therefore RG transformations form a semi-group.\\

RG transformations are coarse-graining transformations which reduce the number $N$ of degrees of freedom by a factor $l^{-d}$ to $N'=Nl^{-d}$, where $d$ is the dimension of the system. Therefore, the degrees of freedom $\{S_i\}_{1\ldots N}$ and the Hamiltonian $\mathcal{H}$ are replaced by \textit{block variables} $\{S'_I\}_{1\ldots N'}$ and an effective Hamiltonian $\mathcal{H'}$ for these new degrees of freedom respectively.\\

We introduce a \textit{projection operator} $P(S_i,S'_I)$ which satisfies
\begin{equation}
e^{\mathcal{H}'\{[K'],S'_I\}} = \text{Tr}_{\{S_i\}}P(S_i,S'_I)e^{\mathcal{H}\{[K],S_i\}}
\end{equation}
where $\text{Tr}_{\{S_i\}}$ denotes the sum over the degrees of freedom $\{S\}$, and must fulfil the following requirements
\begin{itemize}
\item[(i)] $P(S_i,S'_I) \ge 0$,
\item[(ii)] $P(S_i,S'_I)$ reflects the symmetries of the system,
\item[(iii)] $\sum_{\{S'_I\}} P(S_i,S'_I) = 1$.
\end{itemize}
In the context of part \ref{block_spins}, the projection operator $P$ is the function that associates an up or down spin to a block of spins.\\

% We can notice that RG transformations then leave the partition function, and therefore the free energy, of the system unchanged
% \begin{align*}
% Z[K'] &\equiv \text{Tr}_{\{S'_I\}}e^{\mathcal{H}'\{[K'],S'_I\}}\\
% &= \text{Tr}_{\{S'_I\}}\text{Tr}_{\{S_I\}}P(S_i,S'_I)e^{\mathcal{H}\{[K],S_i\}}\\
% &= \text{Tr}_{\{S_i\}}e^{\mathcal{H}\{[K],S_i\}}\cdot1\\
% &= Z[K]
% \end{align*}

% We define the free energy $Z$
% \begin{equation}
% Z[K]=\text{Tr}_{\{S\}}e^{\mathcal{H}\{[K],S_i\}}
% \end{equation}
% and the function $g$
% \begin{equation}
% g[K] \equiv \frac{1}{N}\ln Z[K]
% \end{equation}
% which is related to the free energy per degree of freedom.\\

% Condition (iii) ensures that the partition function, and thus the free energy, remains unchanged
% \begin{align*}
% Z[K'] &\equiv \text{Tr}_{\{S'_I\}}e^{\mathcal{H}'\{[K'],S'_I\}}\\
% &= \text{Tr}_{\{S'_I\}}\text{Tr}_{\{S_I\}}P(S_i,S'_I)e^{\mathcal{H}\{[K],S_i\}}\\
% &= \text{Tr}_{\{S_i\}}e^{\mathcal{H}\{[K],S_i\}}\cdot1\\
% &= Z[K]
% \end{align*}
% while the function $g$ is rescaled
% \begin{align*}
% \frac{1}{N}\ln Z[K] &= \frac{l^d}{l^dN}\ln Z[K']\\
% &= l^{-d} \frac{1}{N'} \ln Z[K']
% \end{align*}
% \textit{i.e.},
% \begin{equation}
% g[K] = l^{-d}g[K']
% \end{equation}

We define the free energy $Z$
\begin{equation}
Z[K]=\text{Tr}_{\{S\}}e^{\mathcal{H}\{[K],S_i\}}
\end{equation}
and the free energy density $f$
\begin{equation}
f[K] = \frac{1}{L^d} Z[K]
\end{equation}
where $L$ is the characteristic dimension of the system, which is the quotient of the free energy by the volume of the system.\\

Condition (iii) ensures that the partition function, and thus the free energy, remains unchanged
\begin{align*}
Z[K'] &\equiv \text{Tr}_{\{S'_I\}}e^{\mathcal{H}'\{[K'],S'_I\}}\\
&= \text{Tr}_{\{S'_I\}}\text{Tr}_{\{S_I\}}P(S_i,S'_I)e^{\mathcal{H}\{[K],S_i\}}\\
&= \text{Tr}_{\{S_i\}}e^{\mathcal{H}\{[K],S_i\}}\cdot1\\
&= Z[K]
\end{align*}
while the free energy density $f$ is rescaled
\begin{align*}
\frac{1}{L^d}\ln Z[K] &= \frac{l^{-d}}{(L/l)^d}\ln Z[K']\\
&= l^{-d} \frac{1}{L'} \ln Z[K']
\end{align*}
\textit{i.e.},
\begin{equation}
f[K] = l^{-d}f[K']
\label{free_energy_scaling}
\end{equation}

\section{Renormalisation group flows}

\subsection{Fixed points of the coupling constants space}

An infinite number of iterations of the RG transformations is required in order to eliminate all degrees of freedom of a thermodynamic system in the thermodynamic limit $N\rightarrow+\infty$. By doing so, singular behaviour may occur.\\

For any $l>1$, $R_l$ is a function from the coupling constants $[K]$ space to this same space, which we will denote $\mathcal{K}$. We will call \textit{renormalisation group flows} the trajectories in the coupling constants space which are obtained by iterating RG transformations. It is likely to find fixed points of the RG transformations in $\mathcal{K}$, we will then call the \textit{basin of attraction} of such a fixed point the set of points of $\mathcal{K}$ from which an infinite number of iterations of RG transformations inevitably lead.\\

We have $\forall l>1$ that the correlation length $\xi$ transforms under the RG transformation $R_l$ as
\begin{equation}
\xi[K'] = \xi[K]/l
\end{equation}
therefore, for a fixed point $[K^*]$
\begin{align*}
\xi[K*] = \xi[K*]/l
\end{align*}
which allows us to distinguishes two cases
\begin{itemize}
\item[(i)] $\xi[K^*] = 0$, for which we will call $[K^*]$ a \textit{"trivial" fixed point}, and
\item[(ii)] $\xi[K^*] = +\infty$, for which we will call $[K^*]$ a \textit{critical fixed point}.
\end{itemize}
We can then notice that since $n$ iterations of $R_l$ transform the correlation length as
\begin{align*}
\xi[K] = l^n \xi[K^{(n)}]
\end{align*}
we have that all points in the basin attraction of a critical fixed point $[K^*]$, which satisfy $\xi[K^{(n)}] \xrightarrow[n\rightarrow+\infty]{} \xi[K^*] = +\infty$, have infinite correlation length. This basin of attraction is called the \textit{critical manifold}.\\

We have implicitly that the critical points were isolated, however this is not necessarily the case. In fact, fixed points are classified according to their codimension, but this does not affect the validity of our demonstration.\\

We note that it is also possible for RG flows to describe limit cycles or strange attractors, but in practice it is almost never the case. We will then neglect these possibilities from now on.

\subsection{Relevance of variables}

We are interested in the behaviour of RG flows in the vicinity of a critical fixed point $[K^*]$.\\

Consider $[K]$ a point of $\mathcal{K}$ close to $[K^*]$
\begin{align*}
[K] = [K^*] + [\delta K]
\end{align*}
then $\forall l>1$, $[K]$ transforms under $R_l$ as $R_l[K]=[K']$ with
\begin{align*}
[K']\{[K^*]+[\delta K]\} &= \underbrace{[K']\{[K^*]\}}_{[K^*]} + [\delta K']\\
\text{\textit{i.e.}, } [K']\{[K^*]+[\delta K]\} &= [K^*] + \underbrace{\left(\left.\frac{\partial K'_n}{\partial K_m}\right|_{K_m = K^*_m} \right)_{n,m}}_{\textstyle M^{(l)}} [\delta K] + \mathcal{O}\left([\delta K]^2\right)
\end{align*}
according to Taylor's theorem, where $M^{(l)}$ is the linearised RG transformation in the vicinity of $[K^*]$ and is a real matrix.\\

In practice, $M^{(l)}$ is most often diagonalisable with real eigenvalues. For present purposes, we will assume for the rest of our presentation that it is symmetric without further notice. We advise the interested reader to read part 9.4.4 of \cite{goldenfeld1992lectures} for corrections to be brought to our theory in the case of a non-symmetric linearised RG transformation.\\

We will denote the eigenvalues and eigenvectors of $M^{(l)}$ by $\Lambda^{(\sigma)}_l$ and $\vec{e}^{\hspace{1pt}(\sigma)}$ respectively, where $(\vec{e}^{\hspace{1pt}(\sigma)})_{\sigma}$ is an orthonormal base of $\mathcal{K}$ according to the spectral theorem. We can then infer from the semi-group property of equation \ref{semi_group} that
\begin{align*}
\forall l,l' >1,~ M^{(l)}M^{(l')} &= M^{(ll')}\\
\Rightarrow \forall \sigma,~ \Lambda^{(\sigma)}_l\Lambda^{(\sigma)}_{l'} &= \Lambda^{(\sigma)}_{ll'}
\end{align*}
which we can differentiate with respect to $l'$
\begin{align*}
\frac{d}{dl'}\left(\Lambda^{(\sigma)}_l\Lambda^{(\sigma)}_{l'}\right) &= \frac{d}{dl'}\Lambda^{(\sigma)}_{ll'}\\
\Leftrightarrow \cancelto{0}{\frac{d\Lambda^{(\sigma)}_l}{dl'}}\Lambda^{(\sigma)}_{l'} + \Lambda^{(\sigma)}_l\frac{d\Lambda^{(\sigma)}_{l'}}{dl'} &= \frac{d}{dl'} \Lambda^{(\sigma)}_{ll'}\\
\Rightarrow \Lambda^{(\sigma)}_l\left.\frac{d\Lambda^{(\sigma)}_{l'}}{dl'}\right|_{l'=1} &= \frac{d\Lambda^{(\sigma)}_l}{dl}
\end{align*}
% i really have doubts concerning the resolution of this equation... that's how the book did though
and therefore write
\begin{equation}
\Lambda^{(\sigma)}_l = l^{y_{\sigma}}
\label{eigenvalues_scaling}
\end{equation}
where $y_{\sigma}$ is independent of l.\\

Finally, we have that
\begin{equation}
\begin{aligned}
[\delta K'] &= M^{(l)} [\delta K]\\
&= \sum_{\sigma} \Lambda^{(\sigma)}_l \underbrace{\left(\vec{e}^{\hspace{1pt}(\sigma)}\cdot[\delta K]\right)}_{a^{(\sigma)}} \vec{e}^{\hspace{1pt}(\sigma)}\\
&= \sum_{\sigma} \underbrace{l^{y_{\sigma}}a^{(\sigma)}}_{\textstyle a^{(\sigma)}\prime} \vec{e}^{\hspace{1pt}(\sigma)}
\end{aligned}
\end{equation}
for which we will distinguish 3 cases:
\begin{itemize}
\item[(i)] $y_{\sigma} > 0$, which implies that $a^{(\sigma)}\prime$ grows as $l$ increases, and for which we will describe the corresponding eigenvalue/direction/eigenvector as \textit{relevant},
\item[(ii)] $y_{\sigma} < 0$, which implies that $a^{(\sigma)}\prime$ shrinks as $l$ increases, and for which we will describe the corresponding eigenvalue/direction/eigenvector as \textit{irrelevant},
\item[(iii)] $y_{\sigma} = 0$, which implies that $a^{(\sigma)}\prime$ does not change as $l$ increases, and for which we will describe the corresponding eigenvalue/direction/eigenvector as \textit{marginal}.
\end{itemize}
Therefore, if we start at $[K]$ near $[K^*]$, but not in the critical manifold then the flow in directions out of the critical manifold in the vicinity of $[K^*]$ are associated with relevant eigenvalues. The irrelevant eigenvalues correspond to directions into the fixed point, and their corresponding eigenvectors span the critical manifold.

\subsection{Relation between RG flows and the phase diagram}

Starting from any point in $\mathcal{K}$, which is equivalent to the phase space, we can determine to which fixed point an infinite number of iterations of RG transformations leads to. The state of the system described by this fixed point then represents the phase at the original point.\\

RG theory therefore enables one to investigate the whole phase diagram. We will however focus on critical behaviours and advise the interested reader to read part 9.3.3 of \cite{goldenfeld1992lectures} about the global properties of RG flows and the different types of fixed points and their significance.\\

We have that points that are slightly off the critical manifolds are repelled from it in the relevant directions. Therefore, it is the same eigenvalues that drive all slightly off-critical systems away from the critical fixed point: this is the origin of universality. Furthermore, we have that the critical behaviour is not determined by the initial values of the coupling constants but only by the flow behaviour.

\section{Critical scaling}

\subsection{Scaling behaviour of the free energy density and its derivatives}

We have that the linearised RG transformation $R_l$ close to the critical fixed point $[K^*]$, $M^{(l)}$, is diagonal in the orthonormal base $(\vec{e}^{\hspace{1pt}(\sigma)})_{\sigma}$ of $\mathcal{K}$. We want to investigate the behaviour of the free energy density $f$ and its derivatives close to this critical fixed point, we will then denote $[K^*]\equiv \sum_{\sigma} K^*_{\sigma}\vec{e}^{\hspace{1pt}(\sigma)}$ and introduce $\tilde{f}$ such that
\begin{equation}
\begin{aligned}
f[K]=f(K_0,\ldots,K_m)&\equiv\tilde{f}(\tilde{K_0},\ldots,\tilde{K_m})=\tilde{f}[\tilde{K}]\\
\forall \sigma \in \llbracket0,m\rrbracket,~ \tilde{K_{\sigma}} &= \begin{cases} \frac{K_{\sigma}-K_{\sigma}^*}{K_{\sigma}^*} &\text{ if } K_{\sigma}^* \neq 0 \\ K_{\sigma} &\text{ if } K_{\sigma}^* = 0 \end{cases}
\end{aligned}
\end{equation}
and which verifies the following property
\begin{align*}
\forall \sigma \in \llbracket0,m\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] = \begin{cases} \frac{1}{K_{\sigma}^*} \frac{\partial}{\partial \tilde{K}_{\sigma}} \tilde{f}[\tilde{K}] &\text{ if } K_{\sigma}^* \neq 0 \\ \frac{\partial}{\partial K_{\sigma}} \tilde{f}[\tilde{K}] &\text{ if } K_{\sigma}^* = 0 \end{cases}
\end{align*}
which implies
\begin{equation}
\forall \sigma \in \llbracket0,m\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] \propto \frac{\partial}{\partial \tilde{K}_{\sigma}} \tilde{f}[\tilde{K}]
\end{equation}
this property being also easily demonstrated for cross-derivatives and higher order derivatives.\\

According to equations \ref{free_energy_scaling} and \ref{eigenvalues_scaling}, the free energy density transforms under $n$ iterations of the RG transformation $R_l$ as
\begin{equation}
f[K] = l^{-nd} f[K'] = l^{-nd} \tilde{f}[\tilde{K}'] = l^{-nd} \tilde{f}(l^{ny_0}\tilde{K}_0,\ldots,l^{ny_m}\tilde{K}_m)
\end{equation}
Besides that it has to be greater or equal to $1$, there is no restriction to the values $l$ can take, we then introduce $b$ such that
\begin{equation}
l^n = \left(\frac{b}{\tilde{K}_0}\right)^{1/y_0} \geq 1
\label{choice_of_l}
\end{equation}
therefore we have the free energy density and its derivatives
\begin{equation}
\begin{aligned}
f[K] &= \left(\frac{\tilde{K}_0}{b}\right)^{d/y_0}\tilde{f}\left(b,\left(\frac{b}{\tilde{K}_0}\right)^{y_1/y_0}\tilde{K}_1,\ldots,\left(\frac{b}{\tilde{K}_0}\right)^{y_m/y_0}\tilde{K}_m\right)\\
\forall \sigma \in \llbracket0,m\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] &\propto \left(\frac{\tilde{K}_0}{b}\right)^{(d-y_{\sigma})/y_0}\frac{\partial}{\partial K_{\sigma}}\tilde{f}\left(b,\left(\frac{b}{\tilde{K}_0}\right)^{y_1/y_0}\tilde{K}_1,\ldots,\left(\frac{b}{\tilde{K}_0}\right)^{y_m/y_0}\tilde{K}_m\right)
\label{free_energy_der_scaling}
\end{aligned}
\end{equation}
for which we will distinguish 2 cases:
\begin{itemize}
\item[(i)] $\forall \sigma \in \llbracket0,m\rrbracket,~ \vec{e}^{\hspace{1pt}(\sigma)}$ is a relevant eigenvector, then if we take $\tilde{K}_{\sigma}=0,~\forall \sigma \in \llbracket1,m\rrbracket$, we can rewrite equation \ref{free_energy_der_scaling} as
\begin{equation}
\begin{aligned}
\begin{cases} &f[K] = \left(\frac{\tilde{K}_0}{b}\right)^{d/y_0}\tilde{f}\left(b,0,\ldots,0\right) \\
&\forall \sigma \in \llbracket0,m\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] \propto \left(\frac{\tilde{K}_0}{b}\right)^{(d-y_{\sigma})/y_0}\frac{\partial}{\partial K_{\sigma}}\tilde{f}\left(b,0,\ldots,0\right) \end{cases} \Rightarrow\begin{cases} f[K] &\isEquivTo{\tilde{K}_0\rightarrow0} \tilde{K}_0^{c_0} \\ \frac{\partial}{\partial K_{\sigma}} f[K] &\isEquivTo{\tilde{K}_0\rightarrow0} \tilde{K}_0^{c_{0,\sigma}} \end{cases}
\end{aligned}
\label{critical_exponents_RG}
\end{equation}
where $c_0$ and $c_{0,\sigma}$ are constants, hence the power-law scaling of the thermodynamic constants close to criticality.\\

Therefore, RG theory gives a theoretical explanation of the power-law scaling at criticality, thus supporting our scaling assumptions, and furthermore provides a technique to calculate the corresponding critical exponents. However, as stated in the introduction to this appendix, this calculation remains particularly technical, "where the renormalization group approach has been successful a lot of ingenuity has been required: one cannot write a renormalization group cookbook" \cite{wilson1975renormalization}. We advise the interested reader to read part 9.6 of \cite{goldenfeld1992lectures} on the application of RG theory to the 2D Ising model.\\

\item[(ii)] $\exists~ \sigma \in \llbracket1,m-1\rrbracket,~ \vec{e}^{\hspace{1pt}(0)},\ldots,\vec{e}^{\hspace{1pt}(p-1)}$ are revelant eigenvectors -- which implies $y_0,\ldots,y_{p-1}>0$ -- and $\vec{e}^{\hspace{1pt}(p)},\ldots,\vec{e}^{\hspace{1pt}(m)}$ are irrelevant eigenvectors -- which implies $y_p,\ldots,y_m<0$ --, then we can notice that in equation \ref{free_energy_der_scaling}
\begin{align*}
\forall \sigma \in \llbracket p,m\rrbracket,~ \left(\frac{b}{\tilde{K}_0}\right)^{y_{\sigma}/y_0}\tilde{K}_{\sigma} \xrightarrow[\tilde{K}_0\rightarrow0]{} 0
\end{align*}
therefore if $\tilde{f}$ is analytic in the limit of the vanishing coupling constants in the irrelevant directions, then the results of equation \ref{critical_exponents_RG} still hold. However, this is often not the case. When $\tilde{f}$ is singular in the limit that a particular irrelevant variable vanishes, the irrelevant variable is termed a \textit{dangerous irrelevant variable}.\\
\end{itemize}

We want to draw attention to the fact that in the case of the free energy density depending solely on two relevant variables $K_0$ and $K_1$, or on a relevant variable $K_0$ and a non-dangerous irrelevant variable $K_1$, we have close to criticality
\begin{equation}
f[K] = \left(\frac{\tilde{K}_0}{b}\right)^{d/y_0}\tilde{f}\left(b,\left(\frac{b}{\tilde{K}_0}\right)^{y_1/y_0}\tilde{K}_1\right) \equiv \tilde{K}_0^{d/y_0}\tilde{f}_1\left(\tilde{K}_0^{-y_1/y_0}\tilde{K}_1\right)
\label{fitting_function}
\end{equation}
with a similar result for the derivatives of the free energy density, therefore in the context of numerical simulations of a system close to criticality with two relevant variables not equal to their critical values, it is still possible to determine from the data the fitting function $\tilde{f}_1$ and then the critical exponent.\\

In the case of $K_1$ being a relevant variable, we will call $\Delta \equiv y_1/y_0$ the \textit{crossover scaling critical exponent} and $z \equiv \tilde{K}_1/\tilde{K}_O^{\Delta}$ the \textit{crossover scaling variable} \cite{PRL99.178001}. What happens if $z$ is non-neglible is that this variable is able to drive the system from the neighbourhood of one fixed point to that of another. Therefore, we may not observe the correct assymptotic behaviour when neglecting the term associated with $K_1$, hence the importance of this correction.\\

Furthermore, what has been eluded in our demonstration is that to verify equation \ref{choice_of_l}, $b$ has to be of the same sign as $\tilde{K}_0$, therefore in equation \ref{critical_exponents_RG} the value and most importantly the sign of $\tilde{f}(b,0,\ldots,0)$ and its derivatives, and thus the sign of the asymptotic approximation, may change depending on the sign of $\tilde{K}_0$. What is most often observed is a scaling behaviour at criticality of the type
\begin{equation}
\begin{aligned}
f[K] &\operatorname*{~=~}_{\tilde{K}_0\rightarrow0} A^{(0)}_{\pm} |\tilde{K}_O|^{c_0} + \smallO{|\tilde{K}_O|^{c_0}}\\
\frac{\partial}{\partial K_{\sigma}}f[K] &\operatorname*{~=~}_{\tilde{K}_0\rightarrow0} A^{(0,\sigma)}_{\pm} |\tilde{K}_O|^{c_{0,\sigma}} + \smallO{|\tilde{K}_O|^{c_{0,\sigma}}}
\end{aligned}
\label{absolute_value_scaling}
\end{equation}
where the values of $A^{(0)}_{\pm}$ and $A^{(0,\sigma)}_{\pm}$ may change depending on the sign of $\tilde{K}_0$.

\subsection{Corrections to scaling}

Consider for a given Hamiltonian that the RG transformation $R_l$ close to the critical fixed point $[K^*]$ is diagonal in the orthonormal base $(\vec{e}^{\hspace{1pt}(0)},\vec{e}^{\hspace{1pt}(1)})$ with $\vec{e}^{\hspace{1pt}(0)}$ a relevant eigenvector and $\vec{e}^{\hspace{1pt}(1)}$ an irrelevant eigenvector. We then have, with the notation of equations \ref{free_energy_der_scaling} and \ref{fitting_function}, and in the framework of equation \ref{absolute_value_scaling}, the following relation
\begin{equation}
\begin{aligned}
f[K] &\equiv \left|\tilde{K}_0\right|^{d/y_0}\tilde{f}_1^{\pm}\left(\left|\tilde{K}_0\right|^{-y_1/y_0}\tilde{K}_1\right)\\
\forall \sigma \in \llbracket0,1\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] &\equiv \left|\tilde{K}_0\right|^{(d-y_{\sigma})/y_0}\tilde{f}_{1,\sigma}^{\pm}\left(\left|\tilde{K}_0\right|^{-y_1/y_0}\tilde{K}_1\right)
\end{aligned}
\end{equation}
In practice, it is very difficult to access the asymptotic critical regime $\tilde{K_0}\rightarrow0$, therefore the irrelevant variable may not be negligible and corrections have to be brought to our scaling assumptions.\\

A solution is to assume that $\tilde{f}_1$ and/or $\tilde{f}_{1,\sigma}$ are analytic functions in the limit that their argument, which we will call $x$ for convenience, vanishes -- assumption which is valid if $\tilde{K}_1$ is not a dangerous irrelevant variable. Therefore, we have a new assymptotic behaviour
\begin{equation}
\begin{aligned}
f[K] &\operatorname*{~=~}_{\tilde{K}_0\rightarrow0} \left|\tilde{K}_0\right|^{d/y_0} \left( A_1 + B_1 \left|\tilde{K}_0\right|^{-y_1/y_0}\tilde{K}_1 + \mathcal{O}\left(x^2\right)\right)\\
\forall \sigma \in \llbracket0,1\rrbracket,~ \frac{\partial}{\partial K_{\sigma}} f[K] &\operatorname*{~=~}_{\tilde{K}_0\rightarrow0} \left|\tilde{K}_0\right|^{(d-y_{\sigma})/y_0} \left( A_{1,\sigma} + B_{1,\sigma} \left|\tilde{K}_0\right|^{-y_1/y_0}\tilde{K}_1 + \mathcal{O}\left(x^2\right)\right)
\label{scaling_corrections}
\end{aligned}
\end{equation}
according to Taylor's theorem, where $A_1$, $B_1$, $A_{1,\sigma}$ and $B_{1,\sigma}$ are -- non-universal -- constants.\\

As expected, the leading behaviour as $\tilde{K}_0\rightarrow0$ is a power-law in $\tilde{K}_0$. We may then distinguish 2 cases:
\begin{itemize}
\item[(i)] $|y_1|/y_0 > 1$, which implies that the correction becomes smaller as $\tilde{K}_0\rightarrow0$,
\item[(ii)] $|y_1|/y_0 < 1$, which implies that the correction may not be negligible for small but non-zero $\tilde{K}_0$. This first order correction is actually singular, since it gives rise to a cusp \cite{wiki:cusp} at $\tilde{K}_0 = 0$. Such a correlation is referred as a \textit{confluent singularity}.
\end{itemize}

\subsection{Finite-size scaling}

Numerical simulations use finite systems of which we will denote $L$ the characteristic length. As the system approaches a critical fixed point, its correlation length $\xi$ diverges, therefore when $L$ and $\xi$ are comparable, the thermodynamic properties of the system can not be considered as being those of an infinite system anymore. What is observed is that the transition associated with the critical fixed point appears less sharp.\\

To address this issue, one has to include the characteristic length of the system -- or rather its inverse $1/L$ which vanishes as the system approaches the critical fixed point associated with an infinite system -- in the variables of the free energy density, which will then transform under $n$ iteration of the RG transformation $R_l$ as
\begin{equation}
f[K] = l^{-nd} f[K'] = l^{-nd} \tilde{f}[\tilde{K}'] = l^{-nd} \tilde{f}(l^{ny_0}\tilde{K}_0,\ldots,l^{ny_m}\tilde{K}_m,l^nL^{-1})
\end{equation}
A crossover scaling analysis, as described in the discussion of equation \ref{fitting_function}, can then be performed.

% \input{references/biblio}

\end{document}

% \end{cbunit}