\documentclass{article}  %Need this.

\usepackage{amsmath,amsthm,amssymb}

\newtheorem*{thm}{Theorem}
\newtheorem*{cnj}{Conjecture}
\newtheorem*{lem}{Lemma}
\newtheorem*{cor}{Corollary}
\newtheorem*{prop}{Proposition}

\newcommand{\N}{\mathbb{N}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\R}{\mathbb{R}}

\title{Proof Portfolio Problem \#  1--  Example--}
\author{--Dr. Keough --}
\date{}

\begin{document}
\maketitle  %This will add the title, author, and date located above

Here's the problem: You work for a cell phone company which has just invented a new cell phone protector and wants to advertise that it can be dropped from the $n^{th}$ floor without breaking.
If you are given 2 phones and a 100 story building, how do you guarantee you know the highest floor it won't break with the smallest number of trial drops?

You might want to try this problem before you read the proof. On the next page I include my scratchwork.

\newpage
...

\newpage

\begin{thm}
If there are 2 cell phones and a 100 story building available then one can test dropping cell phones from 14 stories and find the maximum number of stories the cell phone can be dropped from without breaking.
\end{thm}

\begin{proof}
We will describe an algorithm for needing only to drop from 14 stories. Our first step will be to drop the first phone from the $14^{th}$ floor. If the phone breaks from this floor, we will test floors $1$ through $13$, in order, until the cell phone breaks, giving us up to a total of $14$ drops. If the phone does not break on a drop from the $14^{th}$ floor, we will drop the phone from the $27^{th}$ floor. If the phone breaks from the $27^{th}$ floor, we'll need to test floors $15$ through $26$. This is 12 more floors, in addition to the drop from the $14^{th}$ and the drop from the $27^{th}$ again giving us $14$ drops.

We'll continue this process by dropping from floors $39, 50, 60, 69, 77, 84, 90, 95,$ and finally $99$. If we make it all the way to the $99^{th}$ floor then we will have done $11$ drops. In any other case, we will do $14$ total drops as seen by the following cases, which consider the first floor the phone breaks on from the list $39, 50, 60, 69, 77, 84, 90, 95$:
	\begin{itemize}
	\item The phone first breaks on the $39^{th}$ floor: In this case we test floors $14, 27, 39$ and floors $28-38$ giving $14$ total drops.
	\item The phone first breaks on the $50^{th}$ floor: In this case we test floors $14, 27, 39, 50$ and floors $40-49$ giving $14$ total drops.
	\item The phone first breaks on the $60^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60$ and floors $51-59$ giving $14$ total drops.
	\item The phone first breaks on the $69^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60, 69$ and floors $60-68$ giving $14$ total drops.
	\item The phone first breaks on the $77^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60, 69, 77$ and floors $70-76$ giving $14$ total drops.
	\item The phone first breaks on the $84^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60, 69, 77, 84$ and floors $78-83$ giving $14$ total drops.
	\item The phone first breaks on the $90^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60, 69, 77, 84,90$ and floors $85-89$ giving $14$ total drops.
	\item The phone first breaks on the $95^{th}$ floor: In this case we test floors $14, 27, 39, 50, 60, 69, 77, 84,90,95$ and floors $91-94$ giving $14$ total drops.
	\end{itemize}

Thus we see that we can figure out the maximum floor where the phone breaks in $14$ total drops.
\end{proof}

\newpage

\section*{A Couple of Notes}

\begin{enumerate}
\item Note the proof does not claim that there isn't a better solution. Don't feel like you need to do every piece of a problem. Figure out something cool, and try to prove it.
\item On that note it's best to check your conjectures with me. I can help you if they are too hard, too obvious, too false, and also brainstorm proof ideas.
\item Remember that  a proof, at its heart, is just an explanation that other mathematicians believe. Don't feel like you need to adhere to strictly to a specific proof technique. Give a convincing explanation.
\item Pick a problem you like and start early so that this can be fun and not something you're worried about in the last week of the semester.
\end{enumerate}

\end{document}


\appendix
\chapter*{Additional figures}
\paragraph{Chapter 4 : Looking into financial data} \textcolor{white}{Below, the cumulated residuals between }
\begin{table}[h]
	\centering
	\begin{tabular}[]{ | p{3cm} || m{9cm} ||}
		\hline
		Stock & Cumulative residuals between $\exp(R_t)$ and $1 + R_t$  \\ \hline
		BNP & 3.22E-15  \\ \hline
		Carrefour & 1.44E-15  \\ \hline
		LVMH & 4.75E-15  \\ \hline
		Sanofi & 1.55E-15  \\ \hline
		Total & 3.86E-15  \\ \hline
	\end{tabular}
		\caption{Cumulative residuals between $\exp(R_t)$ and $1 + R_t$ for the BNP, Carrefour, LVMH, Sanofi, Total stocks}
		\label{tab:cumulativeResidualsStocks}
\end{table}


\chapter{Summary and Discussion}
\label{chapter.summary}

We have first discussed entropy for percolation. Note that percolation
is a probabilistic model and hence Shannon entropy is the only hope if we want to measure entropy
for percolation. To measure the Shannon entropy for percolation we
have defined the cluster picking probability $\mu_i$ that a site is picked at random belongs to
the labelled cluster $i$. It gives entropy which is consistent with the behaviour
of the order parameter. Essentially entropy measures
the degree of disorder while order parameter measures the extent of order. Thus, entropy and order parameter cannot be minimum or maximum
at the same state since the system cannot be in most disordered and most ordered state at the same time.
However, by measuring entropy and order parameter using existing definition for site percolation, we find
that at $p=0$ both order parameter and entropy equal
to zero which is absurd. It demands immediate correction to the definition of entropy and we obliged.
Note that in the bond percolation we occupy bond to connect sites and measure clusters by the
number of sites. In analogy with that we redefine the site percolation as follows. We occupy sites to connect
bonds which are assumed to exist already in the system and measure clusters in terms of the number of bonds. On the other hand, occupation probability in the bond (site) percolation is the fraction of bonds (sites) occupied
in the system. With this new definition we have found the entropy behaves exactly in the same way as
it does in the case of its bond counterpart. Thus the conflict that the system is in ordered and disordered
at the same state is resolved.

The question that arises then is: Do we recover all the known results? To verify
this we obtained all the necessary critical exponents with the new definition for
site percolation. Earlier it was well-known that bond and site percolation belong to the
same universality class regardless of the nature of lattice but have the same dimension.
We have confirmed that bond and redefined site percolation still belong to the same universality class.
Note that scaling theory predicts that the various critical exponents cannot just assume values
independently  rather they are bound by some scaling and hyperscaling relations. One
of the most interesting relations is the Rushbrooke inequality $\alpha+2\beta+\gamma\geq 2$.
Substituting our values of $\alpha=0.906$, $\gamma=0.8543$ and already
known value of $\beta=0.137$ we find $\alpha+2\beta+\gamma=2.0347$.
We can thus conclude that the RI holds almost as equality but marginally greater
than $2$.

 %%%%%%%%%%%% RSBD summary
 Then we have investigated percolation by random sequential ballistic deposition (RSBD) on a square lattice with interaction range upto second nearest neighbors. The critical points $p_c$ and all the necessary critical exponents $\alpha$, $\beta$, $\gamma$, $\nu$ etc. are obtained numerically for each range of interactions. Like  in its thermal counterpart, we find that the critical exponents of RSBD depend on the range of interactions and for a given range of interaction they obey the Rushbrooke inequality. We obtain  the fractal dimension $d_f$ that characterizes the spanning cluster at $p_c$. Our results suggest that the RSBD for each range of interaction belong to a new universality class which is in sharp contrast to earlier results of the only work that exhist on RSBD.

We denote $L_0,L_1,L_2$ for expressing direct, first nearest neighbor and second nearest neighbor interaction respectively. Obviously $L_0$ denotes the regular kind of site percolation where we choose a site randomly with uniform probability and occupy it if it is empty else we skip the step. And $L_1$ is the class where we choose one of the four neighbor to occupy whenever we fail to do $L_0$ but only if the neighbor is empty else we skip the step. Finally in $L_2$ we choose the neighbor in the direction of the second neighbor, which was picked but was not empty, to occupy if it is empty else we skip the step. We have found that for $L_1$ and $L_2$ the exponents $\alpha, \beta, \gamma, \nu$ are consistent and they belong to a universality class respectively.
Note that  we can use new feature of $L_1$ only if the feature of $L_0$ is unavailable, i.e., the selected site is already occupied. Similarly we can use new feature of $L_2$ only if the feature of $L_0$ and $L_1$ is unavailable. Using this in mind we perform simulation and we obtain the critical exponents which agree with the laws of thermodynamics and the Rushbrooke inequality is satisfied in all cases.

\clearpage
\newpage
\section{Results}
Here we list all the exponents found in our investigation of site percolation after redefining it and the RSBD model. Table (\ref{tab:exponents-combined}) Lists all the critical values and exponents as we find them in our exponents. Note that we can get the exponent $a$, for example, from exponent $a/\nu$ simply by dividing them by $1/\nu$ which is shown in table (\ref{tab:rushbrooke}) where we also show that the Rushbrooke inequality is satisfied.
\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|c|c|c|}
	\hline
	Interaction & $p_c$ & $1/\nu$ & $\alpha/\nu$ & $\beta/\nu$ & $\gamma/\nu$ \\ \hline
	$L_0$ & 0.5927 & 0.75  & 0.6799 & 0.103  & 0.64071  \\ \hline
	$L_1$ & 0.5782 & 0.736 & 0.6712 & 0.1026 & 0.6287  \\ \hline
	$L_2$ & 0.5701 & 0.721 & 0.6631 & 0.0982 & 0.6362  \\ \hline
\end{tabular}
\caption{List of combined exponents}
\label{tab:exponents-combined}
\end{table}

\begin{table}[h]
\centering
\begin{tabular}{|c|c|c|c|c|}
	\hline
	Interaction & $\alpha$ & $\beta$ & $\gamma$ & $\alpha+2\beta+\gamma$ \\ \hline
	$L_0$  & 0.906 & 0.137 & 0.8543 & 2.0347   \\ \hline
	$L_1$  & 0.911 & 0.139 & 0.8542 & 2.044   \\ \hline
	$L_2$  & 0.919 & 0.136 & 0.882  & 2.07    \\ \hline
\end{tabular}
\caption{Exponents Satisfying Rushbrooke Inequality}
\label{tab:rushbrooke}
\end{table}

Finally we list all the fractal dimensions, $d_f$, for different interactions in table (\ref{tab:cluster-info}).
\begin{table}[h]
	\centering
	\begin{tabular}{|c|c|c|}
		\hline
		Interaction 	& $d_f$     \\ \hline
		$L_0$ (standard) 	& 91/48     \\ \hline
		$L_0$ (obtained)	& 1.8939   \\ \hline
		$L_1$				& 1.8994      \\ \hline
		$L_2$				& 1.9081     \\ \hline
	\end{tabular}
	\caption{Fractal dimensions for $L_0,L_1,L_2$ respectively.}
	\label{tab:cluster-info}
\end{table}

Here we notice that the critical point decreases as we increase the range of interaction. But the fractal dimension increases. This is reasonable since my occupying nearest and second nearest neighbor we are increasing the change of any individual cluster to grow faster. This is the reason for the $p_c$ value to decrease. But it grows in area not in length average meaning when the spanning cluster appears it will contain more sites and bonds than in regular percolation which is evident from the fractal dimension $d_f$.
All other exponents changes a bit but their shape is not different. That's why change is not visible to the naked eye and it requires a thorough investigation.

\clearpage
\section{Further Research}
	The idea of RSBD molde can be applies to many other lattice structures. Notice that in square lattice we only have four neighbor for a site but in other structures of lattice we may have more or less than four neighbors for one site, e.g. honeycomb lattice, triangular lattice. Here we have only considered interaction up to second nearest neighbor which can be extended to an arbitrary range but it will only be effective if we take the lattice size to be large. Instead of single layer formation we can go for multi-layer formation since in real world if we drop particle (for example sand or grain) in a confined space then it will create multiple layer form. Controlling the velocity parameter at which the particle move to a certain direction can also be an interesting thing to do. We can try to involve particles of different sizes and apply the RSBD model which might give some interesting results.


\chapter{Paper Errata}\label{app:paperErrata}
This appendix shows some errors that appeared in the published papers.
\\
\subsubsection{Real-Time Implementation of an Elasto-Plastic Friction Model applied to Stiff Strings using Finite Difference Schemes \citeP[C]}
\begin{itemize}
    \item The authors in reference [15] are a bit shuffled.
\end{itemize}
\subsubsection{Real-time Implementation of a Physical Model of the Tromba Marina \citeP[D]}
\begin{itemize}
    \item The minus sign in Eq. (28) (and thus Eqs. (31) and (35)) should be a plus sign.
    \item $\sigma_{1,\text{s}}$ in Eq. (21) should be $\sigma_{1,\text{p}}$
    \item The unit of the spatial Dirac delta function $\delta$ should be m$^{-1}$
\end{itemize}
%
\subsubsection{DigiDrum: A Haptic-based Virtual Reality Musical Instrument and a Case Study \citeP[F]}
\begin{itemize}
    \item $\sigma_0$ and $\sigma_1$ should be multiplied by $\rho H$ in order for the stability condition to hold.
    \item stability condition is wrong. Should be:
    \begin{equation}
        h \geq \sqrt{c^2k^2 + 4\sigma_1k + \sqrt{(c^2k^2+4\sigma_1k)^2 + 16\kappa^2k^2}}
    \end{equation}
    \item Unit for membrane tension is N/m.
\end{itemize}
% %
% \subsubsection{Dynamic grids \citeP[G]}
% \begin{itemize}
%     \item Reference in intro for `recently gained popularity' should go to \cite{Bilbao2019CMJa} \\
%     \textit{Note: not really an error, but should be changed before resubmission}
% \end{itemize}


% !TEX root = ../main.tex
\section{Introduction}
In statistical physics, building a model corresponding to a physical system is useful: comparing how the model's predictions differ from experiment can be used to understand how a system behaves. For computing properties corresponding to a model's behavior, the normalization constant of the model's Boltzmann distribution in \Cref{eq:boltzmann} is a central quantity. The partition function can be used to derive properties of physics models that can be measured in experimental realizations, such as specific heat or magnetization. Such properties of models can be compared to experimental values, which can inform how a model might be improved to better mirror reality. But the partition function is intractable for many probabilistic models of interest, as described in \Cref{ch:background}.

One workaround to the problem of an intractable partition function is to use an approximate inference algorithm such as \gls{mcmc}. \gls{mcmc} relies on sampling likely configurations of a system and does not require calculating the partition function. In theory, these samples will be draws from the probability model of interest~\citep{metropolis1953equation,andrieu2003an-introduction}. For example, samples from the Boltzmann distribution can be used to approximate physical quantities derived from the probability model, such as specific heat.

However, with limited computation \gls{mcmc} has limitations. This method requires practitioners to use convergence diagnostics~\citep{brooks1998general} to assess whether samples from the algorithm are independent. Scalable \gls{mcmc} requires careful consideration. While some scalable versions of \gls{mcmc} have been developed~\citep{neal2011mcmc,welling2011bayesian}, they are biased samplers that may not have guaranteed convergence to samples from the probability model of interest. This is similar to how in \gls{vi} performance must often be assessed empirically. But in comparison to \gls{vi}, unless a model-specific algorithm has been developed~\citep{wolff1989comparison}, generic \gls{mcmc} methods do not readily scale to large numbers of random variables.
% - describe the contributions of our paper: (1) show that
% gibbs-bogoliubov-feynman inequality is equivalent to variational inference.
% (1) show how the reinforcement learning approach of wu (2019) is more
% naturally expressed in terms of variational inference. (2) show that a modern
% tool of variational inference, HVMs, is useful and improves on wu (2019) by
% scaling to larger system sizes.

In \Cref{ch:background} we showed that the machine learning framework of \gls{vi} is equivalent to the \acrlong{gbf} variational principle. This has allowed practitioners to study statistical physics models using many variational approximations, including \glspl{van}. As an example of a variational method enabled by \gls{vi}, we study \glspl{hvm} as approximations to the Boltzmann distribution of statistical physics models. We find that \glspl{hvm} scale to larger systems sizes than \glspl{van} in Sherrington-Kirkpatrick and Ising models. Testing the feasibility of \gls{vi} methods in statistical physics is a twofold opportunity. Statistical physics problems might serve as benchmarks for \gls{vi}, and using \gls{vi} for these problems can lead to improved computational methods in statistical physics. % and where exact solutions ar eknown?
\paragraph{Related Work.} The \gls{gbf} variational principle has been used to study Markov random fields~\citep{jun-zhang1996the-application} and the connection between variational inference and statistical physics has been well-documented~\citep{blei2017variational,hoffman2013stochastic,mackay2003information}. But this equivalence between \gls{vi} and the \gls{gbf} inequality might serve as an introduction to \gls{vi} for physicists. \citet{wu2019solving} implicitly use \gls{vi}, by developing \glspl{van} and a reinforcement learning policy gradient algorithm (however, \gls{vi} is not mentioned). Further, for a system of size $L$, autoregressive neural networks require $\cO(L^2)$ forward passes to sample a system configuration, making \glspl{van} intractable in larger systems. The use of \glspl{hvm} can be advantageous for statistical physics as these models can sample from a system in $\cO(L)$ time and yield results for larger systems.

\paragraph{Variational Inference.}
\gls{vi} is equivalent to the \gls{gbf} variational principle and requires similar choices of a practitioner. The variational family $q(\mbz; \mbnu)$ to approximate a model must be chosen, in addition to a method to maximize the variational lower bound in \Cref{eq:llbo}.

The \gls{vi} literature provides several choices of variational family, such as a mean field, factorized variational distribution with independent latent variables. Another choice of variational family is the Bethe approximation, which constrains the variational distribution to the polytope of mean parameters that captures correlations between any two latent variables~\citep{wainwright2008graphical}. Some machine learning research focuses on developing variational approximations that capture correlations between latent variables~\citep{hoffman2015stochastic,kingma2016improved,maaloe2016auxiliary,wu2019solving}. An example of a variational family that can model correlations between latent variables is the \gls{van} family~\citep{wu2019solving}, which uses autoregressive neural networks to parameterize the variational distribution ${q(\mbz_i \mid \mbz_1, \ldots, \mbz_{i-1})}$. We explore the \gls{hvm} class of variational approximations~\citep{ranganath2018black}.

The second choice required to employ \gls{vi} is how to optimize the variational lower bound in \Cref{eq:llbo}. The choice of variational family can limit the available optimization techniques. For a simple variational family like the mean field approximation, it may be possible to analytically evaluate the expectations in \Cref{eq:llbo}. Then derivatives of the variational bound with respect to the variational parameters $\mbnu$ and manual calculation can maximize the lower bound, as derived in \Cref{sec:ising-mean-field}. If more expressive variational families are used (e.g. \gls{van}s with thousands or millions of variational parameters), the analytic approach is infeasible. Stochastic optimization and automatic differentiation software have been used to develop several approaches to computing gradients of the variational lower bound, such as \acrlong{bbvi}~\citep{ranganath2018black,mohamed2019monte}.
\input{ch-hvm/fig/graphical_model}

The choice of variational family $q(\mbz; \mbnu)$ and optimization method for maximizing the variational lower bound leads to a trade-off intrinsic to \gls{vi}. Simple variational approximations such as the mean field family may be computationally feasible but inaccurate. The cost of increased accuracy, say by using a structured variational approximation, is increased computation. We illustrate the use of \gls{vi} in statistical physics by comparing two choices of variational approximation, \glspl{hvm}~\citep{ranganath2018black} and \glspl{van}~\citep{wu2019solving}. Many other variational approximations can be explored in future work.


% Copyright 2017-2019 Burlen Loring, Remi Lehe
%
% This file is part of WarpX.
%
% License: BSD-3-Clause-LBNL

\input{newcommands}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Moving window and optimal Lorentz boosted frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The simulations of plasma accelerators from first principles are extremely computationally intensive, due to the need to resolve the evolution of a driver (laser or particle beam) and an accelerated particle beam into a plasma structure that is orders of magnitude longer and wider than the accelerated beam. As is customary in the modeling of particle beam dynamics in standard particle accelerators, a moving window is commonly used to follow the driver, the wake and the accelerated beam. This results in huge savings, by avoiding the meshing of the entire plasma that is orders of magnitude longer than the other length scales of interest.

\begin{figure}
%\begin{centering}
\includegraphics[scale=0.6]{Boosted_frame.png}
%\par\end{centering}
\caption{\label{fig:PIC} A first principle simulation of a short driver beam (laser or charged particles) propagating through a plasma that is orders of magnitude longer necessitates a very large number of time steps. Recasting the simulation in a frame of reference that is moving close to the speed of light in the direction of the driver beam leads to simulating a driver beam that appears longer propagating through a plasma that appears shorter than in the laboratory. Thus, this relativistic transformation of space and time reduces the disparity of scales, and thereby the number of time steps to complete the simulation, by orders of magnitude.}
\end{figure}

Even using a moving window, however, a full PIC simulation of a plasma accelerator can be extraordinarily demanding computationally, as many time steps are needed to resolve the crossing of the short driver beam with the plasma column. As it turns out, choosing an optimal frame of reference that travels close to the speed of light in the direction of the laser or particle beam (as opposed to the usual choice of the laboratory frame) enables speedups by orders of magnitude \cite{Vayprl07,Vaypop2011}. This is a result of the properties of Lorentz contraction and dilation of space and time. In the frame of the laboratory, a very short driver (laser or particle) beam propagates through a much longer plasma column, necessitating millions to tens of millions of time steps for parameters in the range of the BELLA or FACET-II experiments. As sketched in Fig. \ref{fig:PIC}, in a frame moving with the driver beam in the plasma at velocity $v=\beta c$ (where $c$ is the speed of light in vacuum), the beam length is now elongated by $\approx(1+\beta)\gamma$ while the plasma contracts by $\gamma$ (where $\gamma=1/\sqrt{1-\beta^2}$ is the relativistic factor associated with the frame velocity). The number of time steps that is needed to simulate a ``longer'' beam through a ``shorter'' plasma is now reduced by up to $\approx(1+\beta) \gamma^2$ (a detailed derivation of the speedup is given below).

The modeling of a plasma acceleration stage in a boosted frame
involves the fully electromagnetic modeling of a plasma propagating at near the speed of light, for which Numerical Cerenkov
\cite{Borisjcp73,Habericnsp73} is a potential issue, as explained in more details below.
In addition, for a frame of reference moving in the direction of the accelerated beam (or equivalently the wake of the laser),
waves emitted by the plasma in the forward direction expand
while the ones emitted in the backward direction contract, following the properties of the Lorentz transformation.
If one had to resolve both forward and backward propagating
waves emitted from the plasma, there would be no gain in selecting a frame different from the laboratory frame. However,
the physics of interest for a laser wakefield is the laser driving the wake, the wake, and the accelerated beam.
Backscatter is weak in the short-pulse regime, and does not
interact as strongly with the beam as do the forward propagating waves
which stay in phase for a long period. It is thus often assumed that the backward propagating waves
can be neglected in the modeling of plasma accelerator stages. The accuracy  of this assumption has been demonstrated by
comparison between explicit codes which include both forward and backward waves and envelope or quasistatic codes which neglect backward waves
\cite{Geddesjp08,Geddespac09,Cowanaac08}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Theoretical speedup dependency with the frame boost}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
The derivation that is given here reproduces the one given in \cite{Vaypop2011}, where the obtainable speedup is derived as an extension of the formula that was derived earlier\cite{Vayprl07}, taking in addition into account the group velocity of the laser as it traverses the plasma.

Assuming that the simulation box is a fixed number of plasma periods long, which implies the use (which is standard) of a moving window following
the wake and accelerated beam, the speedup is given by the ratio of the time taken by the laser pulse and the plasma to cross each other, divided by the shortest time scale of interest, that is the laser period. To first order, the wake velocity $v_w$ is set by the 1D group velocity of the laser driver, which in the linear (low intensity) limit, is given by \cite{Esareyrmp09}:

%
\begin{equation}
v_w/c=\beta_w=\left(1-\frac{\omega_p^2}{\omega^2}\right)^{1/2}
\end{equation}
%
where $\omega_p=\sqrt{(n_e e^2)/(\epsilon_0 m_e)}$ is the plasma frequency, $\omega=2\pi c/\lambda$ is the laser frequency, $n_e$ is the plasma density, $\lambda$ is the laser wavelength in vacuum, $\epsilon_0$ is the permittivity of vacuum, $c$ is the speed of light in vacuum, and $e$ and $m_e$ are respectively the charge and mass of the electron.

In practice, the runs are typically stopped when the last electron beam macro-particle exits the plasma, and a measure of the total time of the simulation is then given by
%
\begin{equation}
T=\frac{L+\eta \lambda_p}{v_w-v_p}
\end{equation}
%
where $\lambda_p\approx 2\pi c/\omega_p$ is the wake wavelength, $L$ is the plasma length, $v_w$ and $v_p=\beta_p c$ are respectively the velocity of the wake and of the plasma relative to the frame of reference, and $\eta$ is an adjustable parameter for taking into account the fraction of the wake which exited the plasma at the end of the simulation.
For a beam injected into the $n^{th}$ bucket, $\eta$ would be set to $n-1/2$. If positrons were considered, they would be injected half a wake period ahead of the location of the electrons injection position for a given period, and one would have $\eta=n-1$. The numerical cost $R_t$ scales as the ratio of the total time to the shortest timescale of interest, which is the inverse of the laser frequency, and is thus given by
%
\begin{equation}
R_t=\frac{T c}{\lambda}=\frac{\left(L+\eta \lambda_p\right)}{\left(\beta_w-\beta_p\right) \lambda}
\end{equation}
%
In the laboratory, $v_p=0$ and the expression simplifies to
%
\begin{equation}
R_{lab}=\frac{T c}{\lambda}=\frac{\left(L+\eta \lambda_p\right)}{\beta_w \lambda}
\end{equation}
%
In a frame moving at $\beta c$, the quantities become
\begin{eqnarray}
\lambda_p^*&=&\lambda_p/\left[\gamma \left(1-\beta_w \beta\right)\right] \\
L^*&=&L/\gamma \\
\lambda^*&=& \gamma\left(1+\beta\right) \lambda\\
\beta_w^*&=&\left(\beta_w-\beta\right)/\left(1-\beta_w\beta\right) \\
v_p^*&=&-\beta c \\
T^*&=&\frac{L^*+\eta \lambda_p^*}{v_w^*-v_p^*} \\
R_t^*&=&\frac{T^* c}{\lambda^*} = \frac{\left(L^*+\eta \lambda_p^*\right)}{\left(\beta_w^*+\beta\right) \lambda^*}
\end{eqnarray}
where $\gamma=1/\sqrt{1-\beta^2}$.

The expected speedup from performing the simulation in a boosted frame is given by the ratio of $R_{lab}$ and $R_t^*$

\begin{equation}
S=\frac{R_{lab}}{R_t^*}=\frac{\left(1+\beta\right)\left(L+\eta \lambda_p\right)}{\left(1-\beta\beta_w\right)L+\eta \lambda_p}
\label{Eq_scaling1d0}
\end{equation}

We note that assuming that $\beta_w\approx1$ (which is a valid approximation for most practical cases of interest) and that $\gamma<<\gamma_w$, this expression is consistent with the expression derived earlier \cite{Vayprl07} for the laser-plasma acceleration case, which states that $R_t^*=\alpha R_t/\left(1+\beta\right)$ with $\alpha=\left(1-\beta+l/L\right)/\left(1+l/L\right)$, where $l$ is the laser length which is generally proportional to $\eta \lambda_p$, and $S=R_t/R_T^*$. However, higher values of $\gamma$ are of interest for maximum speedup, as shown below.

For intense lasers ($a\sim 1$) typically used for acceleration, the energy gain is limited by dephasing \cite{Schroederprl2011}, which occurs over a scale length $L_d \sim \lambda_p^3/2\lambda^2$.
Acceleration is compromised beyond $L_d$ and in practice, the plasma length is proportional to the dephasing length, i.e. $L= \xi L_d$. In most cases, $\gamma_w^2>>1$, which allows the approximations $\beta_w\approx1-\lambda^2/2\lambda_p^2$, and $L=\xi \lambda_p^3/2\lambda^2\approx \xi \gamma_w^2 \lambda_p/2>>\eta \lambda_p$, so that Eq.(\ref{Eq_scaling1d0}) becomes
%
\begin{equation}
S=\left(1+\beta\right)^2\gamma^2\frac{\xi\gamma_w^2}{\xi\gamma_w^2+\left(1+\beta\right)\gamma^2\left(\xi\beta/2+2\eta\right)}
\label{Eq_scaling1d}
\end{equation}
%
For low values of $\gamma$, i.e. when $\gamma<<\gamma_w$, Eq.(\ref{Eq_scaling1d}) reduces to
%
\begin{equation}
S_{\gamma<<\gamma_w}=\left(1+\beta\right)^2\gamma^2
\label{Eq_scaling1d_simpl2}
\end{equation}
%
Conversely, if $\gamma\rightarrow\infty$, Eq.(\ref{Eq_scaling1d}) becomes
%
\begin{equation}
S_{\gamma\rightarrow\infty}=\frac{4}{1+4\eta/\xi}\gamma_w^2
\label{Eq_scaling_gamma_inf}
\end{equation}
%
Finally, in the frame of the wake, i.e. when $\gamma=\gamma_w$, assuming that $\beta_w\approx1$, Eq.(\ref{Eq_scaling1d}) gives
%
\begin{equation}
S_{\gamma=\gamma_w}\approx\frac{2}{1+2\eta/\xi}\gamma_w^2
\label{Eq_scaling_gamma_wake}
\end{equation}
Since $\eta$ and $\xi$ are of order unity, and the practical regimes of most interest satisfy $\gamma_w^2>>1$, the speedup that is obtained by using the frame of the wake will be near the maximum obtainable value given by Eq.(\ref{Eq_scaling_gamma_inf}).

Note that without the use of a moving window, the relativistic effects that are at play in the time domain would also be at play in the spatial domain \cite{Vayprl07}, and the $\gamma^2$ scaling would transform to $\gamma^4$. Hence, it is important to use a moving window even in simulations in a Lorentz boosted frame. For very high values of the boosted frame, the optimal velocity of the moving window may vanish (i.e. no moving window) or even reverse.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Numerical Stability and alternate formulation in a Galilean frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

The numerical Cherenkov instability (NCI) \cite{Godfreyjcp74}
is the most serious numerical instability affecting multidimensional
PIC simulations of relativistic particle beams and streaming plasmas
\cite{Martinscpc10,VayAAC2010,Vayjcp2011,Spitkovsky:Icnsp2011,GodfreyJCP2013,XuJCP2013}.
It arises from coupling between possibly numerically distorted electromagnetic modes and spurious
beam modes, the latter due to the mismatch between the Lagrangian
treatment of particles and the Eulerian treatment of fields \cite{Godfreyjcp75}.

In recent papers the electromagnetic dispersion
relations for the numerical Cherenkov instability were derived and solved for both FDTD \cite{GodfreyJCP2013,GodfreyJCP2014_FDTD}
and PSATD \cite{GodfreyJCP2014_PSATD,GodfreyIEEE2014} algorithms.

Several solutions have been proposed to mitigate the NCI \cite{GodfreyJCP2014,GodfreyIEEE2014,GodfreyJCP2014_PSATD,GodfreyCPC2015,YuCPC2015,YuCPC2015-Circ}. Although
these solutions efficiently reduce the numerical instability,
they typically introduce either strong smoothing of the currents and
fields, or arbitrary numerical corrections, which are
tuned specifically against the NCI and go beyond the
natural discretization of the underlying physical equation. Therefore,
it is sometimes unclear to what extent these added corrections could impact the
physics at stake for a given resolution.

For instance, NCI-specific corrections include periodically smoothing
the electromagnetic field components \cite{Martinscpc10},
using a special time step \cite{VayAAC2010,Vayjcp2011} or
applying a wide-band smoothing of the current components \cite{VayAAC2010,Vayjcp2011,VayPOPL2011}. Another set of mitigation methods
involve scaling the deposited
currents by a carefully-designed wavenumber-dependent factor
\cite{GodfreyJCP2014_FDTD,GodfreyIEEE2014} or slightly modifying the
ratio of electric and magnetic fields ($E/B$) before gathering their
value onto the macroparticles
\cite{GodfreyJCP2014_PSATD,GodfreyCPC2015}.
Yet another set of NCI-specific corrections
\cite{YuCPC2015,YuCPC2015-Circ} consists
in combining a small timestep $\Delta t$, a sharp low-pass spatial filter,
and a spectral or high-order scheme that is tuned so as to
create a small, artificial ``bump'' in the dispersion relation
\cite{YuCPC2015}. While most mitigation methods have only been applied
to Cartesian geometry, this last
set of methods (\cite{YuCPC2015,YuCPC2015-Circ})
has the remarkable property that it can be applied
\cite{YuCPC2015-Circ} to both Cartesian geometry and
quasi-cylindrical geometry (i.e. cylindrical geometry with
azimuthal Fourier decomposition \cite{LifschitzJCP2009,DavidsonJCP2015,Lehe2016}). However,
the use of a small timestep proportionally slows down the progress of
the simulation, and the artificial ``bump'' is again an arbitrary correction
that departs from the underlying physics.

A new scheme was recently proposed, in \cite{KirchenARXIV2016,LeheARXIV2016}, which
completely eliminates the NCI for a plasma drifting at a uniform relativistic velocity
-- with no arbitrary correction -- by simply integrating
the PIC equations in \emph{Galilean coordinates} (also known as
\emph{comoving coordinates}). More precisely, in the new
method, the Maxwell equations \emph{in Galilean coordinates} are integrated
analytically, using only natural hypotheses, within the PSATD
framework (Pseudo-Spectral-Analytical-Time-Domain \cite{Habericnsp73,VayJCP2013}).

The idea of the proposed scheme is to perform a Galilean change of
coordinates, and to carry out the simulation in the new coordinates:
\begin{equation}
\label{eq:change-var}
\vec{x}' = \vec{x} - \vgal t
\end{equation}
where $\vec{x} = x\,\vec{u}_x + y\,\vec{u}_y + z\,\vec{u}_z$ and
$\vec{x}' = x'\,\vec{u}_x + y'\,\vec{u}_y + z'\,\vec{u}_z$ are the
position vectors in the standard and Galilean coordinates
respectively.

When choosing $\vgal= \vec{v}_0$, where
$\vec{v}_0$ is the speed of the bulk of the relativistic
plasma, the plasma does not move with respect to the grid in the Galilean
coordinates $\vec{x}'$ -- or, equivalently, in the standard
coordinates $\vec{x}$, the grid moves along with the plasma. The heuristic intuition behind this scheme
is that these coordinates should prevent the discrepancy between the Lagrangian and
Eulerian point of view, which gives rise to the NCI \cite{Godfreyjcp75}.

An important remark is that the Galilean change of
coordinates (\ref{eq:change-var}) is a simple translation. Thus, when used in
the context of Lorentz-boosted simulations, it does
of course preserve the relativistic dilatation of space and time which gives rise to the
characteristic computational speedup of the boosted-frame technique.

Another important remark is that the Galilean scheme is \emph{not}
equivalent to a moving window (and in fact the Galilean scheme can be
independently \emph{combined} with a moving window). Whereas in a
moving window, gridpoints are added and removed so as to effectively
translate the boundaries, in the Galilean scheme the gridpoints
\emph{themselves} are not only translated but in this case, the physical equations
are modified accordingly. Most importantly, the assumed time evolution of
the current $\vec{J}$ within one timestep is different in a standard PSATD scheme with moving
window and in a Galilean PSATD scheme \cite{LeheARXIV2016}.

In the Galilean coordinates $\vec{x}'$, the equations of particle
motion and the Maxwell equations take the form
\begin{subequations}
\begin{align}
\frac{d\vec{x}'}{dt} &= \frac{\vec{p}}{\gamma m} - \vgal \label{eq:motion1} \\
\frac{d\vec{p}}{dt} &= q \left( \vec{E} +
\frac{\vec{p}}{\gamma m} \times \vec{B} \right) \label{eq:motion2}\\
\left( \Dt{\;} - \vgal\cdot\nab\right)\vec{B} &= -\nab\times\vec{E} \label{eq:maxwell1}\\
\frac{1}{c^2}\left( \Dt{\;} - \vgal\cdot\nab\right)\vec{E} &= \nab\times\vec{B} - \mu_0\vec{J} \label{eq:maxwell2}
\end{align}
\end{subequations}
where $\nab$ denotes a spatial derivative with respect to the
Galilean coordinates $\vec{x}'$.

Integrating these equations from $t=n\Delta
t$ to $t=(n+1)\Delta t$ results in the following update equations (see
\cite{LeheARXIV2016} for the details of the derivation):
%
\begin{subequations}
\begin{align}
\fb^{n+1} &= \theta^2 C \fb^n
 -\frac{\theta^2 S}{ck}i\vec{k}\times \fe^n \nonumber \\
& + \;\frac{\theta \chi_1}{\epsilon_0c^2k^2}\;i\vec{k} \times
                     \fj^{n+1/2} \label{eq:disc-maxwell1}\\
\fe^{n+1} &=  \theta^2 C  \fe^n
 +\frac{\theta^2 S}{k} \,c i\vec{k}\times \fb^n \nonumber \\
& +\frac{i\nu \theta \chi_1 - \theta^2S}{\epsilon_0 ck} \; \fj^{n+1/2}\nonumber \\
& - \frac{1}{\epsilon_0k^2}\left(\; \chi_2\;\mc{\rho}^{n+1} -
  \theta^2\chi_3\;\mc{\rho}^{n} \;\right) i\vec{k} \label{eq:disc-maxwell2}
\end{align}
\end{subequations}
%
where we used the short-hand notations $\fe^n \equiv
%
\fe(\vec{k}, n\Delta t)$, $\fb^n \equiv
\fb(\vec{k}, n\Delta t)$ as well as:
\begin{subequations}
\begin{align}
&C = \cos(ck\Delta t) \quad S = \sin(ck\Delta t) \quad k
= |\vec{k}| \label{eq:def-C-S}\\&
\nu = \frac{\vec{k}\cdot\vgal}{ck} \quad \theta =
  e^{i\vec{k}\cdot\vgal\Delta t/2} \quad \theta^* =
  e^{-i\vec{k}\cdot\vgal\Delta t/2} \label{eq:def-nu-theta}\\&
\chi_1 =  \frac{1}{1 -\nu^2} \left( \theta^* -  C \theta + i
  \nu \theta S \right) \label{eq:def-chi1}\\&
\chi_2 = \frac{\chi_1 - \theta(1-C)}{\theta^*-\theta} \quad
\chi_3 = \frac{\chi_1-\theta^*(1-C)}{\theta^*-\theta} \label{eq:def-chi23}
\end{align}
\end{subequations}
Note that, in the limit $\vgal=\vec{0}$,
(\ref{eq:disc-maxwell1}) and (\ref{eq:disc-maxwell2}) reduce to the standard PSATD
equations \cite{Habericnsp73}, as expected.
As shown in \cite{KirchenARXIV2016,LeheARXIV2016},
the elimination of the NCI with the new Galilean integration is verified empirically via PIC simulations of uniform drifting plasmas and laser-driven plasma acceleration stages, and confirmed by a theoretical analysis of the instability.


\section{Preliminaries}
\label{sect:erssat-preliminaries}

An E-MAJSAT formula $\Qf$ has the form $\exists X,\random{} Y.\pf(X,Y)$,
where $X$ and $Y$ are two disjoint sets of Boolean variables,
and $\pf(X,Y)$ is a CNF formula.

\subsection{Solving E-MAJSAT with weighted model counting}
Given an E-MAJSAT formula $\Qf=\exists X,\random{} Y.\pf(X,Y)$ and an assignment $\as$ over $X$,
cofactoring the matrix with $\as$ results in a formula $\pcf{\pf}{\as}$ referring only to variables in $Y$.
The prefix $\random{} Y$ induces a weighting function $\wt: Y \mapsto [0,1]$ for each variable $y \in Y$,
where $\wt(y)$ equals the probability annotated on the randomized quantifier of $y$.
As a result, the conditional satisfying probability $\spb{\random{} Y.\pcf{\pf}{\as}}$,
which equals the weight of the formula $\pcf{\pf}{\as}$ under the weighting function $\wt$,
can be obtained by invoking a weighted model counter.
In the following,
the invocation to a weighted model counter is expressed by $\texttt{ComputeWeight}(\random{} Y.\pcf{\pf}{\as})$, which returns the conditional satisfying probability $\spb{\random{} Y.\pcf{\pf}{\as}}$.

\subsection{Clause selection}
\label{sect:erssat-clause-select}

\textit{Clause selection}~\cite{Janota2015,Rabe2015} is a novel technique for QBF solving.
Given a CNF formula $\pf(X,Y)$ over are two disjoint variable sets $X$ and $Y$,
we divide each clause $C\in\pf$ into two sub-clauses $\cx$ and $\cy$,
where $\cx$ (resp. $\cy$) consists of the literals whose variables are from $X$ (resp. $Y$).
For example, given a clause $C=(x_1 \lor x_2 \lor y_1 \lor y_2)$,
we have $\cx=(x_1 \lor x_2)$ and $\cy=(y_1 \lor y_2)$.
Clearly, $C=\cx\lor\cy$.

A clause $C$ is said to be \textit{selected} by an assignment $\as$ over $X$ if $\as$ falsifies every literal in $\cx$;
$C$ is said to be \textit{deselected} if $\as$ assigns some literal in $\cx$ to $\top$;
$C$ is said to be \textit{undecided} if it is neither selected nor deselected.
We also use $\pcf{\pf}{\as}$ to denote the set of clauses selected by an assignment $\as$ over $X$.

A \textit{selection variable} $\sv{C}$ is introduced for each clause $C$ and defined by $\sv{C}\equiv\lnot\cx$.
Hence, $\sv{C}$ is an indicator of the selection of clause $C$.
That is, $\sv{C}=\top$ (resp. $\sv{C}=\bot$) indicates $C$ is selected (resp. deselected).
Let $S$ be the set of selection variables for clauses in $\pf(X,Y)$.
The formula $\select(X,S)=\bigwedge\limits_{C\in\pf}(\sv{C}\equiv\lnot\cx)$ is called a \textit{selection relation} of $\pf(X,Y)$.

\begin{example}
    \label{ex:erssat-select}
    Consider a formula $\pf(X,Y)$ over two variable sets $X=\{e_1,e_2,e_3\}$ and $Y=\{r_1,r_2,r_3\}$.
    $\pf(X,Y)$ consists of four clauses:
    \begin{itemize}
        \item[] $C_1: (e_1 \lor r_1 \lor r_2)$
        \item[] $C_2: (e_1 \lor e_2 \lor r_1 \lor r_2 \lor \lnot r_3)$
        \item[] $C_3: (\lnot e_2 \lor \lnot e_3 \lor r_2 \lor \lnot r_3)$
        \item[] $C_4: (\lnot e_1 \lor e_3 \lor r_3)$
    \end{itemize}
    A set $S$ of selection variables $\{\sv{1},\sv{2},\sv{3},\sv{4}\}$ is introduced for each clause, respectively.
    The selection relation $\select(X,S)$ of $\pf(X,Y)$ equals
    \begin{align*}
        \select(X,S)=
        (\sv{1} \equiv \lnot e_1) \land
        (\sv{2} \equiv \lnot e_1 \land \lnot e_2) \land
        (\sv{3} \equiv e_2 \land e_3) \land
        (\sv{4} \equiv e_1 \land \lnot e_3).
    \end{align*}
    Consider a complete assignment $\as_1=\lnot e_1 \lnot e_2 \lnot e_3$ over $X$.
    $C_1$ and $C_2$ are selected while $C_3$ and $C_4$ are deselected,
    as can be seen from the selection relation cofactored with $\as_1$,
    which results in $\pcf{\select(X,S)}{\as_1}=s_1s_2\neg s_3 \neg s_4$.
    Consider a partial assignment $\as_2=\lnot e_1 e_3$ over $X$.
    It selects $C_1$, deselects $C_4$, and leaves $C_2$ and $C_3$ undecided.
    Notice that the two complete assignments $\lnot e_1 \lnot e_2 e_3$ and $\lnot e_1 e_2 e_3$ consistent with $\as_2$ select $\{C_1, C_2\}$ and $\{C_1, C_3\}$, respectively.
    The clause $C_1$ selected by the partial assignment $\as_2$ lies in the intersection of the sets of clauses selected by the two complete assignments consistent with $\as_2$.
\end{example}


\section{The \findiii algorithm---using a logic function}
\Label{sec:findiii}

In this section we specify linear search yet another way.
This requires more preparing work but results in a more concise function contract.

\subsection{The logic function \Find}

We start with a \emph{recursive} definition of the \acsl function \Find.
Due to the considerable number of associated lemmas of the function
\Find we split its definition into several listings.
Note that \Find comes as two \emph{overloaded} functions.
While the first version is defined for \emph{array sections} the latter is intend
for \emph{complete arrays}.

The listings start with lemmas which express elementary
properties directly related to an incremental increase of the array \inl{a[0..n-1]}.
The latter lemmas are somewhat more higher-level and will
be useful for the verification of \findiii.
It will be there that we also reuse the predicates
\logicref{SomeEqual}and
\logicref{NoneEqual}.
%
At the end of this section we will also discuss in what sense the contracts
of \findii and \findiii are equivalent.

\begin{logic}[hbt]
\begin{minipage}{0.99\textwidth}
\lstinputlisting[linerange={1-60}, style=acsl-block, frame=single]{Source/Find.acsl}
\end{minipage}
\caption{\Label{logic:Find-1}The logic function \Find (1)}
\input{Listings/Find.acsl.labels.tex}
\input{Listings/Find.acsl.index.tex}
\end{logic}

\FloatBarrier

\begin{logic}[hbt]
\begin{minipage}{0.99\textwidth}
\lstinputlisting[linerange={61-92}, style=acsl-block, frame=single]{Source/Find.acsl}
\end{minipage}
\caption{\Label{logic:Find-2}The logic function \Find (2)}
\end{logic}

\FloatBarrier

\subsection{Formal specification of \findiii}

Using the logic function \Find we can now give a third specification of linear search.
The contract of \specref{findiii} is considerably shorter than that of \specref{findii}.
Of course, we had to put much more effort into the definition of the \acsl
function \logicref{Find}.

\input{Listings/find3.h.tex}

\clearpage

\subsection{Implementation of \findiii}

The following listing shows the implementation of \implref{findiii}.
In order to achieve a complete verification we had to add the assertion \inl{found}.

\input{Listings/find3.c.tex}

A question that remains is in what sense the contract of \specref{findii} is equivalent to
the one of \specref{findiii}.
We will answer this question in the following section.

\subsection{The equivalence of \findii and \findiii}
\Label{sec:findiv}
\Label{sec:findv}

We consider the contracts of \specref{findii} and \specref{findiii} as \emph{equivalent}
if each one is sufficient to verify the other.
To this end we introduce yet another two examples \findiv and \findv.

The implementation of \implref{findiv} consists just of a call to \findiii.

\input{Listings/find4.c.tex}

\clearpage

The contract of \specref{findiv}, however, is the same as the one of \specref{findii}.

\input{Listings/find4.h.tex}

Analogously, the implementation of \implref{findv} is simply a call to \findii.

\input{Listings/find5.c.tex}

On the other hand, the contract of \specref{findv} is the same as the one of \specref{findiii}.
%
The verification of the functions \findiv and \findv
(cf.\ Table~\ref{tbl:result-nonmutating}) then shows the equivalence
of the respective contracts of \specref{findii} and \specref{findiii}.

\input{Listings/find5.h.tex}

\clearpage


\pagebreak
\chapter{Transcranial Temporal Interference Stimulation (tTIS) Theory}

To better understand the physics behind the simulations, a brief explanation regarding the conduction within the media is presented in \autoref{sec:e_ohmic_qs}, followed by an analysis regarding the \gls{tTIS} hypothesis based on Grossman et al.\cite{Grossman2017} work.

\section{Electric Field Ohmic Quasi-static Approximation}
\label{sec:e_ohmic_qs}

Generally Maxwell's equations for electromagnetic wave propagation in a medium are as follows:
% Maxwells equations
\begin{center}
\begin{minipage}{.35\linewidth}
    \begin{equation}
        \nabla\cdot\vec{E}=\dfrac{\rho}{\epsilon}
    \end{equation}
\end{minipage}
\begin{minipage}{.35\linewidth}
    \begin{equation}
        \nabla\cdot\vec{B} = 0
    \end{equation}
\end{minipage}\break
\begin{minipage}{.35\linewidth}
    \begin{equation}
        \label{eq:maxwell_curl_e}
        \nabla\times\vec{E}=-\dfrac{\partial\vec{B}}{\partial t}
    \end{equation}
\end{minipage}
\begin{minipage}{.35\linewidth}
    \begin{equation}
        \nabla\times\vec{B} = \mu\Bigg(\vec{J} + \epsilon\dfrac{\partial\vec{E}}{\partial t}\Bigg)
    \end{equation}
\end{minipage}
\end{center}

\noindent The problem in question, finding the electrical field distribution in a volume using low frequencies, can be approached by simplifying the general form of Maxwell's equations and deriving the Quasi-static approximation format. The first step is to define the assumptions taken in order for such an approach to be valid.

For the frequencies used in the studied problem, in \si{kHz} range, the displacement current can be neglected making the Ohmic currents dominate. Also, since the magnetic field is not time variant, based on \autoref{eq:maxwell_curl_e} we can write:
\begin{equation}
    \label{eq:curl_zero_e_field}
    \nabla\times\vec{E} = \vec{0}
\end{equation}
and as we know when a field is irrotational then it can be calculated from a scalar potential ($\phi$) as seen below:
\begin{equation}
    \label{eq:e_field_from_potential}
    \boxed{\vec{E} = -\nabla\phi}
\end{equation}

\noindent Moreover, since the sum of currents entering and exiting the volume is zero \textit{(Kirchhoff's second law)} we can denote:
\begin{equation}
    \nabla\cdot\vec{J} = 0
\end{equation}
where here $\vec{J}$ is the ohmic current seen below as it is assumed that there are no current sources in the volume:
\begin{equation}
    \label{eq:sigma_e_0}
    \vec{J} = \sigma\vec{E}\Rightarrow\boxed{\nabla\cdot\big(\sigma\vec{E}\big) = 0}
\end{equation}
with $\sigma$ being the electrical conductivity of each medium. Finally, based on \cref{eq:e_field_from_potential,eq:sigma_e_0} the final relationship describing the problem can be derived:
\begin{equation}
    \label{eq:laplace_e}
    \boxed{\nabla\cdot(\sigma\nabla\phi) = 0}
\end{equation}

\autoref{eq:laplace_e} describes the problem of conduction, using bulk conductors, but it is worth noting that the equation is only valid in the frequency domain where the displacement current effects are negligible and only when there is no charge generated \textit{(charge is conserved)}. Furthermore, care shall be taken with the conductivity values, since depending on the material it may be dependant on the frequency used for the stimulation.

\pagebreak
\section{Temporal Interference}
The utilization of \gls{tTIS} to achieve targeted \gls{DBS} was first introduced by Grossman et al.\cite{Grossman2017}. This technique takes advantage of the spatial electromagnetic wave interference, using frequencies at the \si{kHz} range, having almost no effect on neurons since it is known that they do not respond to higher than 1\si{kHz} \draft{(citation needed)} frequencies.
\\\vspace{1pt}

\begin{wrapfigure}{r}{0.48\textwidth}
    \vspace{-10pt}
    \centering
    \includegraphics[width = 0.44\textwidth]{assets/images/brain_figure_ttis.pdf}
    \caption[Depiction of the \gls{tTIS} pattern and the vector direction of the electric field. The purple area is the \gls{ROI} where interference happens.]{Depiction of the \gls{tTIS} pattern and the vector direction of the electric field. The purple area is the \gls{ROI} where interference happens. Image by \href{https://pixabay.com/users/openclipart-vectors-30363/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=150935}{OpenClipart-Vectors} from \href{https://pixabay.com/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=150935}{Pixabay}}
    \label{fig:brain_elec_demo}
\end{wrapfigure}

Using two pairs of electrodes (\autoref{fig:brain_elec_demo}), with each pair having a slightly different frequency, an interference pattern can be generated in the conducting medium oscillating at the difference of the two frequencies. Depending on the nature of the medium the pattern can vary and as illustrated in Grossman et al.\cite{Grossman2017} when a uniform medium is used, it is simple and easy to calculate.

Since the modulation happens in the 3D space, there will be different patterns in the $x$, $y$ and $z$ directions. According to Grossman et al.\cite[page 20]{Grossman2017}, at any location $\vec{r} = (x,y,z)$ the envelope amplitude of the \gls{AM} of the electric field produced by the temporal interference, it is calculated as:
\begin{equation}
    \label{eq:directional_amplitude}
    \vec{E}(\vec{n},\vec{r}) = \Big|\big|(\vec{E_1} + \vec{E_2})\cdot\vec{n}\big| - \big|(\vec{E_1} - \vec{E_2})\cdot\vec{n}\big|\Big|
\end{equation}
where $\vec{E_1} = \vec{E_1}(\vec{r})$, $\vec{E_2} = \vec{E_2}(\vec{r})$ are the electric fields coming from the two electrodes and $\vec{n} = \vec{n}(\vec{r})$ is the unit vector at the direction of interest.
\\\vspace{1pt}

What is of interest is the maximum amplitude of modulation at a specific location since the modulation will vary with time between zero and maximum. To calculate that amplitude across all directions, the analysis on Grossman et al.\cite[page 20]{Grossman2017} can be better supported by the analysis done on Rampersad et al.\cite[section 2.5]{Rampersad2019} and based on the two aforementioned publications, a complete description will be given here. The formula to calculate the maximum modulation amplitude, along all directions at a specific location, $\vec{r} = (x,y,z)$, is:
\begin{equation}
    \label{eq:max_mod_amplitude}
    \vec{E}_{AM}^{max}(\vec{r}) = \begin{cases}
        2\big|\vec{E_2}\big| & \text{if}\; \big|\vec{E_2}\big| < \big|\vec{E_1}\big|\cos\alpha \\
        &\\
      2\dfrac{\Big|\big|\vec{E_2}\big|\times\big(\vec{E_1} - \vec{E_2}\big)\Big|}{\big|\vec{E_1} - \vec{E_2}\big|} & \text{otherwise}
    \end{cases}
\end{equation}
where $\alpha$ is the angle between $\vec{E_1}$ and $\vec{E_2}$, while \autoref{eq:max_mod_amplitude} holds true only if $\alpha < 90\si{\degree}$. Whenever $\alpha \geq 90\si{\degree}$, the sign of one of the two fields can be flipped \textit{(it must be done is a consistent fashion)} since reaching peak field strength at different time points across different areas, is what makes the $< 90\si{\degree}$ rule to be violated. Such a change is possible considering that \autoref{eq:max_mod_amplitude} calculates the maximum effect over one oscillation, so the overall effect is the one that we care. The calculation of $\vec{E}_{AM}^{max}$ can be seen in \autoref{alg:max_modulation_amplitude} at \autoref{appndx:algorithms}.


\chapter{Method}
\label{chap:method}

The Serpent 2 Monte Carlo code uses a combination of  ray tracing and
delta-tracking to simulate the propagation of particles. The \gls{wdt}
method modifies delta-tracking for an absorbing medium, replacing virtual
collisions with a weight reduction. In this chapter, we will discuss
the \gls{wdt} routine for absorption events, and extend the method to
include scattering. We will then define the \gls{wdt} threshold, a key
parameter for its implementation in Serpent 2.

\section{\Acrlong{wdt}}
\label{sec:wdt}

Morgan and Kotlyar~\cite{morgan2015} introduced a method to improve the
inefficiencies of Woodcock delta-tracking in the presence of large
absorbers. The method, \gls{wdt}, replaces the
rejection sampling algorithm of delta-tracking with a weight reduction
algorithm. This process is similar to survival biasing, or implicit capture.

\subsection{Implicit Statistical Events}
\label{sec:implicit}

We consider a process that can result in multiple outcomes, each with
their own probability. One approach is to sample a random variable and
determine which outcome actually occurred. If the event occurs many
times, we can instead replace the
statistical process by using the expected value of the random process
\cite{lux1991}. The expected value of a random variable $x$ that can
take values ${x_1 \ldots x_n}$ with  probabilities ${p_1 \ldots p_n}$, respectively,
is given by:
\begin{equation}
  \label{eq:expval}
  E[x] = x_1p_1 + x_2p_2 \ldots + x_{n}p_n\:.
\end{equation}
For example, imagine we have a bag with four coins, three worth \$0.25 and
one worth \$0.10. The values and their probabilities are:
\begin{align*}
  x_1 = 0.25, \quad p_1 = \frac{3}{4} = 0.75 \:;\\
  x_2 = 0.10, \quad p_2 = \frac{1}{4} = 0.25\:.
\end{align*}
For a given draw, we could sample a random value and use the
probabilities $p_1$ and $p_2$ to determine the coin drawn. Or, we can
describe the expected value of the drawn coin:
\begin{align*}
  E[x] &= x_1p_1 + x_2p_2 \\
  &= (0.25 \times 0.75) + (0.10 \times 0.25) \\
  &= 0.2125
\end{align*}
\begin{minipage}{1.0\linewidth}
  This value represents the average value of a coin drawn, if we
  perform many draws. The following Matlab code replicates this
  procedure:
\begin{lstlisting}
v = 0;
n = 1000;
for i = 1:n
    xi = rand;
    v = v + (xi < 0.25)*0.1 + (xi >= 0.25)*0.25;
end
\end{lstlisting}
\end{minipage}
% will the campus get picky about the margins? Can you indent this?
% Removed the line numbers, they were extraneous anyway -jsr
Although the exact values will vary due to the small sample size, \verb|v/n|
$\approx 0.2125$, as we expected.

This framework is often applied to neutron propagation in a process
called ``survival biasing'' \cite{lewis1993}. At each collision location, the type of
interaction is sampled and the appropriate action taken. In the case
of a capture event, the neutron is ``killed'' (removed from the
simulation). While this accurately reflects the physical reality, it
does not produce good statistics. Assuming we are using a collision
estimator, the neutron's contribution to our simulation is the history
of collisions. Each of these provide a score to that particular
collision, contributing to the overall simulation
statistics. Capture events that kill neutrons, therefore, are
removing the very particles we need to generate better statistics,
resulting in the need for many more particles. Mitigating this issue
is the goal of survival biasing.

Survival biasing avoids killing neutrons by replacing capture
events with an expected outcome. As described above, we do not need to
track the outcome of every single event, but can rely on the expected
value. This will give us, on average, the outcome of our many
events. To eliminate our explicit consideration of capture events,
we therefore have two possible event types: capture events, and
scattering events. The probabilities $p$ will be given by the
ratios of the cross-sections:
\begin{align*}
  p_{c} = \frac{\Sigma_{c}}{\Sigma_t} \:,\\
  p_{s} = \frac{\Sigma_{s}}{\Sigma_t}\:,
\end{align*}
where $\Sigma_{c}$ and $\Sigma_{s}$ are the macroscopic cross-sections
for capture and scattering, respectively.

In the coin example, each had a different monetary value, giving us an
expected value when we drew many times. We must introduce something
similar for neutrons. It is convention to call this intrinsic value
``weight'', which represents the importance of the neutron. All
neutrons are born with the same weight, usually unity, and are killed
when they have zero weight. At each point of interaction, the incoming
neutron has an initial weight based on the neutron's history $w_i$,
and a final weight $w_f$ that depends on the type of interaction. A
capture event that kills a neutron immediately forces the final weight
of the neutron to zero $w_{f,c} = 0$. We can then
calculate the expected value of the interaction of a neutron with
initial weight $w_i$:
% what is w_{f}? is it final and w_{i} is initial, wrt the specific interaction?
% you can probably shorten scattering to s and capture to c
\begin{align*}
  E[w_f] &= w_{f,s}p_\mathrm{s} +
           w_{f,c}p_\mathrm{c} \\
  &= w_{f,s}p_\mathrm{s}
\end{align*}
A scattering event merely changes the location of the neutron in
energy and angle phase space, leaving its importance
unchanged. Therefore, $w_{f,s} = w_i$ and:
\begin{align*}
  E[w_f] = w_ip_s\:.
\end{align*}
With implicit capture
% what is the now? with implicit capture? Yes -jsr
every collision is considered to be a non-capture event. The
neutron continues with a lower weight, proportional to the probability
that the event was scattering. The weight lost in the collision is
scored as capture:
\begin{align*}
  S_c &= E[w_i - w_f] \\
  &= E[w_i] - E[w_f] \\
&= w_i - w_ip_{s} \\
&= w_i(1-p_{s})\:,
\end{align*}
where $S_c$ is the score for capture. A similar method will be used
by weighted delta-tracking.
%S = socre? Yes -jsr

\subsection{Russian Rouletting}
\label{sec:rouletting}

When the survival biasing routine described in Sec.~\ref{sec:implicit}
is used, the loss of neutrons is entirely reliant on leakage from the
problem or fission events. Neutrons will continue to undergo
collisions and subsequent weight reduction until they have a very low
weight. These particles will only contribute small amounts to our
statistics, so tracking them is computationally inefficient.  To
mitigate this, a lower cutoff for the weight is introduced. Once
neutrons are below this weight, they have a chance of being killed by
a Russian Rouletting routine.
\begin{algorithm}
\caption{Rouletting Routine}\label{alg:roulette}
\begin{algorithmic}[1]
\If{weight $<$ weight threshold}
   \State $\xi \gets $ random number $\in [0,1)$
   \If{$\xi < $ roulette probability}
     \State Kill particle
   \Else
     \State $w_f \gets w_i$/(roulette probability) \label{inc}
   \EndIf
\EndIf
\end{algorithmic}
\end{algorithm}

The general algorithm is shown in
Algorithm~\ref{alg:roulette}. Following a collision, if the weight of the colliding particle is
below a defined weight threshold, a random number is sampled. If this
number is below a defined rouletting probability, the particle is
killed. If the particle survives rouletting, its weight is increased
proportionaly to the rouletting probability. By either killing low weight
particles or increasing their weight, the inefficiency of tracking
low-weight particles can be reduced.

\subsection{\Acrlong{wdt}}
\label{sec:wdttheory}

Morgan and Kotlyar~\cite{morgan2015} introduced a method to improve
the inefficiencies of Woodcock delta-tracking in the presence of large
absorbers. The method, \gls{wdt}, replaces the rejection sampling of
delta-tracking with a weight reduction. This is similar to the process
of implicit capture discussed in Section~\ref{sec:implicit}.

The \gls{wdt} method samples the particle path length in the same fashion as
Woodcock delta-tracking. As described in Section~\ref{sec:delta-tracking},
after each path length is sampled, the delta-tracking method accepts the
collision as real with the probability shown in
Eq.~\ref{eq:preal}. The \gls{wdt} method bypasses this rejection sampling by
accepting all collisions as real with a subsequent reduction in
weight. As discussed in Section~\ref{sec:implicit}, replacing a
statistical event requires calculation of the expectated value. In
this case, the two events are a real collision and a virtual
collision:
\begin{equation}
  \label{eq:wdtexpected}
  E[w_f] = w_{f,\mathrm{real}}P_{\mathrm{real}} + w_{f,\mathrm{virt}}P_{\mathrm{virt}}\:.
\end{equation}
Morgan and Kotlyar examine a 1D test case with absorption. As an
absorption event removes the particle, the resulting final weight of a
real collision is zero. A virtual collision is rejected, and therefore
leaves the weight unchanged. Inserting the appropriate values into
Eq.~\eqref{eq:wdtexpected} gives the expected value of the final
weight for an absorption event:
\begin{align*}
  \label{eq:mkexpected}
  E[w_f] &= w_{f,\mathrm{real}}P_{\mathrm{real}} +
           w_{f,\mathrm{virt}}P_{\mathrm{virt}} \\
  &= 0 + w_iP_{\mathrm{virt}} \\
  &= w_i(1-P_\mathrm{real}) \\
  &= w_i\left(1-\frac{\Sigma_t}{\Sigma_\mathrm{maj}}\right)\:.
\end{align*}
The particle that is left following the collision continues propagating
as if it underwent a virtual collision. In this case, the absorption
is then scored using the expectation value of the score.
\begin{align*}
  S_\mathrm{absorption} &= E[w_i - w_f] \\
  &= E[w_i] - E[w_f] \\
  &= w_i\left(\frac{\Sigma_t}{\Sigma_\mathrm{maj}}\right)
\end{align*}
This algorithm is implemented by Kotlyar and Morgan in a 1D problem and the
results are verified with an analytical solution. The authors point
out that a rouletting routine should be implemented when \gls{wdt} is used,
to prevent the tracking of low-weight neutrons.

\section{\Acrlong{wdt} with scattering}
\label{sec:wdt_scattering}

In a scattering event, the weight of the incident particle does not
change. Therefore, application of the expectation value as in
Section~\ref{sec:wdttheory} results in an expected value of the final
weight equal to the initial weight:
\begin{align*}
  E[w_f] &= w_{f,\mathrm{real}}P_{\mathrm{real}} +
           w_{f,\mathrm{virt}}P_{\mathrm{virt}} \\
  &= w_iP_\mathrm{real} + w_iP_{\mathrm{virt}} \\
  &= w_i(P_\mathrm{real} + 1 -P_\mathrm{real}) \\
  &= w_i\:.
\end{align*}

This doesn't model what we expect. We can view \gls{wdt} as splitting
the weighted neutron into two particles. One carries the real portion
of the weight and experiences the collision. The other carries the
virtual portion of the weight and continues propagating as if no
collision occurred. This works fine for absorption, where the portion
that experiences the collision does not propagate: it is immediately
killed and scored. But, when the neutron is split into a scattering
portion and a virtual portion, no weight is lost because neither of
those events change the weight.

Therefore, extension of this methodology to scattering requires duplication of
the particle at the point of collsion. The virtual portion of the
weight is carried away by a particle that propagates as if no
collision has occured, and the real portion is carried away by a
particle that undergoes scattering. In problems with scattering, this
results in a rapid multiplication of neutrons. When implemented into
Serpent 2, this multiplication very quickly filled any available
neutron buffer in simulations of a \gls{bwr}, ending
the simulation. We therefore expanded the \gls{wdt} method with a
novel approach to handling scattering. This approach combines the
\gls{wdt} methodology with the standard delta-tracking rejection
sampling in a way that has not been done before.

% Add a sentence or two in here (or a quick additional paragraph) pointing out that this
% is new: no one has done this before. It's good to explicitly call attention to your
% contribution so that readers are clear what's new and what was your intellectual contribution.

\subsection{Scattering Rejection Sampling}
\label{sec:scattering}

As described in the last section, the \gls{wdt} method may result in
an intractable simulation when applied to scattering.
This occurred because the \gls{wdt} method splits the incoming weight
in two: one portion for a real collision, one portion for a virtual
collision. We developed a new methodology that avoids splitting the
neutron when scattering, while keeping the splitting otherwise. To
accomplish this, the original delta-tracking rejection sampling was
moved into the scattering subroutine. The algorithm is shown in
Alg.~\ref{alg:scattalg} and a flow chart of the routine is shown in
Fig.~\ref{fig:wdt}.

\begin{figure}[p]
\begin{algorithm}[H]
\caption{\Acrlong{wdt} with scattering}\label{alg:scattalg}
\begin{algorithmic}[1]
  \State \textbf{Sample} path length
  \State \textbf{Sample} collision type
  \If{collision type == (capture or fission)}
    \State \textbf{Score} capture or fission $\gets
    w_iP_\mathrm{real}$
    \State \textbf{Score} collision  $\gets w_iP_\mathrm{real}$
    \State $w_f \gets w_i(1-P_\mathrm{real})$
    \State \textbf{Execute} virtual collision
  \Else
    \State \textbf{Sample} random number $\xi \in [0,1)$
    \If{$\xi < P_\mathrm{real}$} \Comment{Collision is real}
    \State \textbf{Score} scattering $\gets w_i$
    \State \textbf{Score} collision $\gets w_i$
      \State \textbf{Execute} scattering collision
    \Else \Comment{Collision is virtual}
    \State \textbf{Execute} virtual collision
    \EndIf
  \EndIf
\end{algorithmic}
\end{algorithm}
  \centering
  \includegraphics[scale=0.5]{images/wdt}
  \caption{\Acrlong{wdt} with scattering rejection sampling.\label{fig:wdt}}
\end{figure}
Note that there are two separate scoring events in each collision
subroutine: scoring of the actual collision type for calculating
specific reaction rates, and scoring of collision itself used by the
collision flux estimator. In addition, scoring the fission reaction
also encompasses generation of fission neutrons.

In the original delta-tracking routine, the rejection sampling takes
place prior to collision type sampling, and collision scoring can
occur between the two. This is the routine that Serpent 2 used, prior
to modification for the above scheme. By moving the rejection sampling
after the collision type sampling, the collision score is no longer
agnostic to the type of collision that will occur. Therefore, in the
implementation of this routine in Serpent 2, the collision scoring was
moved after the collision type sampling.

\section{Implementation in Serpent 2}
\label{sec:method_implementation}

The \gls{wdt} algorithm is implemented to work alongside the current
implementation of ray tracing and delta-tracking, as described in
Sec.~\ref{sec:serpent2}. \gls{wdt} is designed to improve the
effectiveness of delta-tracking when the change of a virtual collision
is high. We can hypothesize that the algorithm will benefit in the
regime where $P_{\mathrm{real}}$ is low. At high values of
$P_{\mathrm{real}}$, a majority of the weight of the incoming particle
is scored. This leaves the particle that undergoes a virtual collision
with a very low weight, relying on the rouletting routine to prevent
computational inefficiency. These two situations imply that
there is a region between low and high values of $P_\mathrm{real}$
where \gls{wdt} may provide benefit.

This region is defined by two values, summarized in
Fig.~\ref{fig:ray_wdt}. On the lower end, the value of $(1-c)$ defines
the threshold below which surface tracking is used. On the upper end,
a new parameter $t_{\mathrm{wdt}}$ defines the threshold below which
\gls{wdt} will be used instead of normal delta-tracking. This provides
the user with the ability to exactly define the region where \gls{wdt}
will be used.
\begin{figure}[hbtp]
  \centering
  \begin{align*}
    \mathrm{Mode} =
    \begin{cases}
      \mathrm{Ray tracing}, & P_\mathrm{real} < 1-c \\
      \mathrm{\gls{wdt}}, & 1-c \leq P_\mathrm{real} < t_{\mathrm{wdt}}
      \\
      \mathrm{Delta-tracking}, & P_\mathrm{real} \geq t_{\mathrm{wdt}}
    \end{cases}
  \end{align*}
  \begin{tikzpicture}[scale=1.5]
    \draw[thick] (0,0) -- (10.0,0);
    \foreach \x in {0,1,...,10}
    {
      \draw (\x, 0.1) -- (\x, -0.1);
      \pgfmathsetmacro\result{\x * 0.1}
      \node [below] at (\x, -0.2) {\small $\pgfmathprintnumber{\result}$};
    }
    \node [left] at (0,0) {$P_{\mathrm{real}}$};
    \draw[ thick, <->] (0,0.2) -- (1,0.2);
    \draw[ thick, <->] (1,0.2) -- (4,0.2);
    \draw[ thick, <->] (4,0.2) -- (10,0.2);
    \node [above] at (0.5, 0.2) {Ray tracing};
    \node [above] at (2.5, 0.2) {WDT};
    \node [above] at (7, 0.2) {Delta-tracking};
  \end{tikzpicture}
  \caption[Implemented selection scheme for ray-tracing, weighted and normal
    delta-tracking.]{Implemented selection scheme for ray-tracing, weighted, and normal
    delta-tracking. Shown using the values of $(1-c)=0.1$ and $t_{\mathrm{wdt}}=0.4$.}
  \label{fig:ray_wdt}
\end{figure}
% this makes sense; I still think you can get rid of the previous figure.

%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../masters_report"
%%% End:


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage[letterpaper, total={7.5in, 9in}]{geometry}

\title{Stochastic Processes}
\author{Grant Smith }
\date{Spring 2022}

\begin{document}

\maketitle

\section{Primer on Random Variables and Conditional Random Variables}

In this section, I want to give two views on conditional probabilities and show how they coincide. The first view is very early in a probability textbook:

$$P(A|B) = \frac{P(A \cap  B)}{P(B)}$$

Also please note that it might appear that $P(A|B)$ is proportional to $P(A)$ perhaps by a proportionality factor such as $1/P(B)$, but that is not true because $P(A)$ is not proportional to $P(A \cap  B)$.  They are truly different distrubutions.  Thus, $P(A|B)$ is totally different from $P(A)$, because $P(A \cap  B)$ is totally different from $P(A)$, which is the crutial insight.  The only situation in which they would be similar would be if $A$ and $B$ are independent, at which point the scaling intuition would be true.

Next, I want to explain how if two random variables ($X_1$ and $X_2$) are defined on the same event space, observing one random variable, say $X_1$, filters your event space into a smaller event space, and now there is a new random variable that is $X_2$ restricted to that smaller event space. Let's call the value we observe $x_1$.  The new, restricted, event space is $X_1^{-1}(x_1)$, which means it is the inverse image of $x_1$ under the random variable (aka function) $X_1$.  Our notation for this is $X_2 | X_1 = x_1$. Also note that the probability measure defined on the original event space is now modified to a new measure which depends on the observed value of $X_1$.  This measure (of course) adds up to 1, and those elements in the event space previously added up to less than or equal to 1, so in general they get bigger, but the probability of each element does not necessarily increase.  Also, they are not scaled linearly or anything like that -- we do not know how they change until we know the two random variables.

\section{Stochastic Process Introduction}

I want to develop a little intuition between how we think about stochastic processes, for example, the stock market, and how they're defined in a probability book.  First of all, here is a picture:

\includegraphics[width=4in]{stochastic_ image.png}
\centering

We have a sample space, $\Omega$, and from that sample space, we map to functions of time (or anything else you want).  We call it a stochastic process, but all it is is a function from a sample space to a space of functions.  The notation is $X_t$, but what's under the hood is the following:

$$X_t = x : \Omega \rightarrow \left(\mathbb{R}^+ \rightarrow  \mathbb{R} \right)$$

But we don't really perceive that sample space.  What we perceive (for example when observing the stock market) is that we've observed a process up to a certain time, and we don't know what's going to happen next.  How does that fit into the framework above? Let's start with a picture of a stochastic process.  Here it is, and ignore the 3.5 for now. We'll use it in about two paragraphs.

\includegraphics[width=4in]{filtration_part_1.png}
\centering

Let's say this is a stock price over time, and we'll call it $X_t$.  The picture on the right is all the possible trajectories, and the sample space on the left has a corresponding event for each trajectory (I didn't count, so the dots and the trajectories probably don't align, but that's okay).

At our initial time, we have no idea which of these trajectories the stock will take.  But then let's wait a little bit (wait until time 3.5) and observe the price.  Let's say the trajectory we observe is the following:

\includegraphics[width=2.2in]{filtration_part_2.png}
\centering

So now we have information about which of the original trajectories are still possible, and which ones are impossible. This is called a filtration, and in our case, we have the filtration at time 3.5, so we will call it$\mathcal{F}_{3.5}$, but in general, it would be $\mathcal{F}_{t}$.

So now we want to figure out what happens to our stochastic process $X_t$ given the information (aka filtration) we know at time 3.5. What the filtration does is filter out all the trajectories that cannot be the case, and it leaves in all the remaining possible trajectories.  The picture is:

\includegraphics[width=4in]{filtration_part_3.png}
\centering

You'll notice that the trajectories that don't align with our filtration are gray, and the events in the sample space that correspond to those trajectories are also gray.  And the trajectories that are possible are still black, and their corresponding events are also still black.

This should feel like a conditional probability, and that's exactly what's happening. We want $Y_t := X_t | \mathcal{F}_{3.5}$.  Thus, $Y_t$ is given by the following drawing:

\includegraphics[width=4in]{filtration_part_4.png}
\centering

At this point, we've really explained a lot.  One last part you might be wondering is what would happen if we changed the 3.5.  And you'd be right. So our $Y_t$ is dependent upon our observation duration. So I'll ammend our notation to be $X_t(s) := X_t | \mathcal{F}_{s}$, which means that the stochastic process we get (a.k.a. remaining trajectories) depends on how long we observe.  So we could say that $Y_t = X_t(3.5)$.  So let's draw another picture for another time, say 4.5. We will start with what we've observed by time = 4.5:

\includegraphics[width=2.2in]{filtration_4.5.png}
\centering

And now we can gray out from the picture of $X_t(3.5)$:

\includegraphics[width=3.2in]{Filtration_grayed_4.5.png}
\centering

And it is hard to see, but one of the elements in the sample space is also grayed out. Which leaves us with our final image of $X_t(4.5)$:

\includegraphics[width=3.2in]{final_4.5.png}
\centering

And this time, it's very clear that I miscounted, and there should only be four elements in the sample space corresponding to the four possible trajectories.

Grant, a note to you, you wanted to write about what $X_t(s)$ looks like???

Lastly, I'm working on making a GeoGebra activity to illustrate this. When it's up, I'll update the link, but here is my account for now: https://www.geogebra.org/u/gsmithapples.

\section{Differentiation and Integration}
Here is the best way I know to think about stochastic differentiation and integration. We'll redraw our picture, and its equation and notation are given below.

\includegraphics[width=4in]{stochastic_ image.png}
\centering

$$X_t = x : \Omega \rightarrow \left(\mathbb{R}^+ \rightarrow  \mathbb{R} \right)$$
$$x(\varsigma_1) = f_1(t)$$
$$x(\varsigma_2) = f_2(t)$$
$$x(\varsigma) = f_\varsigma(t)$$

And note that $x$ is simply a deterministic function.  Also note that we can partially apply and curry however we want, so we also have the following, which will be useful in the following section:

$$X_t = x : \Omega \rightarrow \left(\mathbb{R}^+ \rightarrow  \mathbb{R} \right) = \Omega \rightarrow \mathbb{R}^+ \rightarrow  \mathbb{R} = x :  \left(\Omega  , \mathbb{R}^+\right)\rightarrow  \mathbb{R}$$

\subsection{Differentiation}
We have that:

$$X_t' = \frac{\partial}{\partial t}x(\varsigma,t)= \frac{x\left(\varsigma, t + h\right) - x\left(\varsigma, t\right)}{h} = \frac{f_\varsigma\left(t + h\right) - f_\varsigma\left(t\right)}{h} = \frac{df_\varsigma}{dt} =g\left(\varsigma, t\right)$$

Which means that $X_t'$ is just the probability weighted derivatives of the trajectories. Which, just like $x$, is just a deterministiic function of $\varsigma$ and $t$

Side note that this does not work in Brownian Motion because the individual trajectories in Brownian Motion are not differentiable (anywhere).  I think we might be able to do it with some form of a weak derivative, though, just not the regular one.

Also note that we are using the prime notation for a derivative, but it is a partial derivative. That's okay because $\Omega$ isn't necessarily a continuous variable like $t$ is, so when we're differentiating, it is understood that we're differentiating with respect to the only reasonable option, $t$.

\subsection{Integration}
We have that:
$$\int X_t= \int_{s = 0}^{s = t} X_s ds = \int_{s = 0}^{s = t} x\left(\varsigma,s\right) ds = \int_{s = 0}^{s = t} f_\varsigma\left(s\right) ds  = h\left(\varsigma,t\right)$$

Which means that $\int X_t$ is just the probability weighted integrals of the trajectories.  Which, just like $x$ and $g$, is just a deterministic function of $\varsigma$ and $t$

I think we can do this with Brownian Motion because even though Brownian Motion trajectories are not (in the normal sense) differentiable, they are integrable.

\subsection{Differentiation and Integration Example}
Suppose there are only two states of the world, Heads and Tails.  And if Heads is flipped, our world is $x^2 + 2$ and if Tails is flipped, we get $1$.  Our process is:

\includegraphics[width=3in]{ExampleProcess.png}
\centering

\[X_t = \begin{cases}
    t^2 + 2 & H \\
    1 & T
 \end{cases}
\]

Then we also know:

\[\int X_t = \begin{cases}
    \frac{1}{3}t^3 + 2t + C_1 & H \\
    t + C_2 & T
 \end{cases}
\]
\[X_t = \begin{cases}
    t^2 + 2 & H \\
    1 & T
 \end{cases}
\]
\[X'_t = \begin{cases}
    2t & H \\
    0 & T
 \end{cases}
\]

And those integration constants are deterministic (i.e. they are just numbers).

\section{Ito Processes}

\subsection{Intro}

If you have a stochastic process that can be written \textbf{\emph{as a function of}} Ito processes, a.k.a. it can be written \textbf{\emph{in terms of}} Ito processes, then you can write it \textbf{\emph{as}} an Ito Process. And that's what Ito's formula tells us how to do.  This is the equation of an Ito process:

$$Z_t = Z_0 + \int_{0}^{t} u_s ds + \int_{0}^{t} \sigma_s dW_t$$

So if we have a stochastic process given to us in terms of an Ito process like above, then we can write it as above. Mathematically, that means we have a process $Z_t = f(t,X_t)$ where $X_t$ is an Ito process, and we will show that this new stochastic process is itself an Ito process, and we will be able to explicitly state its formula.  This is done with Ito's formula:

$$Z_t = f(t,X_t) = a + \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) + \mu_s \frac{\partial f}{\partial x}(s,X_s) + \frac{1}{2}{\sigma _s}^2\frac{\partial^2 f}{{\partial x}^2}(s,X_s)  ds + \int_{s=0}^{s=t}\sigma_s\frac{\partial f}{\partial x}(s,X_s) dW_s   $$

Which, you will notice, is in the form of an Ito process, which is the goal.  It helps us transform an arbitrary process written in terms of an Ito process ($Z_t$ or $f(t,X_t)$) into an explicitly stated Ito process.

\subsection{Derivation}

Let's try to approximate $f$ with a Taylor Series.  The statement is the following (and accompanied with the same thing with explicit dependencies):

$$\Delta f = \frac{df}{dt} * \Delta t$$
$$\Delta f(t, \Delta t) = \frac{df}{dt}(t) * \Delta t$$

Where $\Delta f$ is the name of a function, and it now depends on two things: $x$ and $\Delta t$.  What about an approximation with a second order term?  In one dimension, we could have:

$$\Delta f = \frac{df}{dt} * \Delta t + \frac{1}{2} \frac{d^2f}{dt^2} \Delta t ^2$$

And in two dimensions, we would have:

$$\Delta f = \frac{\partial f}{\partial t} \Delta t + \frac{\partial f}{\partial x} \Delta x + \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2} {\Delta t}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2} {\Delta x}^2 +  \frac{\partial^2 f}{\partial t \partial x} \Delta t\Delta x$$

And with dependencies stated explicitly:

$$\Delta f(t,x,\Delta t,\Delta x) = \frac{\partial f}{\partial t}(t,x) \Delta t + \frac{\partial f}{\partial x}(t,x) \Delta x  + \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t,x) {\Delta t}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t,x) {\Delta x}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t,x) \Delta t\Delta x$$

Or if we wanted to write it a little differently, instead of using $\Delta$ notation on $t, x$, we could write them at times 1 and 2:

$$\Delta f(t_1,t_2,x_1,x_2) = \frac{\partial f}{\partial t}(t_1,x_1) *[t_2-x_1] + \frac{\partial f}{\partial x}(t_1,x_1) *[x_2-x_1]  + ... $$

$$... +  \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t_1,x_1) * {[t_2-t_1]}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial x}^2}(t_1,x_1) * {[x_2-x_1]}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t_1,x_1) *[t_2-t_1]*[x_2-x_1]$$

What is the benefit of this different notation instead of the deltas? The benefit is that now it's obvious that when you replace the $t$s or $x$s, you replace the first and second, i.e. you replace the value and the $d$, rather than just the value.

Now I'm just going to plug in the stochastic $X_t$ for $x$

$$\Delta f(t_1,t_2,X_1,X_2) = \frac{\partial f}{\partial t}(t_1,X_1) *[t_2-t_1] + \frac{\partial f}{\partial x}(t_1,X_1) *[X_2-X_1]  + ... $$

$$... +  \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t_1,X_1) * {[t_2-t_1]}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial x}^2}(t_1,X_1) * {[X_2-X_1]}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t_1,X_1) *[t_2-t_1]*[X_2-X_1]$$

Here we notice that $X_t$ is also a function of t. So our Taylor series and chain rule can be a little different.  In particular, if we let $\Delta t$ go very small, there might be some behavior in $X_t$ that could help us. What if $f$ is a function of $t$ and $x$, but $X_t$ is also a function of $t$? I think that's what's going on in our problem.  So we have:

$$\Delta f(t_1,t_2,X_{t_1},X_{t_2}) = \frac{\partial f}{\partial t}(t_1,X_{t_1}) *[t_2-t_1] + \frac{\partial f}{\partial x}(t_1,X_{t_1}) *[X_{t_2}-X_{t_1}]  + ... $$

$$... +  \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t_1,X_{t_1}) * {[t_2-t_1]}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial x}^2}(t_1,X_{t_1}) * {[X_{t_2}-X_{t_1}]}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t_1,X_{t_1}) *[t_2-t_1]*[X_{t_2}-X_{t_1}]$$

But now if we know $X_t$, this is a function of only $t_1$ and $t_2$.  And then we can say $t_2 = t_1 + h$. We can also start calling $t_1$ just $t$

$$\Delta f(t,h) = \frac{\partial f}{\partial t}(t,X_{t}) *h + \frac{\partial f}{\partial x}(t,X_{t}) *[X_{t+h}-X_{t}]  + ... $$

$$... +  \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t,X_{t}) * {h}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial x}^2}(t,X_{t}) * {[X_{t+h}-X_{t}]}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t,X_{t}) *h*[X_{t+h}-X_{t}]$$

Now we use the fact that $X_t$ is an Ito Process given by:

$$X_t = a + \int_{s=0}^{s=t} \mu_sds + \int_{s=0}^{s=t} \sigma_sdW_s$$

And finding the difference between times $t$ and $t+h$:

$$X_{t+h} - X_t = a + \int_{s=0}^{s=t+h} \mu_sds + \int_{s=0}^{s=t+h} \sigma_sdW_s - \left(a + \int_{s=0}^{s=t} \mu_sds + \int_{s=0}^{s=t} \sigma_sdW_s\right) = $$

$$ =  X_{t+h} - X_t = \int_{s=0}^{s=t+h} \mu_sds - \int_{s=0}^{s=t} \mu_sds+ \int_{s=0}^{s=t+h} \sigma_sdW_s - \int_{s=0}^{s=t} \sigma_sdW_s$$

We now make a temporary notation switch so our work in a few steps will be cleaner, and we will substitute it in:

$$P_t := \int_{s=0}^{s=t} \mu_sds$$
$$Q_t := \int_{s=0}^{s=t} \sigma_sdW_s$$
$$  X_{t+h} - X_t = P_{t+h} -P_t+ Q_{t+h} - Q_t$$

Now plug this in for the step above the Ito Process.

$$\Delta f(t,h) = \frac{\partial f}{\partial t}(t,X_{t}) *h + \frac{\partial f}{\partial x}(t,X_{t}) *[P_{t+h} -P_t+ Q_{t+h} - Q_t]  + ... $$

$$... +  \frac{1}{2}\frac{\partial^2 f}{{\partial t}^2}(t,X_{t}) * {h}^2 + \frac{1}{2}\frac{\partial^2 f}{{\partial x}^2}(t,X_{t}) * {[P_{t+h} -P_t+ Q_{t+h} - Q_t]}^2 +  \frac{\partial^2 f}{\partial t \partial x}(t,X_{t}) *h*[P_{t+h} -P_t+ Q_{t+h} - Q_t]$$

At this point, we are ready (in a pretty mathematically justifiable way) to do an integration. We'll start at $t=0$ and go up to an arbitrary $t$.  And during this process, we'll add up very small $\Delta f$ values until we get the actual change from $t=0$ to $t$, which will just give us the value at $t$ (assuming we know the value at $t=0$, which we'll assume we do).  It is not obvious yet, but if we can do that, we'll be a lot closer to having our function of $t$ that we want, $Z_t$.

So let's say we have $n$ partitions of our interval $[0,t]$, and we add up $n$ versions of $\Delta f$ values.  Then our $t$ and $h$ would be:

$$t = \frac{it}{n}, h = \frac{t}{n}$$

And we could sum the equation and reorder the last two terms:

$$Z_t^n = \sum_{i=1}^{i = n} \Delta f\left(ih,h\right) = \sum_{i=1}^{i = n} \frac{\partial f}{\partial t}(ih,X_{ih}) *h + \sum_{i=1}^{i = n}\frac{\partial f}{\partial x}(ih,X_{ih}) *[\Delta P_t+ \Delta Q_t] +  \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial t}^2}(ih,X_{ih}) * {h}^2 + ... $$

$$...   + \sum_{i=1}^{i = n} \frac{\partial^2 f}{\partial t \partial x}(ih,X_{ih}) *h*[\Delta P_t+ \Delta Q_t] + \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}) * {[\Delta P_t+ \Delta Q_t]}^2$$

and simplifying and collecting terms:

$$Z_t^n = \sum_{i=1}^{i = n} \Delta f\left(ih,h\right) = \sum_{i=1}^{i = n} \frac{\partial f}{\partial t}(ih,X_{ih}) *h + \sum_{i=1}^{i = n}\frac{\partial f}{\partial x}(ih,X_{ih}) *[\Delta P_t] + \sum_{i=1}^{i = n}\frac{\partial f}{\partial x}(ih,X_{ih}) *[\Delta Q_t] +  $$

$$ \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial t}^2}(ih,X_{ih}) * {h}^2 + \sum_{i=1}^{i = n} \frac{\partial^2 f}{\partial t \partial x}(ih,X_{ih}) *h*[\Delta P_t] + ... $$

$$...   + \sum_{i=1}^{i = n} \frac{\partial^2 f}{\partial t \partial x}(ih,X_{ih}) *h*[ \Delta Q_t]+ \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}) * {[\Delta P_t+ \Delta Q_t]}^2$$

And squaring the $\Delta P_t$ and $\Delta Q_t$ terms and splitting across the sum:

$$Z_t^n = \sum_{i=1}^{i = n} \Delta f\left(ih,h\right) = \sum_{i=1}^{i = n} \frac{\partial f}{\partial t}(ih,X_{ih}) *h + \sum_{i=1}^{i = n}\frac{\partial f}{\partial x}(ih,X_{ih}) *[\Delta P_t] + \sum_{i=1}^{i = n}\frac{\partial f}{\partial x}(ih,X_{ih}) *[\Delta Q_t] +  $$

$$ \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial t}^2}(ih,X_{ih}) * {h}^2 + \sum_{i=1}^{i = n} \frac{\partial^2 f}{\partial t \partial x}(ih,X_{ih}) *h*[\Delta P_t]  + \sum_{i=1}^{i = n} \frac{\partial^2 f}{\partial t \partial x}(ih,X_{ih}) *h*[ \Delta Q_t]+ ... $$

$$...  + \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}) {\Delta P_t}^2 + \frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}){\Delta Q_t}^2 + 2\frac{1}{2}\sum_{i=1}^{i = n}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih})\Delta Q_t \Delta P_t$$

And now we take the limit at $n$ approaches $\infty$, and a bunch of terms cancel. :

$$Z_t^\infty = f(t,X_t) - f(0,X_0) = \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) ds + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) d P_s + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) d Q_s +  $$

$$...  +  \frac{1}{2}\sum_{i=1}^{i = \infty}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}){\Delta Q_t}^2 $$

And focusing on the top line, we can substitute back in for $P_s$ and $Q_s$:

$$Z_t^\infty = f(t,X_t) - f(0,X_0) = \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) ds + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) \mu_s d s + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) \sigma_sdW_s +  $$

$$...  +  \frac{1}{2}\sum_{i=1}^{i = \infty}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}){\Delta Q_t}^2 $$

And again focusing on the top line, we can combine like terms:

$$Z_t^\infty = f(t,X_t) - f(0,X_0) = \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) + \mu_s \frac{\partial f}{\partial x}(s,X_s)  ds + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) \sigma_sdW_s +  $$

$$...  +  \frac{1}{2}\sum_{i=1}^{i = \infty}\frac{\partial^2 f}{{\partial x}^2}(ih,X_{ih}){\Delta Q_t}^2 $$

And now we focus on the bottom line and given that ${\Delta Q_t}^2$ approaches ${\sigma _t}^2dt$, we get:

$$Z_t^\infty = f(t,X_t) - f(0,X_0) = \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) + \mu_s \frac{\partial f}{\partial x}(s,X_s)  ds + \int_{s=0}^{s=t}\frac{\partial f}{\partial x}(s,X_s) \sigma_sdW_s +  $$

$$...  +  \frac{1}{2}\int_{s=0}^{s=t}\frac{\partial^2 f}{{\partial x}^2}(s,X_s) {\sigma _s}^2 ds $$

And now we can combine like terms again, and we have Ito's formula:

$$Z_t = f(t,X_t) = a + \int_{s=0}^{s=t} \frac{\partial f}{\partial t}(s,X_s) + \mu_s \frac{\partial f}{\partial x}(s,X_s) + \frac{1}{2}{\sigma _s}^2\frac{\partial^2 f}{{\partial x}^2}(s,X_s)  ds + \int_{s=0}^{s=t}\sigma_s\frac{\partial f}{\partial x}(s,X_s) dW_s   $$

\end{document}


\documentclass[12]{scrartcl}
\usepackage{amssymb,amsmath,gensymb,dsfont,calc,multicol,fullpage}
\makeatletter
\newcommand\Aboxed[1]{
   \@Aboxed#1\ENDDNE}
\def\@Aboxed#1&#2\ENDDNE{%
   &
   \settowidth\@tempdima{$\displaystyle#1{}$}
   \setlength\@tempdima{\@tempdima+\fboxsep+\fboxrule}
   \kern-\@tempdima
   \boxed{#1#2}
}
\makeatother

\begin{document}

\title{Homework 27, Section 5.1: 18, 21, 23, 25, 31}
\author{Alex Gordon}
\date{\today}
\maketitle
\section*{Homework}
\subsection*{18.}
Upper triangular matrix, so the eigenvalues are the values on the diagonal $= 5, 0, 3$
\subsection*{21. A)}
False. The equation $Ax = \lambda x$ must have a nontrivial solution.
\subsection*{21. B)}
True. If 0 is an eigenvalue then is equivalent to $Ax = 0$, which has a nontrivial solution if and only if A is not invertible. Thus 0 is an eigenvalue of A if and only if A is not invertible.
\subsection*{21. C)}
True. The set of all solutions of $A - \lambda I)x = 0$ is just the null space of the matrix $Ax = \lambda I$.
\subsection*{21. D)}
True. To check if it is an eigenvector, just multiply it by the matrix in question.
\subsection*{21. E)}
True. Although row reduction is used to find eigenvectors, it cannot be used to find eigenvalues.
\subsection*{23.}
If a 2 x 2 matrix A were to have three distinct eigen values then by theorem 2 there would correspond three linearly independent eigenvectors. This is impossible because the vectors all belong to a two-dimensional vector space, in which any set of three vectors in linearly dependent.
\subsection*{25.}
If $\lambda$ is an eigenvalue of A then there is a nonzero vector x such that $Ax - \lambda x$. Since $x \neq 0$, $\lambda$ cannot be zero. This then means that $\lambda^{-1} Ax = A^{-1}x$, which shows that $\lambda^{-1}$ is an eigenvalue of $A^{-1}$.
\subsection*{31.}
Suppose T reflects points through a line that passes through the origin of the matrix. The line is multiples of some nonzero vector v, so the points on the line do not move under A. So T(v) = v. If A is the standard matrix of T, then $Av = v$. Thus v is an eigenvector of A corresponding to the eigenvalue 1. This also means another eigenspace is generated by any nonzero vector u that is perpendicular to the given line. This, by the properties of transformation, each vector on the line through the vector u is transformed onto the vector -x, meaning the eigenvalue is -1.
\end{document}