\chapter{Physically-Inspired Excitations}\label{ch:physInspExcitations}
This short chapter introduces several simple ways to excite the different resonators presented in Part \ref{part:resonators}. First, various ways to excite resonators using initial conditions will be given, after which examples of time-varying excitations will be given, such that the systems can also be excited later during the simulation.

\section{Initial conditions}\label{sec:initConditionsPhysInsp}
The easiest way to excite a system is to set its initial conditions to non-zero values. This has been done several times before using a raised cosine (see e.g. Section \ref{sec:output1DWave}). To give the system an initial displacement, not an initial velocity, one initialises both $u^0_l$ and $u^1_l$ with the same values. In the following, the 1D wave equation will be used as an example (Eq. \eqref{eq:1DwavePDE}):
\begin{equation}
    \ptt u = c^2 \pxx u
\end{equation}
where $u=u(x,t)$ is the state of the system defined for $t\geq 0$ and $x\in D$ with domain $\D = [0, L]$ and length $L$ (in m). Furthermore, $c = 735$ m/s. Following \ref{sec:gridFunctions}, the state variable can be discretised to $\uln$ where $n\in \mathbb{N}^0$ and $l\in d$ with discrete domain $d = \{0, \hdots, N\}$ and number of grid points $N+1$. The FD scheme is (Eq. \eqref{eq:1DwaveFDS}
\begin{equation}
    \dtt \uln = c^2 \dxx \uln.
\end{equation}

\subsection{Impulse}
The simplest way to excite a system is to set the value of one grid point to non-zero, which is referred to as an \textit{impulse} excitation. Figure \ref{fig:impulse} shows an implementation of the 1D wave equation where $u_l^0 = u_l^1 = 1$ at $l = \floor[0.5 N]$. One can observe that the variations between two neighbouring grid points are extremely high. If the CFL condition in Eq. \eqref{eq:CFL} is satisfied with equality, the the system will exhibit frequencies around the Nyquist frequency, which is generally unwanted.

\def\figWidth{0.32}
\begin{figure}[h]
    \centering
    \subfloat[$n = 1$.\label{fig:impulse1}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/impulse1.eps}}\hfill
    \subfloat[$n = 6$.\label{fig:impulse2}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/impulse2.eps}}\hfill
    \subfloat[$n = 11$.\label{fig:impulse3}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/impulse3.eps}}
    \caption{The 1D wave equation initialised with an impulse at $l=\floor[0.5N]$.\label{fig:impulse}}
\end{figure}

\subsection{Raised cosine}\label{sec:raisedCosine}
To avoid the high-frequency behaviour caused by the impulse is to using a spatially smooth excitation. To achieve this, a \textit{raised cosine} is most often used due to this property and is extensively used throughout the literature \cite{theBible}. Initialising the displacement of a distributed system with a raised cosine can be interpreted as a pluck. A different pluck excitation is presented in Section \ref{sec:pluck}.

A raised cosine is parametrised by its amplitude $e_\text{amp}$, its center location $x_0$ and its width $x_\text{w}$. Applied to a distributed 1D system defined over domain $x\in \D$, the (continuous-time) excitation function containing a raised cosine is defined as
\begin{equation}\label{eq:raisedCosCont}
    e_\text{rc}(x) =
    \begin{cases}
        \frac{e_\text{amp}}{2}\left(1 - \cos\left(\frac{2\pi (x - x_\stxt)}{x_\text{w}}\right)\right), & \text{if } x_\stxt \leq x \leq x_\etxt,\\
        0, & \text{otherwise},
    \end{cases}
\end{equation}
where
\begin{equation}\label{eq:xsxe}
    x_\stxt = x_0 -
    \frac{x_\text{w}}{2}, \qaq x_\etxt = x_0 + \frac{x_\text{w}}{2}
\end{equation}
are the start and end locations of the excitation. Furthermore, $x_\stxt, x_\etxt \in \D$, which puts a constraint on the width and location of the excitation.

In discrete time, the center location is defined as $l_0 = \floor[x_0 / h]$, where $\floor[\cdot]$ denotes the flooring operation, $h$ is the grid spacing. The discrete start and end locations of the raised cosine are
\begin{equation}\label{eq:lsle}
    l_\text{s} = l_0 - \floor[w/2]\qaq l_\etxt = l_0 + \floor[w/2],
\end{equation}
with $l_\stxt, l_\etxt\in d$ and, finally, $w = \floor[x_\text{w} / h]$.\footnote{Notice that the width is given in `grid spacings' and will thus affect $w+1$ grid points. This is also why the range in \eqref{eq:raisedCosDisc} includes both end points.} Equation \eqref{eq:raisedCosCont} can then be discretised as
\begin{equation}\label{eq:raisedCosDisc}
    E_{l, \text{rc}} =
    \begin{cases}
        \frac{e_\text{amp}}{2}\left(1 - \cos\left(\frac{2\pi (l - l_\stxt)}{w}\right)\right), & \text{if } l_\stxt \leq l \leq l_\etxt,\\
        0, & \text{otherwise}.
    \end{cases}
\end{equation}
Figure \ref{fig:raisedCos} shows the 1D wave equation initialised with a raised cosine with $e_\text{amp} = 1$, $l_0 = \floor[0.5N]$ and $w = \floor[0.1N]$. Notice that the behaviour is much more smooth than the impulse shown in Figure \ref{fig:impulse}.

\def\figWidth{0.32}
\begin{figure}[h]
    \centering
    \subfloat[$n = 1$.\label{fig:raisedCos1}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/raisedCos1.eps}}\hfill
    \subfloat[$n = 6$.\label{fig:raisedCos2}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/raisedCos2.eps}}\hfill
    \subfloat[$n = 11$.\label{fig:raisedCos3}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/raisedCos3.eps}}
    \caption{The 1D wave equation initialised with a raised cosine at the center of the system.\label{fig:raisedCos}}
\end{figure}

\subsubsection{Strike}\label{sec:strike}
If one initialises the system with an initial velocity, i.e., only setting a displacement at $n=1$, and leaving $u^0_l = 0$ for $l\in d$, one can use the raised cosine to model a strike. Figure \ref{fig:strike} shows a strike using the same values as for the pluck in Figure \ref{fig:raisedCos} at $n=1$, but leaving $u_l^0 = 0$. One can observe that, for the pluck, the displacement of the system stays high rather than going back to 0 as in the case of the pluck. Furthermore, the amplitude of the displacement is higher than for the pluck (notice the scaling of the y-axis).%\footnote{In the case of the 1D wave equation struck using a raised cosine, the maximum amplitude can be calculated to be half of the summed values of the excitation.}

\def\figWidth{0.32}
\begin{figure}[h]
    \centering
    \subfloat[$n = 1$.\label{fig:strike1}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/strike1.eps}}\hfill
    \subfloat[$n = 6$.\label{fig:strike2}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/strike2.eps}}\hfill
    \subfloat[$n = 11$.\label{fig:strike3}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/strike3.eps}}
    \caption{The 1D wave equation initialised with a strike at the center of the system. Notice the scaling of the y-axis compared to the other figures. \label{fig:strike}}
\end{figure}

\subsection{Triangular pluck}\label{sec:pluck}
Another way to initialise the string, which is closer to reality, is to use a triangular shape to model a pluck \cite{Fletcher1998, theBible}.%, where the authors analytically decompose the system into its modes of vibration as well as their respective amplitudes depending on the plucking position.
%
Using $e_\text{amp}$ as the maximum displacement -- at the corner of the triangle -- and $x_0\in \D$ as the plucking position, the triangular excitation can be defined as
\begin{equation}\label{eq:triangleCont}
    e_\text{tri}(x) = \begin{cases}
        \frac{e_\text{amp}}{x_0} x, & \text{if } 0\leq x \leq x_0,\\
        \frac{e_\text{amp}}{x_0 - L} (x - L), &\text{if } x_0 < x \leq L.
    \end{cases}
\end{equation}

In discrete time, Eq. \eqref{eq:triangleCont} becomes
\begin{equation}
    E_{l, \text{tri}} = \begin{cases}
        \frac{e_\text{amp}}{l_0} l, & \text{if } 0\leq l \leq l_0,\\
        \frac{e_\text{amp}}{l_0 - N} (l - N), &\text{if } l_0 < l \leq N.
    \end{cases}
\end{equation}
Due to the spatial discontinuity at the corner, some high-frequency oscillations (similar to the impulse) might emerge. Figure \ref{fig:pluck} shows an implementation of the 1D wave equation initialised with a triangular pluck excitation. The sample rate is 10x the usual one to prevent these high-frequency oscillations from appearing in the plot (though they still exist to some degree).

\def\figWidth{0.32}
\begin{figure}[h]
    \centering
    \subfloat[$n = 1$.\label{fig:pluck1}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/triangle1.eps}}\hfill
    \subfloat[$n = 101$.\label{fig:pluck2}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/triangle2.eps}}\hfill
    \subfloat[$n = 201$.\label{fig:pluck3}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/triangle3.eps}}
    \caption{The 1D wave equation initialised with a triangular pluck with $l_0=\floor[0.2N]$. Note that sample rate has been set to $\fs = 441000$ Hz to show more ideal triangular motion. \label{fig:pluck}}
\end{figure}

\subsection{2D raised cosine}\label{sec:2DraisedCos}
Introducing an extra coordinate $y$, one can extend the raised cosine presented in Section \ref{sec:raisedCosine} to 2D according to
\begin{equation}\label{eq:raisedCosCont2D}
    e_\text{rc}(x,y)\! =\!
    \begin{cases}
        \!\frac{e_\text{amp}}{2}\left(1 - \cos\left(\frac{2\pi (x - x_\stxt)}{r_\text{w}}\right)\right)\left(1 - \cos\left(\frac{2\pi (y - y_\stxt)}{r_\text{w}}\right)\right), &
        \!\!\!\begin{aligned}
            &\text{if } x_\stxt \leq x \leq x_\etxt, \\
            &\text{and } y_\stxt \leq y \leq y_\etxt,
        \end{aligned}\\[1.25em]
        \!0, &\!\! \text{otherwise},
    \end{cases}
\end{equation}
where $r_\text{w}$ is the excitation radius. Similar to Eq. \eqref{eq:xsxe}, the start and end locations of the raised cosine in the $x$ and $y$ direction can be calculated as
\begin{equation*}
    x_\stxt = x_0 -
    \frac{r_\text{w}}{2}, \quad x_\etxt = x_0 + \frac{r_\text{w}}{2}, \quad y_\stxt = y_0 -
    \frac{r_\text{w}}{2}, \qaq y_\etxt = y_0 + \frac{r_\text{w}}{2},
\end{equation*}
where $(x_0, y_0)$ is the center coordinate and $x_\stxt, x_\etxt, y_\stxt,  y_\text{e}\in \D$ for a 2D domain $\D$.

In discrete time, Eq. \eqref{eq:raisedCosCont2D} becomes
\begin{equation}
    E_{(l,m), \text{rc}} =
    \begin{cases}
        \!\frac{e_\text{amp}}{2}\left(1 - \cos\left(\frac{2\pi (l \!-\! l_\stxt)}{r}\right)\right)\!\left(1\! -\! \cos\left(\frac{2\pi (m - m_\stxt)}{r}\right)\right)\!, & \!\!\!\!
        \begin{aligned}
            &\text{if } l_\stxt \leq l \leq l_\etxt, \text{ and}\\
            & m_\stxt \leq m \leq m_\etxt,
        \end{aligned}\\
        \!0, &\!\!\!\! \text{otherwise},
    \end{cases}
\end{equation}
where $r = \floor[r_\text{w} / h]$ is the discrete excitation radius (in `grid spacings')\todo{look at this}. Furthermore, similar to Eq. \eqref{eq:lsle},
\begin{equation}
    l_\text{s} = l_0 - \floor[r/2],\ l_\etxt = l_0 + \floor[r/2],\ m_\text{s} = m_0 - \floor[r/2], \ \text{and} \ m_\etxt = m_0 + \floor[r/2]
\end{equation}
for discrete center coordinate $(l_0, m_0)$ and $l_\stxt, l_\etxt, m_\stxt,  m_\text{e}\in d$ for a discrete 2D domain $d$.
As in the 1D case, this excitation can be used to model a simple `pluck' and strike for a 2D system.

A simple way to implement the 2D raised cosine in \texttt{MATLAB} using the \texttt{hann} function is shown in Algorithm \ref{alg:2DraisedCos}.
\\
\begin{lstlisting}[caption={A \texttt{MATLAB} implementation of a 2D raised cosine.}, label=alg:2DraisedCos]
% Assuming Dirichlet boundary conditions and having initialised the following
% - center locations for the x and y-directions: l0 and m0
% - radius of the excitation r (in grid points)

ls = l0 - floor(r/2); % start location x-direction
le = l0 + floor(r/2); % end location x-direction
ms = m0 - floor(r/2); % start location y-direction
me = m0 + floor(r/2); % end location x-direction

% Create excitation matrix
e = zeros(Ny-1, Nx-1);

% Add one to hann function as the width is given in `grid spacings'
% and affects r+1 grid points
e(ms:me, ls:le) = hann(r+1) * hann(r+1)';

% Applying excitation to stacked matrix form as in Section %*\refMatlab[sec:2DwaveImplementation]*)
u = reshape(e, (Nx-1) * (Ny-1), 1);
\end{lstlisting}

\section{Time-varying excitations}
Although various types of excitation can already be modelled using the initial conditions presented in the previous section, they are temporally rigid. In other words, the time of excitation is fixed to be at the start of the simulation. In order to excite the system while the simulation is running, one can create excitations that -- on top of being spatially distributed -- have temporal profile as well.

For the following, consider the ideal string of length $L$ (in m), its transverse displacement described by $u = u(x,t)$ (in m). The system is defined for $t\geq 0$ and $x\in\D$ with domain $\D = [0, L]$. The PDE of the ideal string with a time varying external force $f(t)$ (in N) is defined as (Eq. \eqref{eq:1DwavePDE})
\begin{equation}
    \rho A\ptt u = T \pxx u + e(x)f(t)
\end{equation}
where $e(x)$ is a spatial distribution function such as those presented in Section \ref{sec:initConditionsPhysInsp} (in m$^{-1}$).

\subsection{Raised cosine}\label{sec:timeVaryingRaisedCos}
To yield a smooth excitation over time, one can, similar to the spatially distributed raised cosine in Eq. \ref{sec:raisedCosine}, define a temporally distributed raised cosine. Using the time of excitation $t_0\geq 0$ and excitation duration $t_\text{d}>0$ (both in s) the temporal raised cosine can be used as a force function, as
\begin{equation}\label{eq:raisedCosTemp}
    f(t) =
    \begin{cases}
        \frac{f_\text{amp}}{2} \left(1 - \cos\left(\frac{q\pi (t - t_0)}{t_\text{d}}\right)\right), & t_\stxt \leq t \leq t_0 + t_\text{d}\\
        0, &\text{otherwise}.
    \end{cases}
\end{equation}
As done in \cite{Webb2015}, $q$ that alters the excitation to be a pluck when $q=1$ and a strike when $q=2$. Finally, $f_\text{amp}$ is the maximum force (in N).

As done in papers \citeP[A] and \citeP[B], the force function can be used in conjunction with the distribution functions shown in Section \ref{sec:initConditionsPhysInsp}. When used to scale a spatially distributed raised cosine as in Eq. \eqref{eq:raisedCosCont}, one can model a pluck or a strike, by setting $q=1$ or $q=2$ respectively. These alternatives are visualised in Figure \ref{fig:timeVaryingRaisedCos}. Note, that if one would like $f_\text{amp}$ to be the maximum force, one must set $e_\text{amp} = 1$ in Eq. \eqref{eq:raisedCosCont}.

In discrete time, the force function in Eq. \eqref{eq:raisedCosTemp} becomes
\begin{equation}\label{eq:discExcitation}
    f^n =
    \begin{cases}
        \frac{f_\text{amp}}{2}\left(1-\cos\left(\frac{q\pi (n - n_0)}{n_\text{d}}\right)\right), & n_0 \leq n \leq n_0+n_\text{d},\\
        0, &\text{otherwise}.
    \end{cases}
\end{equation}
where $n_\text{d} = \floor[t_\text{d}/k]$ is the duration of the excitation in samples.

\def\figWidth{0.8}
\begin{figure}[h]
    \centering
    \subfloat[Pluck ($q=1$).\label{fig:timeVaryingRaisedCosPluck}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/timeVaryingRaisedCos.eps}}\\
    \subfloat[Strike ($q=2$).\label{fig:timeVaryingRaisedCosStrike}]{\includegraphics[width=\figWidth\textwidth]{figures/exciters/physInsp/timeVaryingRaisedCosHammer.eps}}\hfill
    \caption{The time-varying raised cosine showing a (a) pluck and a (b) strike. The location of excitation $x_0$ is shown in green, the width $x_\text{w}$ in red and the excitation start $t_0$ and duration $t_\text{d}$ in blue.\label{fig:timeVaryingRaisedCos}}
\end{figure}

\subsection{Pulse train}\label{sec:pulseTrain}
As already briefly introduced in Section \ref{sec:webstersExcitation}, one can create a pulse train to excite an acoustic tube. This is inspired by \cite{theBible} where the signal represents the opening and closing of the glottis. As the characteristics of the lip reed are similar to the vocal folds \cite{Richards2003}, the pulse train has been used as a test signal here (also see Section \ref{sec:lipreedTube}). A more complete model of the lip reed can be found in Chapter \ref{ch:lipreed}.

The pulse train can be created using a clipped sinusoid which can be used as the input velocity to an acoustic tube. Algorithm \ref{alg:pulseTrain} shows an example of how to generate a pulse train. The frequency as well as the duty cycle (how much of the signal is non-zero) can be set. Figure \ref{fig:pulseTrain} shows the output of the algorithm.
\begin{minipage}{\textwidth}
\setlstMAT
\begin{lstlisting}[caption={\texttt{MATLAB} code to generate a pulse train}, label=alg:pulseTrain]
%% Pulse train generator

fs = 44100;             % Sample rate [Hz]
lengthSound = fs;       % Length of the sound [samples]
f = 440;                % Pulse train frequency
dutyC = 0.75;           % Duty cycle [0-1]
amp = 1;                % Amplitude

%% Create input signal
for n = 0:lengthSound
    if mod(n, fs / f) <= fs / f * dutyC
        vIn(n+1) = amp * sin(f * pi / dutyC * mod(n, fs / f) / fs);
    else
        vIn(n+1) = 0;
    end
end
\end{lstlisting}
\end{minipage}

% For a pulse train with a maximum amplitude of 1 and a frequency $f$ (in Hz), the following is proposed
% \def\depth{c_\text{d}}
% \begin{equation}\label{eq:pulseTrain}
%     v_\text{in} = \left[\frac{\sin(2\pi f t) - (1-2\depth)}{2\depth}\right]_+,
% \end{equation}
% where $0< \depth \leq 0.5$ is the clipping depth, and determines the duty cycle, i.e. the distance between the pulses. Finally, the $[\cdot]_+$ operator specifies `the positive part of' and is used for clipping (see Chapter \ref{ch:collisions}).
\begin{figure}[h]
    \centering
    \includegraphics[width=\textwidth]{figures/exciters/physInsp/pulseTrain.eps}
    \caption{The pulse train generated using Algorithm \ref{alg:pulseTrain} ($f = 440$ Hz, duty cycle $ = 75\%$).
    \label{fig:pulseTrain}}
\end{figure}


\subsection{Branching}
As observed, when we compactify a surface, something that used to be a covering map no longer has that property.
\begin{example}
    The map $p_k:\mathbb C_\star\to\mathbb C_\star$ via $z\mapsto z^k$ is a covering map, but $\hat{p}_k:\mathbb C_\infty\to\mathbb C_\infty$ is not (if $k\ge 2$).
\end{example}
\begin{definition}
    let $f:R\to S$ be analytic.
    For $p\in R$, recall that we can find charts that put $f$ into a standard local form $\psi\circ f\circ\phi^{-1}(z)=z^n$ near $p$ for some $n\in\mathbb Z_{\ge 0}$ by Proposition \ref{local_p_k}.
    The integer $n$ does not depend on the choice of charts (as we can alternatively define it to be the size of $f^{-1}(\{f(p)\})$, and is called the multiplicity $m_f(p)$ of $f$ at $p$.
\end{definition}
Most points have multiplicity $1$, the remaining ones are especially interesting.
\begin{definition}
    If $m_f(p)>1$, then $p$ is called the ramification point of $f$ and $f(p)$ is called a branch point of $f$.
    In this case, $m_f(p)$ is sometimes also called the ramification index.
\end{definition}
\begin{example}
    The map $\hat{p}_k:\mathbb C_\infty\to\mathbb C_\infty$ via $z\mapsto z^k$ and $0\mapsto 0,\infty\mapsto\infty$.
    Then the ramification points are $z=0,\infty$ and the branch points are $w=0,\infty$.\\
    More generally, for polynomials $f:\mathbb C_\infty\to\mathbb C_\infty$, $f(z)=a_dz^d+\cdots+a_0$ ($a_d\neq 0$) for $z\neq\infty$ and $f(\infty)=\infty$, changing the variable $w=1/z$ gives
    $$\frac{1}{f(z)}=\frac{1}{a_dz^d+\cdots+a_0}=\frac{w^d}{a_d+\cdots+a_0w^d}=w^dg(w)$$
    where $g$ is (locally) analytic and nonzero, hence $m_\infty(f)=d$.
\end{example}
\begin{remark}
    Let $f:R\to\mathbb C$ be an analytic function, $p\in R$ and $(\phi,U)$ a chart containing $p$.
    Then
    $$F(z)=f\circ\phi^{-1}(z)=(z-z_0)^mg(z),z_0=\phi(p)$$
    where $m=m_f(p)$ by definition.
    So $F^\prime(z)=(mg(z)+(z-z_0)g^\prime(z))(z-z_0)^{m-1}$.
    If $m=1$, then $F^\prime(z_0)=g(z_0)\neq 0$.
    But if $m>1$, then $F^\prime(z_0)=mg(z_0)(z_0-z_0)^{m-1}=0$.
    Therefore the ramification points are exactly the zeros of $F^\prime$.
\end{remark}
\begin{lemma}
    If $f:R\to S$ and $g:S\to T$ are analytic, then $m_{g\circ f}(p)=m_g(f(p))m_f(p)$ for any $p\in R$.
\end{lemma}
\begin{proof}
    Find the respective local coordinates such that $f$ corresponds to $z\mapsto z^{m_f(p)}$ and $g$ corresponds to $w\mapsto w^{m_g(f(p))}$, then in those local coordinates $g\circ f$ is $z\mapsto(z^{m_f(p)})^{m_g(f(p))}=z^{m_g(f(p))m_f(p)}$.
    The equality follows.
\end{proof}


\chapter{Basics of Recursive Bayesian Estimation}

In following sections the problem of recursive Bayesian estimation (Bayesian filtering) is
stated and its analytical solution is derived. Later on, due to practical intractability of the
solution in its general form, a few methods that either simplify the problem or approximate the
solution are shown.

\section{Problem Statement}

Assume a dynamic system described by a hidden real-valued \emph{state vector} \(x\) which evolves at
discrete time steps according to a known function \(f_t\) (in this text called \emph{process model})
as described by \eqref{eq:DynSysFt}.
\begin{equation} \label{eq:DynSysFt}
	x_t = f_t(x_{t-1}, v_{t-1})
\end{equation}

Variable \(v_t\) in \eqref{eq:DynSysFt} denotes random \emph{process noise}, which may come from various
sources and is often inevitable. Sequence of \(v_t\) is assumed to be identically independently
distributed random variable sequence.

The state of the system is hidden and can only be observed though a real-valued \emph{observation vector}
\(y\) that relates to the state \(x\) as in \eqref{eq:DynSysHt}, but adds further \emph{observation
noise} \(w\).
\begin{equation} \label{eq:DynSysHt}
	y_t = h_t(x_t, w_t)
\end{equation}

In \eqref{eq:DynSysHt} \(h_t\) is known function called \emph{observation model} in this text and \(w_t\) is
identically independently distributed random variable sequence that denotes observation noise.

The goal of recursive\footnote{by the word recursive we mean that it is not needed to keep track of
the whole batch of previous observations in practical methods, only appropriate quantities from time
moments \(t-1\) and \(t\) are needed to estimate \(x_t\). However, this does not apply to the
derivation of the solution, where the notation of whole batch of observations \(y_{1:t}\) is used.}
Bayesian estimation is to give an estimate of the state \(x_t\) given the
observations \(y_{1:t}\) provided the knowledge of the functions \(f_t\) and \(h_t\).
More formally, the goal is to find the {\pdf} \(p(x_t | y_{1:t})\).
Theoretical solution to this problem is known and is presented in next section.

\section{Theoretical solution}

At first, we observe that {\pdf} \(p(x_t|x_{t-1})\) can be derived from the process model
\eqref{eq:DynSysFt} (given the distribution of \(v_k\)) and that \(p(y_t|x_t)\) can be derived from
the observation model \eqref{eq:DynSysHt} respectively. (given the distribution of \(w_k\))

Because recursive solution is requested, suppose that \(p(x_{t-1}|y_{1:t-1})\) and
\(p(x_0)\) are known\footnote{\(p(x_0)\) can be called initial {\pdf} of the state vector.} in
order to be able to make the transition \(t-1 \; \rightarrow \; t\).

In the first stage that can be called \emph{prediction}, \emph{prior} {\pdf}
\(p(x_t | y_{1:t-1})\) is calculated without knowledge of \(y_t\). We begin the derivation by
performing the reverse of the marginalization over \(x_{k-1}\).
\begin{equation*}
	p(x_t | y_{1:t-1}) = \int_{-\infty}^{\infty} p(x_t, x_{t-1} | y_{1:t-1}) \; \dx_{t-1}
\end{equation*}

Using chain rule for {\pdfs}, the element of integration can be split.
\begin{equation*}
	p(x_t | y_{1:t-1}) = \int_{-\infty}^{\infty} p(x_t | x_{t-1}, y_{1:t-1}) p(x_{t-1} | y_{1:t-1}) \; \dx_{t-1}
\end{equation*}

With an assumption that the modelled dynamic system \eqref{eq:DynSysFt} possesses \emph{Markov
Property}\footnote{an assumption of independence that states that system state in time \(t\) only
depends on system state in \(t-1\) (and is not directly affected by previous states).},
\(p(x_t | x_{t-1}, y_{1:t-1})\) equals \(p(x_t | x_{t-1})\).~\cite{AruMasGor:02}
This leaves us with the result \eqref{eq:PriorPdf}.
\begin{equation} \label{eq:PriorPdf}
	p(x_t | y_{1:t-1}) = \int_{-\infty}^{\infty} p(x_t | x_{t-1}) p(x_{t-1} | y_{1:t-1}) \; \dx_{t-1}
\end{equation}

As we can see, prior {\pdf} only depends on previously known functions and therefore can be
calculated.

We continue with the second stage that could be named \emph{update}, where new observation \(y_t\) is taken into
account and \emph{posterior} {\pdf} \(p(x_t | y_{1:t})\) is calculated. Bayes' theorem can be used
to derive posterior {\pdf} \eqref{eq:PosteriorPdfRaw}.
\begin{equation} \label{eq:PosteriorPdfRaw}
	p(x_t | y_{1:t}) = \frac{p(y_t | x_t, y_{1:t-1}) p(x_t | y_{1:t-1})}{p(y_t | y_{1:t-1})}
\end{equation}

According to the observation model \eqref{eq:DynSysHt} and assuming Markov property, \(y_t\) only
depends on \(x_t\). That is \(p(y_t | x_t, y_{1:t-1}) = p(y_t | x_t)\). Therefore posterior
{\pdf} can be further simplified into \eqref{eq:PosteriorPdf}.
\begin{equation} \label{eq:PosteriorPdf}
	p(x_t | y_{1:t}) = \frac{p(y_t | x_t) p(x_t | y_{1:t-1})}{p(y_t | y_{1:t-1})}
\end{equation}

While both {\pdfs} in the numerator of \eqref{eq:PosteriorPdf} are already known, \(p(y_t|y_{1:t-1})\)
found in the denominator can be calculated using the formula \eqref{eq:MargLikelihood}, where
marginalization over \(x_t\) is preformed. Quantity \eqref{eq:MargLikelihood} can also be interpreted as
\emph{marginal likelihood} (sometimes called \emph{evidence}) of observation.~\cite{Smi:10}
\begin{equation} \label{eq:MargLikelihood}
	p(y_t | y_{1:t-1}) = \int_{-\infty}^{\infty} p(y_t | x_t) p(x_t | y_{1:t-1}) \; \dx_{t}
\end{equation}

Computing \eqref{eq:MargLikelihood} isn't however strictly needed as it does not depend on \(x_t\) and
serves as a normalising constant in \eqref{eq:PosteriorPdf}. Depending on use-case the normalising
constant may not be needed at all or may be computed alternatively using the fact that \(p(x_t | y_{1:y})\)
integrates to \(1\).

We have shown that so called \emph{optimal Bayesian solution}\cite{AruMasGor:02} can be easily
analytically inferred using only \emph{chain rule for {\pdfs}}, \emph{marginalization} and
\emph{Bayes' theorem}. (equations \eqref{eq:PriorPdf}, \eqref{eq:PosteriorPdf} and
\eqref{eq:MargLikelihood} forming the main steps of the solution) On the other hand, using this
method directly in practice proves difficult because at least one parametric multidimensional
integration has to be performed (in \eqref{eq:PriorPdf}), which is (in its general form) hardly
tractable for greater than small state vector dimensions.

This is a motivation for various simplifications and approximations among which we have chosen
a Kalman filter described in the next section and a family of particle filters described later.

\section{Kalman Filter}

The Kalman filter\footnote{first presented by Rudolf Emil Kalman in 1960.} poses additional set of strong
assumptions on modelled dynamic system, but greatly
simplifies the optimal Bayesian solution \eqref{eq:PriorPdf}, \eqref{eq:PosteriorPdf} into a
sequence of algebraic operations with matrices. On the other hand, when these requirements can be
fulfilled, there is no better estimator in the Bayesian point of view because the Kalman filter computes
\(p(x_t | y_{1:t})\) \emph{exactly.}\footnote{not accounting for numeric errors that arise in
practical implementations.}

Assumptions additionally posed on system by the the Kalman filter are:
\begin{enumerate}
	\item \(f_t\) in the process model \eqref{eq:DynSysFt} is a linear function of \(x_t\) and
	\(v_t\).
	\item \(v_t \sim \mathcal{N}(0, Q_t)\) meaning that process noise \(v_t\) is normally
	distributed with zero mean\footnote{zero mean assumption is not strictly needed, it is however
	common in many implementations.} and with known covariance matrix \(Q_t\).
	\item \(h_t\) in the observation model \eqref{eq:DynSysHt} is a linear function of \(x_t\) and
	\(w_t\).
	\item \(w_t \sim \mathcal{N}(0, R_t)\) meaning that observation noise \(w_t\) is normally distributed
	with zero mean and with known covariance matrix \(R_t\).
	\item initial state {\pdf} is Gaussian.
\end{enumerate}

It can be proved that if the above assumptions hold, \(p(x_t|y_{1:t})\) is Gaussian for all
\(t > 0\).~\cite{Pet:81} Furthermore, given assumptions 1. and 2. the process model
\eqref{eq:DynSysFt} can be reformulated as \eqref{eq:LinSysAt}, where \(A_t\) is real-valued matrix
that represents \(f_t\).
Using the same idea and assumptions 3. and 4. the observation model \eqref{eq:DynSysHt} can be
expressed as \eqref{eq:LinSysCt}, \(C_t\) being real-valued matrix representing \(h_t\). Another
common requirement used below in the algorithm description is that \(v_t\) and \(w_t\) are
stochastically independent.
\begin{align}
	x_t &= A_t x_{t-1} + \hat{v}_{t-1} & A_t &\in \mathbb{R}^{n,n} \;\; n \in \mathbb{N} \label{eq:LinSysAt} \\
	y_t &= C_t x_t + \hat{w}_t & C_t &\in \mathbb{R}^{j,n} \;\; j \in \mathbb{N} \;\; j \leq n \label{eq:LinSysCt}
\end{align}

Note that we have marked the noises \(v_t\) and \(w_t\) as \(\hat{v}_t\) and \(\hat{w}_t\) when they
are transformed through \(A_t\), respectively \(C_t\) matrix. Let also \(\hat{Q}_t\) denote the
covariance matrix of \(\hat{v}_t\) and \(\hat{R}_t\) denote the covariance matrix of \(\hat{w}_t\)
in further text.

At this point we can describe the algorithm of the Kalman filter. As stated above, posterior {\pdf}
is Gaussian and thus can be parametrised by mean vector \(\mu\) and covariance matrix \(P\). Let us
denote posterior mean from previous iteration by \(\mu_{t-1|t-1}\) and associated covariance by
\(P_{t-1|t-1}\) as in \eqref{eq:KalmanPreAPost}.
\begin{equation} \label{eq:KalmanPreAPost}
	p(x_{t-1} | y_{1:t-1}) = \mathcal{N}(\mu_{t-1|t-1}, P_{t-1|t-1})
\end{equation}

Prior {\pdf} \eqref{eq:KalmanAPrior} can then be calculated as follows:~\cite{AruMasGor:02}
\begin{align}
	p(x_t | y_{1:t-1}) &= \mathcal{N}(\mu_{t|t-1}, P_{t|t-1}) \label{eq:KalmanAPrior} \\
	\mu_{t|t-1} &= A_t \mu_{t-1|t-1} \notag \\
	P_{t|t-1} &= A_t P_{t-1|t-1} A_t^T + \hat{Q}_{t-1} \notag
\end{align}

Before introducing posterior {\pdf} it is useful to establish another Gaussian {\pdf}
\eqref{eq:KalmanEvidence} that is not necessarily needed, but is useful because it represents
marginal likelihood \eqref{eq:MargLikelihood}. % TODO: citation for this!
\begin{align}
	p(y_t|y_{1:t-1}) &= \mathcal{N}(\nu_{t|t-1}, S_{t|t-1}) \label{eq:KalmanEvidence} \\
	\nu_{t|t-1} &= C_t \mu_{t|t-1} \notag \\
	S_{t|t-1} &= C_t P_{t|t-1} C_t^T + \hat{R}_t \notag
\end{align}

The update phase of the Kalman filter can be performed by computing so-called \emph{Kalman gain} matrix
\eqref{eq:KalmanGain}, posterior {\pdf} \eqref{eq:KalmanAPost} is then derived from prior one
using the Kalman gain \(K_t\) and observation \(y_t\).~\cite{AruMasGor:02}
\begin{align}
	K_t &= P_{t|t-1} C_t^T S_{t|t-1}^{-1} \label{eq:KalmanGain} \\[\parskip]
	p(x_t|y_{1:t}) &= \mathcal{N}(\mu_{t|t}, P_{t|t}) \label{eq:KalmanAPost} \\
	\mu_{t|t} &= \mu_{t|t-1} + K_t(y_t - \nu_{t|t-1}) \notag \\
	P_{t|t} &= P_{t|t-1} - K_t C_t P_{t|t-1} \notag
\end{align}

In all formulas above \(A^T\) denotes a transpose of matrix \(A\) and \(A^{-1}\) denotes inverse
matrix to \(A\). As can be seen, formulas \eqref{eq:PriorPdf} and \eqref{eq:PosteriorPdf} have
been reduced to tractable algebraic operations, computing inverse matrix\footnote{it can be shown
that \(S_{t|t-1}\) is positive definite given that \(C_t\) is full-ranked,
therefore the inverse in \eqref{eq:KalmanGain} exists.} being the most costly one.

It should be further noted that the Kalman filter and described algorithm can be easily enhanced to
additionally cope with an \emph{intervention} (or control) vector applied to the system, making it
suitable for the theory of decision-making. Numerous generalisations of the Kalman filter exist, for
example an \emph{extended Kalman filter} that relaxes the requirement of the linear system by locally
approximating a non-linear system with Taylor series. These are out of scope of this
text, but provide areas for subsequent consideration.

On the other hand, the assumption of Gaussian posterior {\pdf} cannot be easily overcome and for
systems that show out non-Gaussian distributions of the state vector another approach have to be
taken.~\cite{AruMasGor:02} One such approach can be a Monte Carlo-based \emph{particle filter}
presented in the next section.

\begin{figure}[h]
	\centering
	\includegraphics[width=\textwidth,keepaspectratio=true]{KF.pdf}
	\caption[Example run of the Kalman filter]{Example run of the Kalman filter. Lines are actual
	(hidden) state, dots estimation means of various implementations (all yielding the same values).}
	\label{fig:KF}
\end{figure}

\section{Particle Filter} \label{sec:ParticleFilter}

Particle filters represent an approximate solution of the problem of the recursive Bayesian
estimation,
thus can be considered \emph{suboptimal} methods. The underlying algorithm described below is most
commonly named \emph{sequential importance sampling (SIS)}. The biggest advantage of the particle filtering
is that requirements posed on the modelled system are much weaker than those assumed by optimal methods
such as the Kalman filter. Simple form of the particle filter presented in this section (that assumes that
modelled system has Markov property) requires only the knowledge of {\pdf} \(p(x_t|x_{t-1})\)
representing the process model and the knowledge of \(p(y_t|x_t)\) representing the observation
model.\footnote{both {\pdfs} are generally time-varying and their knowledge for all \(t\) is needed,
but their representation (parametrised by conditioning variable) is frequently constant in time in
practical applications.}

The sequential importance sampling approximates the posterior density by a weighted empirical
{\pdf} \eqref{eq:PFAPost}.
\begin{align}
	p(x_t | y_{1:t}) \approx \sum_{i=1}^N \omega_t^{(i)} \delta(x_t - x_t^{(i)}) \label{eq:PFAPost} \\
	\forall i \in \mathbb{N} \;\; i \leq N: \omega_i \geq 0 \quad\quad \sum_{i=1}^N \omega_i = 1 \notag
\end{align}

In \eqref{eq:PFAPost} \(x_t^{(i)}\) denotes value of i-th \emph{particle}: possible state of the
system at time \(t\);
\(\omega_t^{(i)}\) signifies weight of i-th particle at time \(t\): scalar value proportional to
expected probability of the system being in state in small neighbourhood of \(x_t^{(i)}\);
\(N\) denotes total number of particles\footnote{\(N\) is assumed to be
arbitrary but fixed positive integer for our uses. Variants of the particle filter exist that use
adaptive number of particles, these are not discussed here.}, a significant tunable parameter
of the filter.

As the initial step of the described particle filter, \(N\) random particles are sampled
from the initial {\pdf}
\(p(x_0)\). Let \(i \in \mathbb{N} \;\; i \leq N\), transition \(t-1 \; \rightarrow \; t\) can be
performed as follows:
\begin{enumerate}
	\item for each \(i\) compute \(x_t^{(i)}\) by random sampling from conditional {\pdf}
		\(p(x_t|x_{t-1})\) where \(x_{t-1}^{(i)}\) substitutes \(x_{t-1}\) in condition. This step
		can be interpreted as a simulation of possible system state developments.
	\item for each \(i\) compute weight \(\omega_t^{(i)}\) using \eqref{eq:PFWeightUpdate}
		by taking observation \(y_t\) into account. \(x_t\) is substituted by \(x_t^{(i)}\) in
		condition in \eqref{eq:PFWeightUpdate}. Simulated system states are confronted with reality
		through observation.
		\begin{equation} \label{eq:PFWeightUpdate}
			\omega_t^{(i)} = p(y_t | x_t) \omega_{t-1}^{(i)}
		\end{equation}
	\item normalise weights according to \eqref{eq:PFWeightNormalise} so that approximation of
		posterior {\pdf} integrates to one.
		\begin{equation} \label{eq:PFWeightNormalise}
			\omega_t^{(i)} = \frac{\omega_t^{(i)}}{\sum_{j=1}^N \omega_t^{(j)}}
		\end{equation}
\end{enumerate}

Relative computational ease of described algorithm comes with
cost: first, the particle filter is in principle non-deterministic because of the random sampling in
step~1, in other words, the particle filter is essentially a Monte Carlo method; second, appropriate
number of particles \(N\) has to be chosen --- too small \(N\) can lead to significant approximation
error while inadequately large \(N\) can make the particle filter infeasibly time-consuming. It can be
proved that the particle filter converges to true posterior density as \(N\) approaches
infinity and certain other assumptions hold~\cite{CriDou:02}, therefore the number of particles
should be chosen as a~balance of accuracy and speed.

Only two operations with {\pdfs} were needed: sampling from \(p(x_t|x_{t-1})\) and evaluating
\(p(y_t | x_t)\) in known point. Sometimes sampling from \(p(x_t|x_{t-1})\) is not
feasible\footnote{but can be replaced by evaluation in known point.} and/or better results are
expected by taking an observation \(y_t\) into account during sampling (step~1). This can be
achieved by introducing so-called \emph{proposal density} (sometimes \emph{importance density})
\(q(x_t|x_{t-1}, y_t)\). Sampling in step~1 then uses \(q(x_t|x_{t-1}, y_t)\) instead, where \(x_{t-1}\) in
condition is substituted by \(x_{t-1}^{(i)}\). Weight computation in step~2 have to be replaced with
\eqref{eq:PFWeightUpdateProp} that compensates different sampling distribution (every occurrence of
\(x_t\), \(x_{t-1}\) in the mentioned formula has to be substituted by \(x_t^{(i)}\) and \(x_{t-1}^{(i)}\)
respectively). See \cite{AruMasGor:02} for a derivation of these formulas and for a discussion about
choosing adequate proposal density.
\begin{equation} \label{eq:PFWeightUpdateProp}
	\omega_t^{(i)} = \frac{p(y_t|x_t)p(x_t|x_{t-1})}{q(x_t|x_{t-1}, y_t)} \omega_{t-1}^{(i)}
\end{equation}

Particle filters also suffer from a phenomenon known as \emph{sample impoverishment} or
\emph{degeneracy problem}: after a few iterations all but one particles' weight falls close to
zero.\footnote{it has been shown that variance of particle weights continually raises as algorithm
progresses.~\cite{AruMasGor:02}}
One technique to diminish this is based on careful choice of proposal density (as explained in
\cite{AruMasGor:02}), a second one is to add additional \emph{resample} step to the above
algorithm:
\begin{enumerate}[resume] % so that enumeration starts with number 4
	\item for each \(i\) resample \(x_t^{(i)}\) from approximate posterior {\pdf}
		\(\sum_{i=1}^N \omega_t^{(i)} \delta(x_t - x_t^{(i)})\) and reset all weights to \(\frac{1}{N}\).
		Given that sampling is truly random and independent this means that each particle is in
		average copied \(n_i\) times, where \(n_i\) is roughly proportional to particle weight:
		\(n_i \approx \omega_t^{(i)} N\). Statistics of posterior {\pdf} are therefore (roughly and
		on average) maintained while low-weight particles are eliminated.
\end{enumerate}
Step~4 therefore facilitates avoidance of particles with negligible weight by replacing them with more weighted
ones. Such enhanced algorithm is known as \emph{sequential importance resampling (SIR)}.

Because particle resampling is computationally expensive operation, a technique can be used where
resampling is skipped in some iterations, based on the following idea:
a measurement of degeneracy can be obtained by computing an
approximate of \emph{effective sample size} \(N_{\text{eff}}\) at given time \(t\) using
\eqref{eq:PFNeff}.~\cite{AruMasGor:02}
\begin{equation} \label{eq:PFNeff}
	N_{\text{eff}} \approx \left( \sum_{i=1}^N \left( \omega_t^{(i)} \right)^2 \right)^{-1}
\end{equation}
Very small \(N_{\text{eff}}\) compared to \(N\) signifies a substantial loss of ``active'' particles,
which is certainly undesirable as it hurts accuracy while leaving computational demands unchanged.
Step~4 is then performed only when \(N_{\text{eff}}\) falls below certain threshold.

Recursive Bayesian estimation using SIR methods can be applied to a wide range of dynamic systems
(even to those where more specialised methods fail) and can be tuned with number of particles \(N\) and
proposal density \(q\). On the other hand a method specially designed for a given system easily
outperforms general particle filter in terms of speed and accuracy.

\section{Marginalized Particle Filter}

Main sources of this section are \cite{SchGusNor:05} and \cite{SchKarGus:06}.

The marginalized particle filter (sometimes \emph{Rao-Blackwellized particle filter}) is an
extension to the particle filter that more accurately approximates the optimal Bayesian solution
provided that the {\pdf} representing the process model \(p(x_t|x_{t-1})\) can be obtained in
a special form. Suppose that the state vector can be divided into two parts \(a_t\) and \(b_t\)
\eqref{eq:MPFStateVec} and that the process model {\pdf} can be expressed as a product of two
{\pdfs} \eqref{eq:MPFProcessMod}, where \(p(a_t|a_{t-1} b_t)\) is analytically tractable (in general).
We present a simple variant of the marginalized particle filter where, given \(b_t\), process and
observation model of the \(a_t\) part are linear with normally-distributed noise. The Kalman filter
can be used to estimate \(a_t\) part of the state vector in this case.
\begin{align}
	x_t &= (a_t, b_t) \label{eq:MPFStateVec} \\
	p(x_t|x_{t-1}) &= p(a_t, b_t|a_{t-1}, b_{t-1}) = p(a_t|a_{t-1}, b_t) p(b_t | b_{t-1}) \label{eq:MPFProcessMod}
\end{align}

The posterior {\pdf} \eqref{eq:MPFPosterior} can be represented as a product of a weighted empirical
distribution and a normal distribution. Each (i-th) particle is thus associated with its Kalman filter
(representing \(a_t^{(i)}\) part) and \(b_t^{(i)}\) quantity.
\begin{equation} \label{eq:MPFPosterior}
	p(a_t, b_t | y_t) = \sum_{i=1}^N \omega_i p(a_t|y_{1:t},b_{1:t}^{(i)}) \; \delta(b_t - b_t^{(i)})
\end{equation}

In \eqref{eq:MPFPosterior} \(N\) denotes the total number of particles, \(\omega_i\) denotes weight
of i-th particle, \(p(a_t|y_{1:t},b_{1:t}^{(i)})\) is posterior {\pdf} of i-th Kalman
filter and \(b_t^{(i)}\) is a value of the \(b_t\) part of i-th particle.

The algorithm of the described variant of the marginalized particle filter follows, note the
similarities with the ordinary particle filter: at first, generate \(N\) \(b_t\) random samples from
the initial distribution \(p(b_0)\). Then the following procedure can be repeated for each measurement
\(y_t\):
\begin{enumerate}
	\item for each \(i\) compute \(b_t^{(i)}\) by random sampling from conditional {\pdf}
		\(p(b_t|b_{t-1})\) where \(b_{t-1}^{(i)}\) substitutes \(b_{t-1}\) in condition.
	\item for each \(i\) compute the posterior {\pdf} \(p(a_t|y_{1:t},b_{1:t}^{(i)})\) of the i-th
		Kalman filter using \(y_t\) and \(b_t^{(i)}\).
	\item for each \(i\) update weight \(\omega_i\) using the formula \eqref{eq:MPFWeightUpdate} where
		marginal likelihood of the i-th Kalman filter \eqref{eq:KalmanEvidence} is used.
		\begin{equation} \label{eq:MPFWeightUpdate}
			\omega_i = p(y_t|y_{1:t-1},b_{1:t}^{(i)}) \; \omega_i
		\end{equation}
	\item normalise weights (as described in the previous section).
	\item resample particles (as described in the previous section).
\end{enumerate}

It has been demonstrated in various publications that the marginalised particle filter outperforms
the ordinary particle filter in both better accuracy and lower computational demands. Where
applicable, it therefore forms an excellent alternative to traditional particle filtering.


\section{The Laplace Equation}
We already encountered Laplace equation $\Delta^2\phi=0$ several times.
It has very wide applications in mathematical physics, applied mathematics and pure mathematics.
In physics, it often describes some physical systems (e.g. heat flow) that is in stationary state as it does not depend on time.
We can also see this (possibly with a forcing term) in potential theory.
For example, Laplace used it to describe gravitational systems.
It also appears in the study of incompressible fluid flow.\\
We often want to solve Laplace's equation in a domain $D$ subject to boundary conditions.
The most common ones are the dirichlet conditions where we are given the value of $\phi$ on $\partial D$ and the Neumann conditions where we specify $\underline{\hat{n}}\cdot\nabla\phi$ on $\partial D$.
\subsection{3D Cartesian Coordinates}
In 3D Cartesian coordinates, the equation becomes
$$\frac{\partial^2\phi}{\partial x^2}+\frac{\partial^2\phi}{\partial y^2}+\frac{\partial^2\phi}{\partial z^2}=0$$
The seperation of variables $\phi(x,y,z)=X(x)Y(y)Z(z)$ gives the systems
$$X^{\prime\prime}=-\lambda_lX,Y^{\prime\prime}=-\lambda_mY,Z^{\prime\prime}=-\lambda_nZ=(\lambda_l+\lambda_m)Z$$
where $\lambda_l,\lambda_m$ are seperation constants.
Therefore the general solution arising from this way is
$$\phi(x,y,z)=\sum_{l,m,n}a_{l,m,n}X_l(x)Y_m(y)Z_n(z)$$
\begin{example}[Steady Heat Conduction]
    Consider a semi-infinite rectangular bar $[0,a]\times [0,b]\times [0,\infty]$ as the domain with boundary conditions $\phi=0$ at $x=0,a$ and $y=0,b$, $\phi=1$ at $z=0$ and $\phi\to 0$ as $z\to\infty$.
    We shall try to find the eigenmodes.
    For $X^{\prime\prime}=-\lambda_lX$ with $X(0)=X(a)=0$ we get $\lambda_l=l^2\pi^2/a^2$ and $X_l(x)=\sin(l\pi x/a)$ for $l=1,2,3,\ldots$.
    For $Y^{\prime\prime}=-\lambda_mY$ we have $\lambda_m=m^2\pi^2/b^2$ and $Y_m(y)=\sin(m\pi y/b)$ again for $m=1,2,3,\ldots$.
    For $Z$, the equation would be
    $$Z^{\prime\prime}=-\lambda_nZ=(\lambda_l+\lambda_m)Z=\pi^2\left( \frac{l^2}{a^2}+\frac{m^2}{b^2} \right)Z$$
    which has exponential solutions.
    But $Z$ is bounded at infinity, therefore necessarily
    $$Z_n=Z_{l,m}=\exp\left( -\sqrt{\frac{l^2}{a^2}+\frac{m^2}{b^2}}\pi z \right)$$
    which gives the general solution
    $$\phi(x,y,z)=\sum_{l,m}a_{l,m}\sin\frac{l\pi x}{a}\sin\frac{m\pi y}{b}\exp\left( -\sqrt{\frac{l^2}{a^2}+\frac{m^2}{b^2}}\pi z \right)$$
    Now the condition $\phi(x,y,0)=1$ gives
    $$a_{l,m}=\frac{2}{b}\int_0^b\frac{2}{a}\int_0^a\sin\frac{l\pi x}{a}\sin\frac{m\pi y}{b}\,\mathrm dx\mathrm dy=\frac{16}{\pi^2lm}$$
    for odd $l,m$ and $0$ if any of them is even.
    Therefore the heat flow solution is
    $$\phi(x,y,z)=\sum_{l,m\text{ odd}}\frac{16}{\pi^2lm}\sin\frac{l\pi x}{a}\sin\frac{m\pi y}{b}\exp\left( -\sqrt{\frac{l^2}{a^2}+\frac{m^2}{b^2}}\pi z \right)$$
    This may look complicated, and yes it is complicated.
    However, for large $l,m$ (and large $z$), the exponential term would be very much close to $0$.
    This allows us to get a very nice approximation by considering just lower order terms.
\end{example}
\subsection{2D Plane Polar Coordinates}
In plane polar, Laplace's equation translates to
$$0=\nabla^2\phi=\frac{1}{r}\frac{\partial}{\partial r}\left( r\frac{\partial\phi}{\partial r} \right)+\frac{1}{r^2}\frac{\partial^2\phi}{\partial\theta^2}$$
Again we do a seperation of variables $\phi(r,\theta)=R(r)\Theta(\theta)$ to get
$$\begin{cases}
    \Theta^{\prime\prime}+\mu\Theta=0\\
    r(rR^\prime)^\prime-\mu R=0
\end{cases}$$
where $\mu$ is the seperation constant.
Assuming periodic boundary conditions, then the polar equation yields $\mu=m^2$ and $\Theta_m(\theta)$ is a superposition of $\cos(m\theta)$ and $\sin(m\theta)$.
So the radial equation becomes $r(rR^\prime)^\prime-m^2R=0$.
For $m\neq 0$, trying $R=\alpha r^\beta$ shows that $\beta=\pm m$ works, so $R_m$ is composed of $r^m$ and $r^{-m}$.
If $m=0$, $R_0$ is a linear combination of constant and $\log r$ by just integrating.
So the general solution is just
\begin{align*}
    \phi(r,\theta)&=\frac{a_0}{2}+c_0\log r\\
    &\quad+\sum_{m=1}^\infty(a_m\cos(m\theta)+b_n\sin(m\theta))r^m\\
    &\quad+\sum_{m=1}^\infty(c_m\cos(m\theta)+d_m\sin(m\theta))r^{-m}
\end{align*}
For constants $a_m,b_m,c_m,d_m$.
\begin{example}[Soap Film on a Unit Disk]
    We want to solve Laplace's equation on the unit disk, where the boundary condition is given a distorted circular wire $\phi(1,\theta)=f(\theta)$.
    Of course we want our solution to be continuous in the inside of the disk, in particular at $0$, therefore $c_m=d_m=0$ for all $m$.
    Therefore we just got
    $$\phi(r,\theta)=\frac{a_0}{2}+\sum_{m=1}^\infty(a_m\cos(m\theta)+b_m\sin(m\theta))r^m$$
    left.
    But then $f(\theta)=\phi(1,\theta)$ gives a Fourier series (again!), so
    $$a_m=\frac{1}{\pi}\int_0^{2\pi}f(\theta)\cos(m\theta)\,\mathrm d\theta,b_m=\frac{1}{\pi}\int_0^{2\pi}f(\theta)\sin(m\theta)\,\mathrm d\theta$$
    For a nontrivial distortion, the term $r^m$ then tells us that the high harmonics are concentrated near the edge of the wire.
\end{example}
\subsection{3D Cylindrical Polar Coordinates}
Here Laplace's equation become
$$0=\nabla^2\phi=\frac{1}{r}\frac{\partial}{\partial r}\left( r\frac{\partial\phi}{\partial r} \right)+\frac{1}{r^2}\frac{\partial^2\phi}{\partial\theta^2}+\frac{\partial^2\phi}{\partial z^2}$$
Seperation of variables $\phi(r,\theta,z)=R(r)\Theta(\theta)Z(z)$ gives
$$\begin{cases}
    \Theta^{\prime\prime}=-\mu\Theta\\
    Z^{\prime\prime}=\lambda Z\\
    r(rR^\prime)^\prime+(\lambda r^2-\mu)R=0
\end{cases}$$
where $\mu,\lambda$ are the seperation constants.
For the polar equation, periodic boundary conditions give $\mu_m=m^2$ and $\Theta_m(\theta)$ is a superposition of $\sin(m\theta)$ and $\cos(m\theta)$.
The radial equation is Bessel's equation (surprise?) with eigenfunctions $R_{mn}=J_m(j_{mn}r/a)$ under boundary condition $R(a)=0$ and the requirement of it not being singular (so we can exclude the Neumann functions).
The $Z$ equation then becomes $Z^{\prime\prime}=kZ$ where $k=j_{mn}/a$ which gives $Z=e^{-kz}$ (the $e^{kz}$ solution is eliminated by the boundary condition $Z\to 0$ as $z\to\infty$).
So the general solution is
$$\phi(r,\theta,z)=\sum_{m=0}^\infty\sum_{n=1}^\infty(a_{mn}\cos(m\theta)+b_{mn}\sin(m\theta))J_m(j_{mn}r/a)\exp(-j_{mn}r/a)$$
\begin{example}
    The boundary condition $\phi=0$ at $r=a$, $\phi=T_0$ at $z=0$ and $\phi\to 0$ as $z\to\infty$ gives the solution
    $$\phi(r,\theta,z)=\sum_{n=1}^\infty\frac{2T_0}{j_{0n}J_1(j_{0n})}J_0(j_{0n}r/a)\exp(-j_{0n}z/a)$$
\end{example}
\subsection{3D Spherical Polar Coordinates}
Recall that the spherical polar coordinate transforms from Cartesian coordinates by
$$x=r\sin\theta\cos\phi,y=r\sin\theta\sin\phi,z=r\cos\theta$$
for $r\in\mathbb R_{\ge 0},\theta\in [0,\pi],\phi\in[0,2\pi]$ where we have $\mathrm dV=r^2\sin\theta\,\mathrm dr\mathrm d\theta\mathrm d\phi$.
Laplace's equation transforms into
$$0=\nabla^2\Phi=\frac{1}{r^2}\frac{\partial}{\partial r}\left( r^2\frac{\partial\Phi}{\partial r} \right)+\frac{1}{r^2\sin\theta}\frac{\partial}{\partial\theta}\left( \sin\theta\frac{\partial\Phi}{\partial\theta} \right)+\frac{1}{r^2\sin^2\theta}\frac{\partial^2\Phi}{\partial\phi^2}$$
We only consider the axis-symmetric case where $\partial\Phi/\partial\phi=0$.
Again seperate the variables $\Phi(r,\theta,\phi)=R(r)\Theta(\theta)$ gives
$$\begin{cases}
    ((\sin\theta)\Theta^\prime)^\prime+\lambda(\sin\theta)\Theta=0\\
    (r^2R^\prime)^\prime-\lambda R=0
\end{cases}$$
where $\lambda$ is the seperation constant.
The substitution $x=\cos\theta$ transforms the polar equation into
$$\frac{\mathrm d}{\mathrm dx}\left( (1-x^2)\frac{\mathrm d\Theta}{\mathrm dx} \right)+\lambda\Theta=0$$
which is exactly Legendre's equation.
So we obtain the eigenvalues $\lambda_l=l(l+1)$ with eigenfunctions $\Theta_l(\theta)=P_l(x)=P_l(\cos\theta)$ where $P_l$ is the $l^{th}$ Legendre polynomial.
Putting it into the radial equation gives $(r^2R^\prime)^\prime-l(l+1)R=0$, which gives (by educated guess) the solution $R_l$ being a superposition of $r^l$ and $r^{-l-1}$.
The general axis-symmetric solution is then
$$\Phi=\sum_{l=0}^\infty(a_lr^l+b_lr^{-l-1})P_l(\cos\theta)$$
where $a_l,b_l$ can be determined by boundary conditions.
\begin{example}
    Consider the boundary condition $\Phi(1,\theta,\phi)=f(\theta)$ for some $f$.
    Regularity implies $b_l=0$ for any $l$.
    So we have
    $$f(\theta)=\sum_{l=0}^\infty a_lP_l(\cos\theta)\implies F(x)=\sum_{l=0}^\infty a_lP_l(x)$$
    with $f(\theta)=F(\cos\theta)$.
    This gives
    $$a_l=\frac{2l+1}{2}\int_{-1}^1F(x)P_l(x)\,\mathrm dx$$
    in the special case where $f(\theta)=\sin^2\theta$ we have $\Phi=2(1-P_2(\cos\theta)r^2)/3$.
\end{example}
Consider a charge on $z$-axis at $\underline{r}_0=(0,0,1)$ and the potential at $P$ is defined by
$$\Phi(\underline{r})=\frac{1}{|\underline{r}-\underline{r}_0|}=\frac{1}{\sqrt{r^2-2r\cos\theta+1}}=\frac{1}{\sqrt{r^2-2rx+1}}$$
where $x=\cos\theta$.
It is easy to see that $\Phi$ satisfies $\nabla^2\Phi=0$ in $\mathbb R^3\setminus\{\underline{r}_0\}$.
Therefore there is some $a_l$ such that
$$\frac{1}{\sqrt{r^2-2rx+1}}=\sum_{l=0}^\infty a_lP_l(x)r^l$$
We have $P_l(1)=1$ at $x=1$, therefore plugging in $x=1$ gives $a_l=1$ for any $l$, therefore
$$\frac{1}{\sqrt{r^2-2rx+1}}=\sum_{l=0}^\infty P_l(x)r^l$$
is the generating function of the Legendre polynomials.
\begin{example}[Electric Multipoles]
    Consider the case where we put charges along $z$-axis at $z=\pm a,0$ viewed from a large distance $r>>a$ with $\Phi\to 0$ as $r\to\infty$.
    Therefore $a_n=0$ for all $n$.
    When $l=0$, we just get a point charge and thus $\Phi\propto 1/r$
    This is called the monopole field of the point charge $q$.
    When $l=1$, we get the dipole (i.e. opposite charges sitting opposite each other) $\Phi\propto(\cos\theta)/r^2$ for two opposite charges.
    When $l=2$, it is like putting a charge $2q$ at the origin and $-q$ at opposite position across the origin, in which case $\Phi\propto(3\cos^2\theta-1)/(2r^3)$ gives the quadruple field.
\end{example}


\subsection{The Rayleigh-Ritz Method}

The method presented in this subsection is not really an
step forward from the Power Method, but rather a parallel development
(both will be merged in the Lanczos Algorithm of further
subsections). It is actually an auxiliary tool that many eigenproblem
solvers need; not necessarily for symmetric matrices (although we
still assume that, it order to maintain our desired scope). \\

Suppose that, in order to find the eigenpairs \footnote {An eigenpair
  is the tuple $(\lambda_i,\vec{v})$ of an eigenvalue and its
  corresponding eigenvector} of a given matrix $A$,
we generate a sequence of matrices ${ W_k }$ which contain
progressively better approximations of such eigenpairs. A common
problem for any procedure that goes that way, is how to ``extract''
the actual eigenvectors from such subspace (the eigenvalues are the
same, so those do not require further calculations). The
Rayleigh-Ritz \footnote{Leissa argues that the method should not
  really be attributed to Rayleigh but only to Ritz, (see
  \cite{leissa05}).} method addresses precisely this common need. \\

Before providing the pseudocode, let us explain a bit better what we
mean by having ``calculated subspaces'' $W_k$; as that is a rather
vague expression (though is quite common in the literature). What we
really mean, is that we have a \emph{characterization} of the
subspace; which is nothing more than a basis for it. The vectors of
such basis are arranged as columns of the matrix $W_k$, and then, we
are basically asking for the eigen decomposition of that matrix. \\

Does not the above sound a bit circular? We start with the generic
problem of finding eigenvalues and eigenvectors of symmetric matrix
$A$; then we calculate through an iterative process another matrix
$W_k$, which contains the basis of a subspace that we know has good
approximations to the eigenpairs of our original matrix $A$. Then, we
proceed to solve the eigenproblem for that new matrix $W_k$ ... looks
like we finish right where we began! Of course that, though not
mentioned always in literature, the intuitive idea is that the new
matrix $W_k$ is a less generic than $A$. It is expected to have certain
qualities that make the solution of its eigenproblem an easier task
(compared to solving that for original matrix $A$).  \\

Having clarified a bit the main idea of subspace eigenproblem solvers,
let us continue to list the pseudocode for the Rayleigh-Ritz Method; which
offers a way to ``extract'' the eigenvectors of original matrix $A$,
out of the approximation matrix $W_k$. We based our procedure in
\cite{jia01}:

\begin{algorithm}
  \label{alg:ritz}
  \caption{The Rayleigh-Ritz Method}
%
  \setstretch{1.5}
  \SetKwInOut{Input}{Input}
  \SetKwInOut{Output}{Output}
  \DontPrintSemicolon
%
    \Input{Approximation subspace matrix $W_k$, symmetric matrix $A$}
%
    \Output{Set of desired (approximated) eigenpairs}
%
    $B \gets \trans{W} A W $ \;
%
    \For {each desired eigenpair $(\lambda_i,\vec{v_i})$ of $A$}
    {
%
      Solve eigen equation $B\vec{x_i} = \tilde{\lambda_i} \vec{x_i}$ (where
      $\tilde{\lambda_i} \simeq \lambda_i$) \;
%
      $(\tilde{\lambda_i}, \avec{v_i}) \gets (\lambda_i, W\vec{x_i})$,
      where $\avec{v_i} \approx \vec{v_i}$ \;
    }
%
    return $\{(\tilde{\lambda_1},\avec{v_1}),(\tilde{\lambda_2},\avec{v_2}),\cdots,\}$ \;
\end{algorithm}

If $W_k$ was the orthogonal matrix with the eigenvectors of $A$, then
matrix $B$ would be diagonal (containing the eigenvalues). As $W_k$ is
rather an approximation to such matrix, is usually the case that is
something close to a diagonal (like a tridiagonal or bidiagonal); from
there comes the fact that calculating its eigenpairs, is much easier
than for original matrix $A$. \\

Probably the less intuitive step from the algorithm is the assignment
$\avec{v_i} = W\vec{v_i}$; but is not hard to prove its validity:

\begin{align*}
\setstretch{10}
& &B\vec{x_i} = \tilde{\lambda_i} \vec{x_i} \\\\
& \iff &(\trans{W} A W)\vec{x_i} = \tilde{\lambda_i} \vec{x_i} \\\\
& \iff &\trans{W} A (W\vec{x_i}) = \tilde{\lambda_i} \vec{x_i} \\\\
& \iff &A (W\vec{x_i}) = \tilde{\lambda_i} (W \vec{x_i}) \\\\
& \therefore & W\vec{x_i} \text{ is an (approx.) eigenvector of $A$} \xqed
\end{align*}
\hfill

The vector \vec{v_i} is called a Ritz vector, and we will refer to it
in such a way when we review the complete Lanczos algorithm.\\

For further details of convergence or error analysis, please refer to
Jian \cite{jia01}.


\subsection{Projection of monomer orbitals on dimer orbitals (DIPRO)}
\label{sec:dipro}
An approach for the determination of the transfer integral that can be used for any single-particle electronic structure method (Hartree-Fock, DFT, or semiempirical methods) is based on the projection of monomer orbitals on a manifold of explicitly calculated dimer orbitals. This dimer projection (DIPRO) technique including an assessment of computational parameters such as the basis set, exchange-correlation functionals, and convergence criteria is presented in detail in ref.~\cite{baumeier_density-functional_2010}. A brief summary of the concept is given below.

We start from an effective Hamiltonian~\footnote{we use following notations: $a$ - number, $\vctr{a}$ - vector, $\matr{A}$ - matrix, $\oper{A}$ - operator}
%
\begin{equation}
  \oper{H}^\text{eff} = \sum_i \epsilon_i \oper{a}_i^\dagger \oper{a}_i + \sum_{j \neq i} J_{ij} \oper{a}_i^\dagger \oper{a}_j + c.c.
  \label{equ:dipro_eq1}
\end{equation}
%
where $\oper{a}_i^\dagger$ and $\oper{a}_i$ are the creation and annihilation operators for a charge carrier located at the molecular site $i$.
The electron site energy is given by $\epsilon_i$, while $J_{ij}$  is the transfer integral between two sites $i$ and $j$. We label their frontier orbitals (HOMO for hole transfer, LUMO for electron transfer) $\phi_i$ and $\phi_j$, respectively. Assuming that the frontier orbitals of a dimer (adiabatic energy surfaces) result exclusively from the interaction of the frontier orbitals of monomers, and consequently expand them in terms of $\phi_i$ and $\phi_j$. The expansion coefficients, $\vctr{C}$, can be determined by solving the secular equation
%
\begin{equation}
  (\matr{H} - E \matr{S})\vctr{C} = 0
  \label{equ:dipro_eq2}
\end{equation}
%
where $\matr{H}$ and $\matr{S}$ are the Hamiltonian and overlap matrices of the system, respectively.
%
%Since it is easier to work in matrix form, the following
%equation also holds (equation (\ref{eq:dipro_eq2}) in matrix form):
%
%\begin{equation}
% \matr{H}\matr{U} = \matr{S}\matr{U}\matr{E}
%  \label{eq:dipro_eq3}
% \end{equation}
%
These matrices can be written explicitly as
%
\begin{equation}
% \begin{aligned}
  \matr{H} =
  \begin{pmatrix}
    e_i    &  H_{ij} \\
    H_{ij}^* &  e_j
  \end{pmatrix} \hspace{2cm}
  \matr{S} =
  \begin{pmatrix}
    1    &  S_{ij} \\
    S_{ij}^* &  1
  \end{pmatrix}
%  \end{aligned}
  \label{equ:dipro_eq3}
\end{equation}
%
with
%
\begin{equation}
 \begin{aligned}
  e_i &= \Bra{\phi_i}\oper{H} \Ket{\phi_i} \hspace{2cm}  H_{ij} = \Bra{\phi_i}\oper{H} \Ket{\phi_j}\\
  e_j &= \Bra{\phi_j}\oper{H} \Ket{\phi_j} \hspace{2cm}  S_{ij} = \Bra{\phi_j} \phi_j\rangle %S
 \end{aligned}
  \label{equ:dipro_eq4}
\end{equation}
The matrix elements $e_{i(j)}$, $H_{ij}$, and $S_{ij}$ entering \equ{dipro_eq3} can be calculated via projections on the dimer orbitals (eigenfunctions of $\hat{H}$) $\left\{\Ket{\phi^\text{D}_n}\right\}$ by inserting $\oper{1} = \sum_n \Ket{\phi^\text{D}_n}\Bra{\phi^\text{D}_n}$ twice. We exemplify this explicitly for $H_{ij}$ in the following
%
\begin{equation}
  H_{ij} = \sum_{nm}{\Braket{\phi_i|\phi^\text{D}_n} \Bra{\phi^{D}_n}\hat{H}\Ket{\phi^\text{D}_m}\Braket{\phi^\text{D}_m|\phi_j}} .
  \label{eq:dipro_eq16}
\end{equation}
%
The Hamiltonian is diagonal in its eigenfunctions, $\Bra{\phi^\text{D}_n}\oper{H}\Ket{\phi^\text{D}_m} = E_n \delta_{nm}$. Collecting the projections of the frontier orbitals  $\Ket{\phi_{i(j)}}$ on the $n$-th dimer state $\left(\vctr{V}_{(i)}\right)_n= \Braket{\phi_i|\phi^\text{D}_n}$ and $\left(\vctr{V}_{(j)}\right)_n=\Braket{\phi_j|\phi^\text{D}_n}$ respectively, into vectors we obtain

\begin{equation}
   H_{ij} = \vctr{V}_{(i)} \matr{E}   \vctr{V}_{(j)}^\dagger .
  \label{eq:dipro_eq17}
\end{equation}
%
What is left to do is determine these projections $\vctr{V}_{(k)}$. In all practical calculations the molecular orbitals are expanded in basis sets of either plane waves or of localized atomic orbitals $\Ket{\varphi_\alpha}$. We will first consider the case that the calculations for
the monomers are performed using a counterpoise basis set that is commonly used to deal with the basis set superposition error (BSSE). The basis set of atom-centered orbitals of a monomer is extended to the one of the dimer by adding the respective atomic orbitals at virtual coordinates of the second monomer. We can then write the respective expansions as

\begin{equation}
 %\begin{aligned}
  \Ket{\phi_{k}} = \sum_{\alpha} \lambda^{(k)}_\alpha \Ket{\varphi_\alpha} \hspace{1cm}\text{and}\hspace{1cm}
  \Ket{\phi^\text{D}_n} = \sum_{\alpha} D^{(n)}_\alpha \Ket{\varphi_\alpha}
  \label{eq:dipro_eq18}
\end{equation}
%
where $k=i,j$. The projections can then be determined within this common basis set as

 \begin{equation}
  \begin{aligned}
     \left(\vctr{V}_k\right)_n=\Braket{\phi_k|\phi^\text{D}_n} = \sum_{\alpha} \lambda^{(k)}_{\alpha} \Bra{\alpha} \sum_{\beta} D^{(n)}_{\beta} \Ket{\beta} =
     \vctr{\boldsymbol{\lambda}}_{(k)}^\dagger \matr{\mathcal{S}} \vctr{D}_{(n)}
%     %\\
% %    \Braket{B|i} = \sum_{\alpha} B_{\alpha} \Bra{\alpha}
% %    \sum_{\beta} D^{(i)}_{\beta} \Ket{\beta} =
% %    \vctr{B}^\dagger \matr{S} \vctr{D}^{(i)} \\
  \end{aligned}
   \label{eq:dipro_eq19}
 \end{equation}
where $\matr{\mathcal{S}}$ is the overlap matrix of the atomic basis functions. This allows us to finally write the elements of the Hamiltonian and overlap matrices in \equ{dipro_eq3} as:

 \begin{equation}
  \begin{aligned}
     H_{ij} &= \vctr{\boldsymbol{\lambda}}_{(i)}^\dagger \matr{\mathcal{S}} \matr{D} \matr{E} \matr{D}^\dagger \matr{\mathcal{S}}^\dagger \vctr{\boldsymbol{\lambda}}_{(j)}  \\
     S_{ij} &= \vctr{\boldsymbol{\lambda}}_{(i)}^\dagger \matr{\mathcal{S}} \matr{D}  \matr{D}^\dagger \matr{\mathcal{S}}^\dagger \vctr{\boldsymbol{\lambda}}_{(j)}
  \end{aligned}
   \label{eq:dipro_eq20}
 \end{equation}
%
Since the two monomer frontier orbitals that form the basis of this expansion are not orthogonal in general ($\matr{S} \neq \matr{1}$), it is necessary to transform \equ{dipro_eq2} into a standard eigenvalue problem of the form
%
\begin{equation}
  \matr{H}^{\mathrm{eff}} \vctr{C}^{\mathrm{eff}} =   E \vctr{C}^{\mathrm{eff}}
  \label{eq:dipro_eq7}
\end{equation}
%
to make it correspond to \equ{dipro_eq1}. According to L\"owdin such a transformation can be achieved by
%
\begin{equation}
  \matr{H^\mathrm{eff}} = \matr{S}^{\left. {-1} \middle/ {2} \right.}
  \matr{H}\matr{S}^{\left. {-1} \middle/ {2} \right.}.
  \label{eq:dipro_eq9}
\end{equation}
%
This then yields an effective Hamiltonian matrix in an orthogonal basis, and its entries can directly be identified with the site energies $\epsilon_i$ and transfer integrals $J_{ij}$:
%
\begin{equation}
 \begin{aligned}
  \matr{H}^{\mathrm{eff}} &=
    \begin{pmatrix}
      e_i^{\mathrm{eff}}    &  H_{ij}^\mathrm{eff} \\
      H_{ij}^{*,\mathrm{eff}}   &  e_j^\mathrm{eff}
    \end{pmatrix} =
    \begin{pmatrix}
      \epsilon_i    &  J_{ij} \\
      J_{ij}^*      &  \epsilon_j
    \end{pmatrix}
 \end{aligned}
  \label{eq:dipro_eq11}
\end{equation}

 \begin{figure}[htb]
     \center
     \includegraphics[width=\linewidth]{fig/coupling}
     \caption{Schematics of the DIPRO method. (a) General workflow of the projection technique. (b) Strategy of the efficient noCP+noSCF implementation, in which the monomer calculations are performed independently form the dimer configurations (noCP), using the \calc{edft} \calculator. The dimer Hamiltonian is subsequently constructed based on an initial guess formed from monomer orbitals and only diagonalized once (noSCF) before the transfer integral is calculated by projection. This second step is performed by the \calc{idft} \calculator. }
     \label{fig:dipro_scheme}
 \end{figure}


\section{Green functions}
Up to now we have left the boundary conditions that $G$ has to satisfy
unspecified.

Which boundary conditions we choose depends on convenience.
\begin{align}
    \phi(\vec{x})
    &=
    \frac{1}{4\pi\epsilon_0}
    \int_V \rho\left( \vec{x}' \right) G\left( \vec{x}', \vec{x} \right)\,
    d^3\vec{x}'\\\nonumber
    &\qquad
    + \frac{1}{4\pi}
    \oint_S\left[
    G\left( \vec{x}', \vec{x} \right)
    \left(
    \vec{\nabla}' \phi\left( \vec{x}' \right)
    \cdot \hat{n}'
    \right)
    -
    \phi\left( \vec{x}' \right)
    \left(
    \vec{\nabla}' G\left( \vec{x}', \vec{x} \right)
    \right)
    \right]\, dS'
\end{align}

The simplest consistent choice is
\begin{align}
    \vec{\nabla}' G_N \left( \vec{x}', \vec{x} \right)
    &=
    -\frac{4\pi}{S}
\end{align}
where $S$ is the teal area of the boundary surface.
\begin{align}
    \phi\left( \vec{x} \right)
    &=
    \langle \phi\rangle_S
    +
    \frac{1}{4\pi\epsilon_0}
    \int_V \rho\left( \vec{x}' \right)
    G_N\left( \vec{x}', \vec{x} \right)
    \, d^3 \vec{x}'
    +
    \frac{1}{4\pi}
    \oint_S G_N\left( \vec{x}', \vec{x} \right)
    \left(
    \vec{\nabla}' \phi\left( \vec{x}' \right)
    \cdot
    \hat{n}'
    \right)\, dS'
\end{align}
where $\langle \phi\rangle_S$
is the average of $\phi$ over the bounding surface.

Finding the Green function is the hard part.
Everything else is easy.

\subsection{Example: Two hemispheres}
Let's do an example.

Consider a sphere made up of two conducting hemispheres that are kept at
different potentials.
And the centre of the sphere is the origin.
The upper sphere is at potential $+V$ and the lower potential is at potential
$-V$.

The problem is to find the potential due to the sphere everywhere in space.
A very standard problem.
It doesn't look very much like a Greens function problem.
Why are we able to solve this?
Because using them method of images,
we found the Green's function for a grounded conducting sphere.

Recall that using them method of images,
we found the potential due to a point charge near a conducting sphere,
and from just that we can obtain the Greens function.
\begin{align}
    G_0\left( \vec{x}', \vec{x} \right)
    &=
    \frac{1}{\left| \vec{x} - \vec{x}'\right|}
    -
    \frac{a}{r'\left|
    \vec{x}
    -
    \frac{a^2}{r'^2}\vec{x}'
    \right|}
\end{align}
Here is the magic.
We didn't solve this for an arbitrary potential,
we solved it for a conducting sphere grounded.
But that is the boundary condition for the Dirichlet Green function,
which is chosen so that $G=0$ on the surface.
So it happens that when we solve this problem for the grounded conducting
sphere,
we were actually finding the Dirichlet Greens function.
Zero potential on the bounded surface,
so it's grounded.
That is exactly the Greens function.
What we were solving the problem,
what we were really solving is the Dirichlet Greens function.
So we know the answer.
That's the Dirichlet greens function.
Now you might say what does that have to do with  completely different
problem where the potential nd boundary have nothing to do with the grounded
sphere we originally solved.
That's the magic of the Greens function method.

Once you know the Greens function of the Dirichlet function,
then for any Dirichlet boundary function of the potential,
the answer is given in terms of these integral.s

Recall that
\begin{align}
    \phi\left( \vec{x} \right)
    &=
    \frac{1}{4\pi\epsilon_0}
    \int_V
    \rho\left( \vec{x}' \right)
    G_D\left( \vec{x},\vec{x}' \right)
    \, d^3\vec{x}'
    -
    \frac{1}{4\pi}
    \oint_S
    \phi\left( \vec{x}' \right)
    \left\{
    \vec{\nabla}' G_D \left( \vec{x}', \vec{x} \right)
    \cdot \hat{n}'
    \right\}
    \,dS'
\end{align}
Now here's the thing.
What is $\rho\left( \vec{x}' \right)$?
It's zero, because there are no charges.
We know the Greens function,
so we can calculate this gradient.
And $\phi(\vec{x}')$ is specified on the surfaces.

And then we can do the problem we want to solve by evaluating this integral.
You see the power of this method.
The problem you originally solved looks noting like this problem.
The only thing the same is the surface.
This is a sphere
that's a sphere.
Everything else is changed.
Charges are changed,
boundary conditions have changed.

Once you know the Greens function for that surface,
then it just doesn't matter.
It's the surface that matters.
Once you have solved the Greens function for that surface with Dirichlet
boundary conditions,
you're done.
Just plug it into this formula.
That's the magic.
Then of course you may say this is a messy integral,
but that's completely different.
That's not the hard work.
The real hard work was finding the Greens function.

It was easy with the method of images here,
but for more general geometries it's much harder.

Any problem you can solve by the method of images you can use this method.

In spherical coordinates
\begin{align}
    \left|
    \vec{x} - \vec{x}'
    \right|
    &=
    \sqrt{%
    r^2 + {r'}^2
    - 2rr' \cos\gamma
    }
\end{align}
where $\gamma$ is the angle between $\vec{x}$ and $\vec{x}'$.

Then
\begin{align}
    r'
    \left|
    \vec{x}
    -
    \frac{a^2}{r'^2}\vec{x}'
    \right|
    &=
    \sqrt{
    r^2 r'^2 - 2a^2 rr' \cos\gamma
    + a^4
    }
\end{align}
and
\begin{align}
    \cos \gamma &= \hat{e}_r \hat{e}_{r'}
\end{align}
where
\begin{align}
    \hat{e}_r
    &=
    \sin\theta \cos\phi \hat{e}_x
    + \sin\theta \sin\phi \hat{e}_\phi
    + \cos\theta \hat{e}_z\\
    \hat{e}_{r'}
    &=
    \sin\theta' \cos\phi' \hat{e}_x
    + \sin\theta' \sin\phi' \hat{e}_\phi
    + \cos\theta' \hat{e}_z\\
\end{align}
And in spherical coordinates
\begin{align}
    \cos\gamma
    &=
    \cos\theta \cos\theta'
    + \sin\theta \sin\theta' \cos\left( \phi - \phi' \right)\\
    G_D\left( \vec{x}, \vec{x}' \right)
    &=
    \frac{1}{\sqrt{
    r^2 + r'^2 + 2r r' \cos\gamma
    }}
    -
    \frac{1}{\sqrt{
    \frac{r^2 r'^2}{a^2}
    + a^2
    - 2 r r' \cos\gamma
    }}
\end{align}
We need to calculate $\vec{\nabla}'G_D$.
You can check that the Green function is symmetric
\begin{align}
    G\left( \vec{x}, \vec{x}' \right)
    &=
    G\left( \vec{x}', \vec{x}' \right)
\end{align}
Coming back to this,
what is $\hat{n}'$.
What should I choose for it in the coordinate systems I've chosen.
You should choose
\begin{align}
    \hat{n}' &= -\hat{e}_{r'}
\end{align}
But why the minus sign?
Remember,
we're living in the volume outside the sphere.
$\hat{n}'$ is the unit vector going \emph{out} of our volume
where we are trying to solve for the potential,
so it should be going into the sphere.
That's a common thing to mess up.

So then this becomes
\begin{align}
    \vec{\nabla}' G_D \left( \vec{x}', \vec{x} \right)
    \cdot \hat{n}'
    &=
    - \frac{\partial G_D}{\partial r'}
\end{align}
and it's just a lot of algebra,
but all the steps are given in my notes.
When all the dust settles,
\begin{align}
    - \frac{\partial G_D}{\partial r'}
    &=
    \frac{-\left( r^2 - a^2 \right)}{
    \left( r^2 + a^2 - 2ar\cos\gamma \right)^{3/2}
    }
\end{align}

So after doing some steps,
\begin{align}
    \phi\left( \vec{x} \right)
    &=
    \frac{1}{4\pi}
    \int_S
    \phi\left( a, \theta', \phi' \right)
    \frac{-\left( r^2 - a^2 \right)}{
    \left( r^2 + a^2 - 2ar\cos\gamma \right)^{3/2}
    }
    d\Omega'
\end{align}
where $d\Omega' = \sin\hteta' \, d\theta'\, d\phi$
is the solid angle,
with $dS' = a^2 d\Omega'$.

This thing reduces to
\begin{align}
    \phi\left( \vec{x} \right)
    &=
    \frac{V a^2\left( r^2 - a^2 \right)}{4\pi a}
    \int_{0}^{2\pi}
    d\phi'
    \left[
    \int_{0}^{1}
    d\left( \cos\theta' \right)
    -
    \int_{-1}^{0}
    d\left( \cos\theta' \right)
    \right]
    \frac{1}{\left( a^2 + r^2 - 2ar\cos\gamma \right)^{1/2}}
\end{align}
At this point the physics is kind of done.
In other words,
knowing this Greens function,
you can find the potential for this sphere,
reduced to some integral,
which we may not do in closed form,
but the answer is here.

\begin{question}
    What if there are multiple surfaces?
\end{question}
Then you have many integrals.

But this is about as an easy of a problem as you can get with Green's function.
That was a very easy problem.

\section{Method of Orthogonal Basis Functions}
Suppose you know the Greens function for some boundary,
for arbitrary boundary conditions you can find the potential.
But how do you find the Green's function?
In general it's hard.

The method of images works some times.

I will now discuss another method.

The idea here is that in the end,
solving a partial differential equation,
like Poisson's equation or Laplace's equation,
the physicist favorite method is separation of variables.
There are certain geometries where the Laplacian geometry is separable.
There are a dozen or so where Laplace's equation is separable.
We're not going to do all the dozen.
If you took the math methods class 40 years ago,
you would learn a whole dozen.
Nowadays you only have to study 3,
which are Cartesian, spherical and cylindrical.
That's pretty much the rest of the course.

So we're just going to do a couple of examples with Cartesian,
spherical, cylindrical.
For some reason,
the number of cylindrical examples in the books is fewer,
even though it's harder.

Let's start with the easy case of Cartesian.

Here's the problem.
Not sure if you've solved this as an undergraduate.
The problem is that you have a rectangular box
with sides $\Delta x = a$,
$\Delta y = b$ and $\Delta z = c$.
This box is sitting with one of its corners in the origin.
This height is $c$,
this distance is $a$ and this distance if $b$.
It's a rectangular box.
So you understand this geometry or is it mysterious?
Anyway that's what it is.

All the sides of the box are at zero potential except the top
$z=c$,
which is at potential $V(x, y)$,
which is some specific function that is specified.
You're told that at the top of the box,
the potential satisfies this.

The problem is to solve for $\phi$ everywhere inside the box.
This is not particularly hard.
You just have to solve Laplace's equation inside the box.
Since the sides of the box parallel to $xyz$,
it's most convenient to use Cartesian coordinates.
\begin{align}
    \frac{\partial^2 \phi}{\partial x^2}
    +
    \frac{\partial^2 \phi}{\partial y^2}
    +
    \frac{\partial^2 \phi}{\partial z^2}
    &=
    0
\end{align}
We're going to solve this using the method of separation of variables.

Here's the idea.
We begin by looking for a solution
of very specific form.
\begin{align}
    \hat{\phi}\left( x, y, z \right)
    &=
    X(x) Y(y) Z(z)
\end{align}
In the end the final solution will not be of this form,
but it will be a superposition of solutions of this form.
So you find solutions like this and then you add them up to satisfy the boundary
conditions.
Substituting into Laplace's equation,
\begin{align}
    \frac{1}{X}\frac{d^2 X}{d x^2}
    +
    \frac{1}{Y}\frac{d^2 Y}{d y^2}
    +
    \frac{1}{Z}\frac{d^2 Z}{d z^2}
    &=
    0
\end{align}
Before they were partial derivatives,
but here they are ordinary derivatives.
Rewrite this as
\begin{align}
    \frac{1}{X} \frac{d^2 X}{dx^2}
    + \frac{1}{Y} \frac{d^2 Y}{dx^2}
    &=
    -\frac{1}{Z}
    \frac{d^2 Z}{dz^2}
\end{align}
Now comes the crucial step.
The right side of the equation only depends on $z$.
The left side depends on $x,y$ but not on $z$.
Suppose I change $z$,
the right hand side should change,
but the left hand side can't change,
and the only way that can be true is if the right side doesn't actually depend
on $z$ at all.
Hence
\begin{align}
    -\frac{1}{Z}
    \frac{d^2 Z}{dz^2}
    =
    \text{constant}
\end{align}
that is independent of $z$
Let's give this constant a name.
\begin{align}
    -\frac{1}{Z}
    \frac{d^2 Z}{dz^2}
    =
    -\gamma^2.
\end{align}
Why the minus sign?
Because I know the answer.
Sometimes you can get the solution and find the sign is not nice and you have to
go back to this step to change the sign.
I know the answer and this choice is good.

Similarly,
you can say the same thing about the other side,
with $x$ and $y$.

Then we have two equations.
We started wiht one equation,
but now we have 2 equations.
\begin{align}
    \frac{1}{X}\frac{d^2 X}{dx^2}
    +
    \frac{1}{Y}\frac{d^2 Y}{dy^2}
    &=
    -\gamma^2
\end{align}
and we have
\begin{align}
    -\frac{1}{Z} \frac{d^2 Z}{dz^2} &= -\gamma^2
\end{align}
So now we can rewrite the first equation as
\begin{align}
    \frac{1}{X} \frac{d^2 X}{dx^2}
    &=
    -\frac{1}{Y} \frac{d^2 Y}{dy^2}
    - \gamma^2
\end{align}
and now we apply the same logic as before.
If I change $x$,
I should expect the left hand side ot chnage,
but the right side dosn't change,,
and the only way for that to be possible is that the left doesn't actually
depend on $x$ and so it's some constant independent of $x$ and $y$,
and let's call it $-\alpha^2$.
Once again there's a sign because I know the answer.
\begin{align}
    \frac{1}{X} \frac{d^2 X}{dx^2}
    &=
    -\alpha^2.
\end{align}
We can then define a parameter
\begin{align}
    \beta^2 &:= \gamma^2 - \alpha^2
\end{align}
and now we have 3 equations.
\begin{align}
    \frac{1}{X} \frac{d^2 X}{dx^2}
    &=
    -\alpha^2\\
    \frac{1}{Y}
    \frac{d^2 Y}{dy^2} &=
    -\beta^2\\
    \frac{1}{Z}\frac{d^2 Z}{dz^2} &=
    + \gamma^2.
\end{align}
So we have 3 ODEs and we know the boundary conditions
\begin{align}
    X(x) &= 0 &\text{at }x = 0 \text{ and } x = a\\
    Y(y) &= 0 &\text{at }y = 0 \text{ and } y = b
\end{align}
Then
\begin{align}
    X(x) &=
    \sin\left( \frac{n\pi x}{a} \right)\\
    Y(y) &=
    \sin\left( \frac{m\pi y}{b} \right)
\end{align}
where $n,m$ are integers
and we know
\begin{align}
    Z(z) &= 0 &\text{at } z = 0
\end{align}
so then
\begin{align}
    Z(z) &= \sinh\left( \gamma_{nm} z \right)
\end{align}
where
\begin{align}
    \gamma_{nm} &=
    \pi \sqrt{
    \left( \frac{n}{a} \right)^2
    +
    \left( \frac{m}{b} \right)^2
    }
\end{align}
There's still one boundary condition at the top we haven't used yet.
The thing about the hyperbolic sine is that it's monotonic.
If $\phi$ is zero at the top,
then I just get $\phi(z)=0$ everywhere,
so it's important I have some interesting boundary conditions.

To satisfy boundary conditions at $z=c$ for a linear superposition,
\begin{align}
    \ph(x, y, z)
    &=
    \sum_{n,m=1}^\infy
    A_{mn}
    \sin\left( \frac{n \pi x}{a} \right)
    \sin\left( \frac{m \pi y}{b} \right)
    \sinh\left( \gamma_{mn} z \right)
\end{align}
and we require that
\begin{align}
    \phi\left( x, y, c \right) &= V\left( x, y \right)
\end{align}
This is really just double Fourier seris for $V(x, y)$.
What we need to do is invert this and find the Foufier coefficients
$A_{nm}$.
Use the identity
\begin{align}
    \frac{2}{L}\int_{0}^{L} dx\,
    \sin\left( \frac{n\pi x}{L} \right)
    \sin\left( \frac{n'\pi x}{L} \right)
    &=
    \delta_{n,n'}
\end{align}
iSo then
\begin{align}
    \int_{0}^{a}dx\,
    \left( \frac{z}{a} \right)
    \sin\left( \frac{n'\pi x}{a} \right)
    \int_{0}^{b}dy\,
    \left( \frac{z}{b} \right)
    \sin\left( \frac{m' \pi y}{b} \right)
    V\left( x, y \right)
    &=&
    \sum_{n,m}
    A_{nm} \delta_{nn'} \delta_{mm'}
    \sin\left( \Gamma_{nm} z \right)
\end{align}
which gives
\begin{align}
    A_{nm}
    &=
    \frac{4}{ab}
    \frac{1}{\sinh\left( \gamma_{nm} z \right)}
    \int_{0}^{a} dx
    \int_{0}^{L} dy\,
    \sin\left( \frac{n\pi x}{a} \right)
    \sin\left( \frac{m\pi y}{b} \right)
    V\left( x, y \right)
\end{align}

Meake sure you can solve the problems in hte homework chop chop.
The problems aresimliar but not the same.
You need to do those right quicklky.
Some questions are straightforward but longer,
but you can do those later once you've finished the fast ones.
You guys should do well in this exam.
EM no matter how easy is going to be a hard exame.


\chapter{Cylindrical function decomposition of a tilted incident plane wave}\label{Ch:PlanewaveDecomposition}
As an example of applying the mode decomposition technique we used above to find the projected bounded and unbounded modes under cylindrical boundary conditions, below, we demonstrate a simple case on decomposing a tilted incident plane wave into corresponding cylindrical modes. The solution might be useful to give us some insights on solving the corresponding nanofiber problem when an external field presents, which is the case for some cooling and state preparation protocols demonstrated in experiments~\cite{Meng2017ground,Ostfeldt2017Dipole}.

The key to solve this kind of problems is to decompose all field functions into cylindrical functions. The bare nanofiber modes have already been decomposed into cylindrical functions in the last section; therefore, here, we only need to decompose the incident field as cylindrical functions.

We assume the incident plane wave is given by
\begin{equation}
\mathbf{E}(\br,t)=\re\left[\mathbf{U}(\br,t) \right]=\mathbf{E}_0 \cos (\mathbf{k}\cdot\mathbf{r}-\omega t + \phi_0),
\end{equation}
where the forward propagating wave can be given by
\begin{align}
\mathbf{U}(\br,t) &= \mathbf{U}_0e^{i(\mathbf{k}\cdot\mathbf{r}-\omega t + \phi_0)}\\
&= \mathbf{U}_0e^{i\mathbf{k}\cdot\mathbf{r}}e^{i(\phi_0-\omega t )}.
\end{align}
with the initial phase, $\phi_0$, and the vector amplitude of $\mathbf{U}_0$. We can ignore the phase offset, and separate the spatial and temporal parts for the forward-propagating field. We want to expand the plane wave function into cylindrical functions, and thus we can apply the technique we used in the last appendix to solve the boundary condition problem and decompose the bound and radiation modes. The only term that needs to be expanded is the $ e^{i\mathbf{k}\cdot\mathbf{r}} $ factor.

We define $ \mathbf{k}\cdot\mathbf{r}=(k\!_{\perp}\mathbf{e}\!_{k\!_\perp}+k_z\mathbf{e}_{z}) \cdot(r\!_{\perp}\mathbf{e}\!_{r\!_\perp}+z\mathbf{e}_{z}) = k\!_{\perp}r\!_{\perp}\cos(\phi_{k}-\phi_{r})+k_{z}{z}= k\!_\perp r\!_\perp \cos \Delta\phi +k_{z}{z}$, where $ \Delta\phi=\phi_{k}-\phi_{r} \in [0,2\pi)$ is the angle between $ \mathbf{e}_{k\!_\perp} $ and $ \mathbf{e}_{r\!_\perp} $. Thus
\begin{align}
e^{i\mathbf{k}\cdot \mathbf{r}}=e^{ik\!_\perp r\!_\perp\cos\Delta\phi}e^{ik_{z}{z}}
\end{align}
is a periodic function of $ \Delta\phi $ and hence can be expanded into a Fourier series given below.
\begin{align}
e^{i\mathbf{k}\cdot \mathbf{r}} &= \sum_{m=-\infty}^{\infty}c_{m}(k\!_\perp r\!_\perp)e^{im\Delta\phi}e^{ik_{z}{z}},
\end{align}
where the coefficients $ c_{m}(k\!_\perp r\!_\perp) $ is associated with Bessel's first integral\index{Bessel function!Bessel's first integral}~\footnote{see Jackson's E\&M of Ref.~\cite{Jackson1975}, on page 140.}
\begin{align}
c_{m}(k\!_\perp r\!_\perp)&= \frac{1}{2\pi} \int_0^{2\pi} e^{ik\!_\perp r\!_\perp\cos \Delta\phi}e^{-im\Delta\phi}\mathrm{d}\Delta\phi\\
&=i^mJ_m(k\!_\perp r\!_\perp).
\end{align}
Therefore, we have
\begin{align}
e^{i\mathbf{k}\cdot \mathbf{r}} &=\sum_{m=-\infty}^{\infty}i^me^{im\Delta\phi}e^{ik_{z}{z}}J_m(k\!_\perp r\!_\perp).
\end{align}

Notice that the first kind of Bessel's function\index{Bessel function!Bessel function of the first kind} usually represent standing radial waves, while Hankel functions\index{Hankel function} usually describe traveling waves. Using the relationships that $ J_{m}(k\!_\perp r\!_\perp)=H_{m}^{(1)}(k\!_\perp r\!_\perp)+H_{m}^{(2)}(k\!_\perp r\!_\perp) $, we can re-express the plane wave in terms of incoming (at negative r) and outgoing (at positive r) as below.
\begin{align}
e^{i\mathbf{k}\cdot \mathbf{r}} &=\sum_{m=-\infty}^{\infty}i^me^{im\Delta\phi}e^{ik_{z}{z}} H_{m}^{(1)}(k\!_\perp r\!_\perp)+\sum_{m=-\infty}^{\infty}i^me^{im\Delta\phi}e^{ik_{z}{z}} H_{m}^{(2)}(k\!_\perp r\!_\perp).
\end{align}

This result shows that only when $ k_z=\beta $ can the tilted plane wave contributes to nanofiber modes be with wavenumber $ \beta $, since both $ k_z $ and $ \beta $ have consistent physics meaning. Therefore, when a plane wave comes perpendicular to the fiber axis, the wave can rarely couple to the fiber's guided modes, which is good for minimizing the influence of the incident external field directly mixed into the detected signal at the end of the fiber.


\lesson{1}{Sep 07 2021 Tue (16:52:35)}{Rational Exponents}{Unit 1}

\subsubsection*{Rational Exponents become $\rightarrow$ Radical Expressions}

The \bf{numerator} of the \bf{rational exponent} becomes the \bf{exponent} on the \bf{radicand}.
The \bf{denominator} of the \bf{rational exponent} becomes the \bf{index}, or \bf{root}, of the \bf{radical}.

\begin{align}
    t^{\frac{3}{4}} = \sqrt[4]{t^3}
\end{align}

\subsubsection*{Radical Expressions become $\rightarrow$ Rational Exponents}

The \bf{exponent} on the \bf{radicand} becomes the \bf{numerator} of the \bf{rational exponent}. The \bf{index}, or \bf{root}, of the \bf{radical} becomes the \bf{denominator} of the \bf{rational exponent}.

\begin{align}
    \sqrt[8]{w^5} = w^{\frac{5}{8}}
\end{align}

\newpage