\section{Model Description}

\subsection{Problem Statement}

The formulation assumes that there is a rigid hub, with $N_P$ lumped masses in the tank for the fuel. Subscript $j$ is used to indicate the $j_\text{th}$ fuel slosh mass, $m_j$. Figure~\ref{fig:Slosh_Figure} displays the frame and variable definitions used for this formulation.

\begin{figure}[ht]
	\centering
	\includegraphics[width=13cm]{Figures/spacecraft.pdf}
	\caption{Frame and variable definitions used for formulation}
	\label{fig:Slosh_Figure}
\end{figure}

There are four coordinate frames defined for this formulation. The inertial reference frame is indicated by \frameDefinition{N}. The body fixed coordinate frame, \frameDefinition{B}, which is anchored to the hub and can be oriented in any direction. The initial pendulum frame, $\mathcal{P}_{0,j}:\{\hat{\bm p}_{0_j,1},\hat{\bm p}_{0_j,2},\hat{\bm p}_{0_j,3}\}$, is a frame with its origin located at tank geometrical center, $T$. The $\mathcal{P}_{0,j}$ frame is a fixed frame respect to the body frame, oriented such that $\hat{\bm{p}}_{0_j,1}$ points to the fuel slosh mass in its initial position, $P_{j}$. The constant distance from point $T$ to point $P_{j}$ is defined as $l_j$.

There are a few more key locations that need to be defined. Point $B$ is the origin of the body frame, and can have any location with respect to the hub. Point $B_c$ is the location of the center of mass of the rigid hub. $P_{c,j}$ is the instantaneous position of the fuel slosh mass $m_j$. $\bm{d}$ is vector from the center of the body reference system to the tank geometrical center. $\bm{l_j}$ is the vector from $T$ to $P_{c,j}$.

Figure~\ref{fig:Slosh_Detailed} provides further detail of the fuel slosh parameters and reference frames. As seen in Figure~\ref{fig:Slosh_Figure}, an individual slosh particle is free to move in every direction while connected by rigid weightless rod to the geometrical center of the tank. A linear damper effect is considered using a damping matrix, $D$. The variables, $\varphi_j$ and $\vartheta_j$ are state variables and quantify the angular displacement from initial position for the corresponding slosh mass.

\begin{figure}[ht]
	\centering

	\includegraphics[width=13cm]{Figures/referencesystems.pdf}
	\caption{Further detail of fuel slosh and reference frames}
	\label{fig:Slosh_Detailed}
\end{figure}

Using the variables and frames defined, the following section outlines the derivation of equations of motion for the spacecraft.

\subsection{Derivation of Equations of Motion}

\subsubsection{Rigid Spacecraft Hub Translational Motion}

The derivation begins with Newton's first law for the center of mass of the spacecraft.
\begin{equation}
	\ddot{\bm r}_{C/N} = \frac{\bm{F}}{m_{\text{\text{sc}}}}
	\label{eq:Newtons1Law}
\end{equation}
Ultimately the acceleration of the body frame or point $B$ is desired
\begin{equation}
	\ddot{\bm r}_{B/N} = \ddot{\bm r}_{C/N}-\ddot{\bm c}
	\label{eq:RcRbacc}
\end{equation}
The definition of $\bm{c}$ can be seen in Eq. (\ref{eq:c}).
\begin{equation}
	\bm{c} = \frac{1}{m_{\text{sc}}}\Big(m_{\text{\text{hub}}}\bm{r}_{B_{c}/B} +\sum_{j=1}^{N_{P}}m_j\bm{r}_{P_{c,j}/B}\Big)
	\label{eq:c}
\end{equation}
To find the inertial time derivative of $\bm{c}$, it is first necessary to find the time derivative of $\bm{c}$ with respect to the body frame. A time derivative of any vector, $\bm{v}$, with respect to the body frame is denoted by $\bm{v}'$; the inertial time derivative is labeled as $\dot{\bm{v}}$. The first and second body-relative time derivatives of $\bm{c}$ can be seen in Eqs. (\ref{eq:cprime}) and (\ref{eq:cdprime}).
\begin{align}
	\bm{c}' &= \frac{1}{m_{\text{sc}}}\Big(\sum_{j=1}^{N_{P}}m_j\bm{r}'_{P_{c,j}/B}\Big)
	\label{eq:cprime}
	\\
	\bm{c}'' &= \frac{1}{m_{\text{sc}}}\Big(\sum_{j=1}^{N_{P}}m_j\bm{r}''_{P_{c,j}/B}\Big)
	\label{eq:cdprime}
\end{align}
Remembering that the derivative of $d$ is null respect to the body frame, the first and second body time derivatives of $\bm{r}_{P_{c,j}/B}$ are
\begin{equation}
	\bm{r}_{P_{c,j}/B} =
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			\cos(\varphi_j)\cos(\vartheta_j) \\
			\sin(\varphi_j)\cos(\vartheta_j) \\
			-\sin(\vartheta_j)
	\end{bmatrix}}
	+ d
	\label{eq:rPcjB}
\end{equation}

\begin{equation}
	\bm{r}'_{P_{c,j}/B}
	=
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\dot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \\
			\dot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \\
			-\dot{\vartheta}_j\cos(\vartheta_j)
	\end{bmatrix}}
	\label{eq:rPcjBprime}
\end{equation}

\begin{equation}
	\bm{r}''_{P_{c,j}/B}
	=
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \\ \\
			\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \\ \\
			-\ddot{\vartheta}_j\cos(\vartheta_j)+\dot{\vartheta}_j^2\sin(\vartheta_j)
	\end{bmatrix}}
	\label{eq:rPcjBprimeprime}
\end{equation}
Eqs.~\eqref{eq:cprime} and ~\eqref{eq:cdprime} are next reformulated to include these new definitions:

\begin{multline}
	\bm{c}' = \frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[\Big(-\dot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)\Big)\bm{\hat{p}}_{0_j,1}+\\
	\Big(\dot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,2}  -\dot{\vartheta}_j\cos(\vartheta_j) \bm{\hat{p}}_{0_j,3} \bigg]
	\label{eq:cprime2}
\end{multline}

\begin{multline}
	\bm{c}'' = \frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)\\+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,1}
	+\Big(\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,2}
	+\Big(-\ddot{\vartheta}_j\cos(\vartheta_j)+\dot{\vartheta}_j^2\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,3}
	\bigg]
	\label{eq:cdprime2}
\end{multline}
Using the transport theorem yields the following definition for $\ddot{\bm c}$
\begin{equation}
	\ddot{\bm c} = \bm{c}'' + 2\bm\omega_{\cal B/N}\times\bm{c}'+\dot{\bm\omega}_{\cal B/N}\times\bm{c}+\bm\omega_{\cal B/N}\times\left(\bm\omega_{\cal B/N}\times\bm{c}\right)
	\label{eq:cddot}
\end{equation}
Eq.~\eqref{eq:RcRbacc} is updated to include Eq.~\eqref{eq:cddot}

\begin{equation}
	\ddot{\bm r}_{B/N} = \ddot{\bm r}_{C/N}-\bm{c}'' - 2\bm\omega_{\cal B/N}\times\bm{c}'-\dot{\bm\omega}_{\cal B/N}\times\bm{c}-\bm\omega_{\cal B/N}\times\left(\bm\omega_{\cal B/N}\times\bm{c}\right)
	\label{eq:Rbddot}
\end{equation}
Substituting Eq.\eqref{eq:cdprime2} into Eq.\eqref{eq:Rbddot} results in

\begin{multline}
	\ddot{\bm r}_{B/N} = \ddot{\bm r}_{C/N}-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,1}
	+\Big(\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)\\-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,2}
	+\Big(-\ddot{\vartheta}_j\cos(\vartheta_j)\\+\dot{\vartheta}_j^2\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,3}
	\bigg]
	- 2\bm\omega_{\cal B/N}\times\bm c'
	-\dot{\bm\omega}_{\cal B/N}\times\bm{c}-\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times\bm{c})
	\label{eq:Rbddot2}
\end{multline}
Moving second order terms to the left hand side and introducing the tilde matrix to replace the cross product operators simplifies the equation to

\begin{multline}
	\ddot{\bm r}_{B/N}-[\tilde{\bm{c}}] \dot{\bm\omega}_{\cal B/N}-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)+\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)\Big)\bm{\hat{p}}_{0_j,1}\\ +\Big(-\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)+\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)\Big)\bm{\hat{p}}_{0_j,2}+\ddot{\vartheta}_j\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}
	\bigg]= \ddot{\bm r}_{C/N} 	- 2[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	\\
	-[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,1} \\
	+\Big(-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,2}
	+\dot{\vartheta}_j^2\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3}
	\bigg]
	\label{eq:Rbddot3}
\end{multline}
Rearranging the terms:
\begin{multline}
	\ddot{\bm r}_{B/N}-[\tilde{\bm{c}}] \dot{\bm\omega}_{\cal B/N}-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\ddot{\varphi}_j \\+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\ddot{\vartheta}_j
	\bigg]= \ddot{\bm r}_{C/N} 	- 2[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	\\-[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	\\+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 \\+
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	\bigg]
	\label{eq:Rbddot4}
\end{multline}

Equation~\eqref{eq:Rbddot4} is the translational motion equation and is the first EOM needed to describe the motion of the spacecraft. The following section develops the rotational EOM.

\subsubsection{Rigid Spacecraft Hub Rotational Motion}

Starting with Euler's equation when the body fixed coordinate frame origin is not coincident with the center of mass of the body
\begin{equation}
	\bm{\dot{H}}_{\text{sc},B} = \bm{L}_B+m_{\text{\text{sc}}}\ddot{\bm r}_{B/N}\times\bm{c}
	\label{eq:Euler}
\end{equation}
where $\bm{L}_B$ is the total external torque about point $B$. The definition of the angular momentum vector of the spacecraft about point $B$ is
\begin{equation}
	\bm{H}_{\text{sc},B} = [I_{\text{hub},B_c}] \bm\omega_{\cal B/N} + m_{\text{hub}} \bm{r}_{B_c/B}\times\bm{\dot{r}}_{B_c/B} + \sum\limits_{j=1}^{N_P}m_j \bm r_{P_{c,j}/B}\times \dot{\bm r}_{P_{c,j}/B}
	\label{eq:Hb2}
\end{equation}

Now the inertial time derivative of Eq. \eqref{eq:Hb2} is taken and yields
\begin{equation}
	\dot{\bm{H}}_{\text{sc},B} = [I_{\text{hub},B_c}] \dot{\bm\omega}_{\cal B/N} + \bm\omega_{\cal B/N} \times [I_{\text{hub},B_c}] \bm\omega_{\cal B/N} + m_{\text{hub}} \bm{r}_{B_c/B}\times\ddot{\bm r}_{B_c/B}+ \sum\limits_{j=1}^{N_P}m_j \bm r_{P_{c,j}/B}\times \ddot{\bm r}_{P_{c,j}/B}
	\label{eq:Hbdot}
\end{equation}
The terms $\ddot{\bm r}_{B_c/B}$ and $\ddot{\bm r}_{P_{c,j}/B}$ are found using the transport theorem and knowing that $\bm{r}_{B_c/B}$ is fixed with respect to the body frame.
\begin{align}
	\ddot{\bm r}_{B_c/B} &= \bm{\dot{\omega}}_{\cal B/N} \times \bm{r}_{B_c/B} + \bm\omega_{\cal B/N} \times (\bm\omega_{\cal B/N} \times \bm{r}_{B_c/B})
	\label{eq:rbddot}
	\\
	\ddot{\bm{r}}_{P_{c,j}/B}  &= \bm{r}''_{P_{c,j}/B} +2 \bm\omega_{\cal B/N} \times \bm{r}'_{P_{c,j}/B} + \dot{\bm\omega}_{\cal B/N} \times \bm{r}_{P_{c,j}/B}  +\bm\omega_{\cal B/N} \times (\bm\omega_{\cal B/N} \times \bm{r}_{P_{c,j}/B})
	\label{eq:rpddot}
\end{align}
Incorporating Eqs.~\eqref{eq:rbddot} -~\eqref{eq:rpddot} into Eq.~\eqref{eq:Hbdot} results in
\begin{multline}
	\dot{\bm{H}}_{\text{sc},B} = [I_{\text{hub},B_c}] \dot{\bm\omega}_{\cal B/N} + \bm\omega_{\cal B/N} \times [I_{\text{hub},B_c}] \bm\omega_{\cal B/N} + m_{\text{hub}} \bm{r}_{B_c/B}\times ( \dot{\bm\omega}_{\cal B/N}\times \bm{r}_{B_c/B})+\\ +m_{\text{hub}} \bm{r}_{B_c/B}\times \Bigl[ \bm\omega_{\cal B/N}\times (\bm\omega_{\cal B/N}\times \bm{r}_{B_c/B})\Bigr] + \sum\limits_{j=1}^{N_P}m_j \bm r_{P_{c,j}/B}\times \Bigl[\bm{r}''_{P_{c,j}/B} +2 \bm\omega_{\cal B/N} \times \bm{r}'_{P_{c,j}/B} + \\ + \dot{\bm\omega}_{\cal B/N} \times \bm{r}_{P_{c,j}/B} +\bm\omega_{\cal B/N} \times (\bm\omega_{\cal B/N} \times \bm{r}_{P_{c,j}/B})\Bigr]
	\label{eq:Hbdot2}
\end{multline}
Applying the parallel axis theorem the following inertia tensor terms are defined as
\begin{align}
	[I_{\text{hub},B}] &= [I_{\text{hub},B_c}] + m_{\text{hub}}[\bm{\tilde{r}}_{B_c/B}] [\bm{\tilde{r}}_{B_c/B}]^T
	\\
	[I_{\text{sc},B}] &= [I_{\text{hub},B}] + \sum\limits_{j=1}^{N_P} m_j [\tilde{\bm{r}}_{P_{c,j}/B}] [\tilde{\bm{r}}_{P_{c,j}/B}]^T
	\label{eq:IscB}
\end{align}
Taking the body-relative time derivative of Equation~\eqref{eq:IscB} yields
\begin{equation}
	[I'_{\text{sc},B}] = - \sum\limits_{j=1}^{N_P} m_j \Bigl(  [\tilde{\bm{r}}'_{P_{c,j}/B}] [\tilde{\bm{r}}_{P_{c,j}/B}] + [\tilde{\bm{r}}_{P_{c,j}/B}] [\tilde{\bm{r}}'_{P_{c,j}/B}]  \Bigr)
	\label{eq:Idotsc}
\end{equation}
The Jacobi Identity, $(\bm a \times \bm b)\times \bm c = \bm a \times (\bm b\times \bm c) - \bm        b \times (\bm a\times \bm c)$, is applied to the cross products of Eq. \eqref{eq:Hbdot2}:
\begin{multline}
	\dot{\bm{H}}_{\text{sc},B} = [I_{\text{hub},B_c}] \dot{\bm\omega}_{\cal B/N} + \bm\omega_{\cal B/N} \times [I_{\text{hub},B_c}] \bm\omega_{\cal B/N} - m_{\text{hub}} \bm{r}_{B_c/B}\times (\bm{r}_{B_c/B}\times \dot{\bm\omega}_{\cal B/N})+\\ +m_{\text{hub}}  \bm\omega_{\cal B/N}\times \Bigl[\bm{r}_{B_c/B}\times(\bm\omega_{\cal B/N}\times \bm{r}_{B_c/B})\Bigr] + \sum\limits_{j=1}^{N_P}m_j \bigg\{ \bm r_{P_{c,j}/B}\times \bm{r}''_{P_{c,j}/B} -\bm r_{P_{c,j}/B}\times (\bm{r}'_{P_{c,j}/B}\times\bm\omega_{\cal B/N} )\\-
	\bm{r}'_{P_{c,j}/B}\times (\bm r_{P_{c,j}/B}\times\bm\omega_{\cal B/N})+\bm\omega_{\cal B/N}\times(\bm r_{P_{c,j}/B}\times\bm{r}'_{P_{c,j}/B})
	\\ - \bm r_{P_{c,j}/B}\times (\bm{r}_{P_{c,j}/B} \times \dot{\bm\omega}_{\cal B/N}) +\bm\omega_{\cal B/N} \times \Bigl[\bm r_{P_{c,j}/B}\times (\bm\omega_{\cal B/N} \times \bm{r}_{P_{c,j}/B})\Bigl]\bigg\}
	\label{eq:Hbdot3_1}
\end{multline}
Rearranging the terms in Eq. \eqref{eq:Hbdot3_1} yields:
\begin{multline}
	\dot{\bm{H}}_{\text{sc},B} = \left\{[I_{\text{hub},B_c}] +m_{\text{hub}} [\bm{\tilde{r}}_{B_c/B}] [\bm{\tilde{r}}_{B_c/B}]^T+\sum\limits_{j=1}^{N_P}m_j [\bm{\tilde{r}}_{P_{c,j}/B}][\bm{\tilde{r}}_{P_{c,j}/B}]^T \right\} \dot{\bm\omega}_{\cal B/N} \\
	+ \bm\omega_{\cal B/N} \times \bigg \{[I_{\text{hub},B_c}] + m_{\text{hub}} [\bm{\tilde{r}}_{B_c/B}] [\bm{\tilde{r}}_{B_c/B}]^T +\sum\limits_{j=1}^{N_P}m_j [\bm{\tilde{r}}_{P_{c,j}/B}][\bm{\tilde{r}}_{P_{c,j}/B}]^T \bigg\}\bm\omega_{\cal B/N} \\ + \sum\limits_{j=1}^{N_P}m_j \bigg\{ \bm r_{P_{c,j}/B}\times \bm{r}''_{P_{c,j}/B} -\bigg[[\bm{\tilde{r}}_{P_{c,j}/B}][\bm{\tilde{r}}'_{P_{c,j}/B}]+[\bm{\tilde{r}}'_{P_{c,j}/B}][\bm{\tilde{r}}_{P_{c,j}/B}] \bigg]\bm\omega_{\cal B/N}\\
	+\bm\omega_{\cal B/N}\times(\bm r_{P_{c,j}/B}\times\bm{r}'_{P_{c,j}/B}) \bigg\}
	\label{eq:Hbdot3_2}
\end{multline}
Using Eqs.~\eqref{eq:IscB} and \eqref{eq:Idotsc} to simplify results in Eq.~\eqref{eq:Hbdot3_2}, the following simplified equation is obtained:
\begin{multline}
	\dot{\bm{H}}_{\text{sc},B} = [I_{\text{sc},B}] \dot{\bm\omega}_{\cal B/N} + \bm\omega_{\cal B/N} \times [I_{\text{sc},B}] \bm\omega_{\cal B/N} + [I'_{\text{sc},B}] \bm\omega_{\cal B/N}
	+ \sum\limits_{j=1}^{N_P}\biggl[m_j \bm r_{P_{c,j}/B}\times\bm{r}''_{P_{c,j}/B} \\
	+ m_j \bm\omega_{\cal B/N} \times \Bigl(\bm{r}_{P_{c,j}/B} \times \bm{r}'_{P_{c,j}/B}\Bigr)\biggr]
	\label{eq:Hbdot4}
\end{multline}
Eqs. (\ref{eq:Euler}) and (\ref{eq:Hbdot4}) are equated and yield
\begin{multline}
	\bm{L}_B+m_{\text{sc}}\ddot{\bm r}_{B/N}\times\bm{c} = [I_{\text{sc},B}] \dot{\bm\omega}_{\cal B/N} + \bm\omega_{\cal B/N} \times [I_{\text{sc},B}] \bm\omega_{\cal B/N} + [I'_{\text{sc},B}] \bm\omega_{\cal B/N}
	+ \sum\limits_{j=1}^{N_P}\biggl[m_j \bm r_{P_{c,j}/B}\times\bm{r}''_{P_{c,j}/B}\\
	+ m_j \bm\omega_{\cal B/N} \times \Bigl(\bm{r}_{P_{c,j}/B} \times \bm{r}'_{P_{c,j}/B}\Bigr)\biggr]
\end{multline}
Finally, using tilde matrix and simplifying yields the modified Euler equation, which is the second EOM necessary to describe the motion of the spacecraft.
\begin{multline}
	[I_{\text{sc},B}] \dot{\bm\omega}_{\cal B/N} = -[\bm{\tilde{\omega}}_{\cal B/N}] [I_{\text{sc},B}] \bm\omega_{\cal B/N} - [I'_{\text{sc},B}] \bm\omega_{\cal B/N}	- \sum\limits_{j=1}^{N_P}\biggl(m_j [\tilde{\bm r}_{P_{c,j}/B}]\bm{r}''_{P_{c,j}/B}\\
	+ m_j [\tilde{\bm\omega}_{\cal B/N}] [\tilde{\bm{r}}_{P_{c,j}/B}] \bm{r}'_{P_{c,j}/B}\biggr) + \bm{L}_B - m_{\text{sc}} [\tilde{\bm{c}}] \ddot{\bm r}_{B/N}
	\label{eq:Final5}
\end{multline}
Rearranging Eq.~\eqref{eq:Final5} to be in the same form as the previous sections results in
\begin{multline}
	m_{\text{sc}}[\tilde{\bm{c}}]\ddot{\bm r}_{B/N}+[I_{\text{sc},B}] \dot{\bm\omega}_{\cal B/N}  - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\ddot{\varphi}_j \\
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\ddot{\vartheta}_j
	\bigg] =
	\bm{L}_B-[\bm{\tilde{\omega}}_{\cal B/N}] [I_{\text{sc},B}] \bm\omega_{\cal B/N}
	- [I'_{\text{sc},B}] \bm\omega_{\cal B/N}\\ 	- \sum\limits_{j=1}^{N_P} m_j \Big\{[\tilde{\bm\omega}_{\cal B/N}] [\tilde{\bm{r}}_{P_{c,j}/B}] \bm{r}'_{P_{c,j}/B}+l_j[\tilde{\bm{r}}_{P_{c,j}/B}]\bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2 \\
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 +\\
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	\bigg]\Big\}
	\label{eq:Final6}
\end{multline}

\subsubsection{Fuel Slosh Motion}
The fuel slosh motion is being approximated by a lumped mechanical multi-mode model. Figure~\ref{fig:Slosh_Figure} shows that a single fuel slosh particle is free to move around the geometrical center of the tank at a fixed distance $l_j$ and this formulation is generalized to include $N_P$ number of fuel slosh particles. The derivation begins with Euler's law for each fuel slosh particle:

\begin{equation}
	\bm{\dot{H}}_{T,j}=\bm{L}_{T,j}+m_{j} \bm{\ddot{r}}_{T/N}\times \bm{l_j}
	\label{eq:dotH_T}
\end{equation}
Where the $\bm{L}_{T,j}$ represents the external torques. It contains the damping term that is modeled as $\bm{D}$ damping matrix multiplied by the relative velocity between the tank and the fuel, $\bm{l_j'}$. It takes into account  the torque due to gravity and any other external torque.
\begin{equation}
	\bm{L}_{T,j}=\bm{l_j}\times \bm{F_g}-\bm{D}\bm{l_j'} + \bm{\tau}_{ext,j}
\end{equation}
It is necessary to express $\bm{H}_T$ of the fuel slosh particle as:
\begin{equation}
	\bm{H}_{T,j}= m_j \bm{l_j}\times \bm{\dot{l}_j}
\end{equation}
Deriving this equation we obtain:
\begin{equation}
	\bm{\dot{H}}_{T,j}=m_j\bm{l_j}\times \bm{\ddot{l_j}}
	\label{eq:dotH_T_particle}
\end{equation}
Using the transport theorem once again:
\begin{equation}
	\bm{\ddot{l_j}}=\bm{l_j''}+\bm{\dot{\omega}}_{B/N}\times \bm{l_j} + 2\bm\omega_{\cal B/N}\times \bm{l_j'}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{l_j})
	\label{eq:ddotl_j}
\end{equation}
$\bm{l_j}$ prime and second derivative are equal to \eqref{eq:rPcjBprime} and \eqref{eq:rPcjBprimeprime} because the $\bm{d}$ vector is constant in body frame. The previous results are reported here:

\begin{equation}
	\bm{l_j} =
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			\cos(\varphi_j)\cos(\vartheta_j) \\
			\sin(\varphi_j)\cos(\vartheta_j) \\
			-\sin(\vartheta_j)
	\end{bmatrix}}
	\label{eq:lj}
\end{equation}

\begin{equation}
	\bm{l_j}'
	=
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\dot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \\
			\dot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \\
			-\dot{\vartheta}_j\cos(\vartheta_j)
	\end{bmatrix}}
	\label{eq:ljprime}
\end{equation}

\begin{equation}
	\bm{l_j}''
	=
	l_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \\ \\
			\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \\ \\
			-\ddot{\vartheta}_j\cos(\vartheta_j)+\dot{\vartheta}_j^2\sin(\vartheta_j)
	\end{bmatrix}}
	\label{eq:ljBprimeprime}
\end{equation}
Equating eqs. \eqref{eq:dotH_T} and \eqref{eq:dotH_T_particle} and using eq. \eqref{eq:ddotl_j}, we obtain:
\begin{equation}
	m_j\bm{l_j}\times [\bm{l_j''}+\bm{\dot{\omega}}_{B/N}\times \bm{l_j} + 2\bm\omega_{\cal B/N}\times \bm{l_j'}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{l_j})]=\bm{L}_{T,j}+m_{j} \bm{\ddot{r}}_{T/N}\times \bm{l_j}
	\label{eq:FSE1}
\end{equation}
Substituting eq. \eqref{eq:ljBprimeprime} in eq. \eqref{eq:FSE1}
\begin{multline}
	m_j\bm{l_j}\times \bigg[
	l_j\Big(-\ddot{\varphi}_j\sin(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\cos(\varphi_j)\cos(\vartheta_j)-\dot{\vartheta}_j^2\cos(\varphi_j)\cos(\vartheta_j)\\+2\dot{\varphi}_j\dot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,1}
	+l_j\Big(\ddot{\varphi}_j\cos(\varphi_j)\cos(\vartheta_j)-\ddot{\vartheta}_j\sin(\varphi_j)\sin(\vartheta_j)-\dot{\varphi}_j^2\sin(\varphi_j)\cos(\vartheta_j)\\-\dot{\vartheta}_j^2\sin(\varphi_j)\cos(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_j\cos(\varphi_j)\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,2}
	+l_j\Big(-\ddot{\vartheta}_j\cos(\vartheta_j)+\dot{\vartheta}_j^2\sin(\vartheta_j) \Big)\bm{\hat{p}}_{0_j,3}\\
	+\bm{\dot{\omega}}_{B/N}\times \bm{l_j} + 2\bm\omega_{\cal B/N}\times \bm{l_j'}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{l_j})\bigg]=\bm{L}_{T,j}+m_{j} \bm{\ddot{r}}_{T/N}\times \bm{l_j}
	\label{eq:FSE2}
\end{multline}
Execute separately the following vectorial product, using $C$ and $S$ to indicate $\cos$ and $\sin$, respectively.
\begin{multline}
	l^2_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			0 & S(\vartheta_j) & S(\varphi_j)C(\vartheta_j)\\
			-S(\vartheta_j) & 0 & -C(\varphi_j)C(\vartheta_j)\\
			-S(\varphi_j)C(\vartheta_j) & C(\varphi_j)C(\vartheta_j) & 0
	\end{bmatrix}}
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\ddot{\varphi}_jS(\varphi_j)C(\vartheta_j)-\ddot{\vartheta}_jC(\varphi_j)S(\vartheta_j)\\-\dot{\varphi}_j^2C(\varphi_j)C(\vartheta_j)-\dot{\vartheta}_j^2C(\varphi_j)C(\vartheta_j)\\+2\dot{\varphi}_j\dot{\vartheta}_jS(\varphi_j)S(\vartheta_j) \\ \\
			\ddot{\varphi}_jC(\varphi_j)C(\vartheta_j)-\ddot{\vartheta}_jS(\varphi_j)S(\vartheta_j)\\-\dot{\varphi}_j^2S(\varphi_j)C(\vartheta_j)-\dot{\vartheta}_j^2S(\varphi_j)C(\vartheta_j)\\-2\dot{\varphi}_j\dot{\vartheta}_jC(\varphi_j)S(\vartheta_j) \\ \\
			-\ddot{\vartheta}_jC(\vartheta_j)+\dot{\vartheta}_j^2S(\vartheta_j)
	\end{bmatrix}}\\
	=
	l^2_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			\ddot{\varphi}_jC(\varphi_j)C(\vartheta_j)S(\vartheta_j)-\ddot{\vartheta}_jS(\varphi_j)S^2(\vartheta_j)-\dot{\varphi}_j^2S(\varphi_j)C(\vartheta_j)S(\vartheta_j)-\dot{\vartheta}_j^2S(\varphi_j)C(\vartheta_j)S(\vartheta_j)\\-2\dot{\varphi}_j\dot{\vartheta}_jC(\varphi_j)S^2(\vartheta_j)-\ddot{\vartheta}_jS(\varphi_j)C^2(\vartheta_j)+\dot{\vartheta}_j^2S(\varphi_j)C(\vartheta_j)S(\vartheta_j) \\ \\
			\ddot{\varphi}_jS(\varphi_j)C(\vartheta_j)S(\vartheta_j)+\ddot{\vartheta}_jC(\varphi_j)S^2(\vartheta_j)+\dot{\varphi}_j^2C(\varphi_j)C(\vartheta_j)S(\vartheta_j)+\dot{\vartheta}_j^2C(\varphi_j)C(\vartheta_j)S(\vartheta_j)\\-2\dot{\varphi}_j\dot{\vartheta}_jS(\varphi_j)S^2(\vartheta_j) +\ddot{\vartheta}_jC(\varphi_j)C^2(\vartheta_j)-\dot{\vartheta}_j^2C(\varphi_j)C(\vartheta_j)S(\vartheta_j) \\ \\
			\ddot{\varphi}_jS^2(\varphi_j)C^2(\vartheta_j)+\ddot{\vartheta}_jC(\varphi_j)S(\varphi_j)C(\vartheta_j)S(\vartheta_j)+\dot{\varphi}_j^2C(\varphi_j)S(\varphi_j)C^2(\vartheta_j)\\+\dot{\vartheta}_j^2C(\varphi_j)S(\varphi_j)C^2(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_jS^2(\varphi_j)C(\vartheta_j)S(\vartheta_j)+	\ddot{\varphi}_jC^2(\varphi_j)C^2(\vartheta_j)\\-\ddot{\vartheta}_jC(\varphi_j)S(\varphi_j)C(\vartheta_j)S(\vartheta_j)-\dot{\varphi}_j^2C(\varphi_j)S(\varphi_j)C^2(\vartheta_j)-\dot{\vartheta}_j^2C(\varphi_j)S(\varphi_j)C^2(\vartheta_j)\\-2\dot{\varphi}_j\dot{\vartheta}_jC^2(\varphi_j)C(\vartheta_j)S(\vartheta_j)
	\end{bmatrix}}\\ \\
	=
	l^2_j
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			\ddot{\varphi}_jC(\varphi_j)C(\vartheta_j)S(\vartheta_j)-\ddot{\vartheta}_jS(\varphi_j)-\dot{\varphi}_j^2S(\varphi_j)C(\vartheta_j)S(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_jC(\varphi_j)S^2(\vartheta_j)\\ \\
			\ddot{\varphi}_jS(\varphi_j)C(\vartheta_j)S(\vartheta_j)+\ddot{\vartheta}_jC(\varphi_j)+\dot{\varphi}_j^2C(\varphi_j)C(\vartheta_j)S(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_jS(\varphi_j)S^2(\vartheta_j) \\ \\
			\ddot{\varphi}_jC^2(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}_jC(\vartheta_j)S(\vartheta_j)
	\end{bmatrix}}
	\label{eq:FS3}
\end{multline}
Using the results obtained in eq. \eqref{eq:FS3}, project eq. \eqref{eq:FSE2} on the axis of rotation of $\varphi$ and $\vartheta$. The $\varphi$ rotation axis is $\bm{\hat{p}}_{0_j,3}$, while we will call $\bm{\hat{p}'}_{0_j,2}$ the $\vartheta$ rotation axis.

\begin{figure}[ht]
	\centering
	\includegraphics[width=8cm]{Figures/rotationaxes.PNG}
	\caption{Rotation Axes}
	\label{fig:Axes_Figure}
\end{figure}

\begin{equation}
	\bm{\hat{p}}_{0_j,3}=
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			0 \\ 0 \\ 1
	\end{bmatrix}}
\end{equation}

\begin{multline}
	m_j l_j^2\bigg[\ddot{\varphi}_j\cos^2(\vartheta_j)-2\dot{\varphi}_j\dot{\vartheta}\cos(\vartheta_j)\sin(\vartheta_j)\bigg] + m_j \bm{\hat{p}}_{0_j,3}^T \bm{l_j}\times \bigg[\bm{\dot{\omega}}_{B/N}\times \bm{l_j} + 2\bm\omega_{\cal B/N}\times \bm{l_j'}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{l_j})\bigg]\\
	=\bm{\hat{p}}_{0_j,3}^T \bm{L}_{T,j}+m_{j} \bm{\hat{p}}_{0_j,3}^T \bm{\ddot{r}}_{T/N}\times \bm{l_j}
	\label{eq:FSE4}
\end{multline}

\begin{equation}
	\bm{\hat{p}'}_{0_j,2}=
	\leftidx{^{\mathcal{P}_{0,j}}}
	{\begin{bmatrix}
			-\sin(\varphi) \\ \cos(\varphi) \\ 0
	\end{bmatrix}}
\end{equation}

\begin{multline}
	m_j l_j^2\bigg[\ddot{\vartheta}_j+\dot{\varphi}_j^2\cos(\vartheta_j)\sin(\vartheta_j)\bigg] + m_j \bm{\hat{p}}_{0_j,2}^{'T} \bm{l_j}\times \bigg[\bm{\dot{\omega}}_{B/N}\times \bm{l_j} + 2\bm\omega_{\cal B/N}\times \bm{l_j'}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{l_j})\bigg]\\
	=\bm{\hat{p}}_{0_j,2}^{'T} \bm{L}_{T,j}+m_{j} \bm{\hat{p}}_{0_j,2}^{'T} \bm{\ddot{r}}_{T/N}\times \bm{l_j}
	\label{eq:FSE5}
\end{multline}
Remembering that $\bm{r}_{T/N} = \bm{r}_{B/N} + \bm{d}$, and that $\bm{d}$ is constant in the body frame, we can use once again the transport theorem to write:

\begin{equation}
	\bm{\ddot{d}}=\bm{\dot{\omega}}_{B/N}\times \bm{d}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{d})
\end{equation}
\begin{equation}
	\bm{\ddot{r}}_{T/N} = \bm{\ddot{r}}_{B/N} + \bm{\dot{\omega}}_{B/N}\times \bm{d}+\bm\omega_{\cal B/N}\times(\bm\omega_{\cal B/N}\times \bm{d})
\end{equation}
Rearranging the terms as done in the previous sections
\begin{multline}
	m_j l_j^2\ddot{\varphi}_j\cos^2(\vartheta_j) -m_{j} \bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]([\bm{\tilde{l}_j}]+ [\bm{\tilde{d}}]) \bm{\dot{\omega}}_{B/N} +m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N} =-m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}\\+\bm{\hat{p}}_{0_j,3}^T \bm{L}_{T,j}+2m_j l_j^2\dot{\varphi}_j\dot{\vartheta}\cos(\vartheta_j)\sin(\vartheta_j)- m_j \bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg]
	\label{eq:FSE6}
\end{multline}

\begin{multline}
	m_j l_j^2\ddot{\vartheta}_j - m_{j}\bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]( [\bm{\tilde{l}_j}] + [\bm{\tilde{d}}])\bm{\dot{\omega}}_{B/N}
	+m_{j} \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N}
	=-m_{j} \bm{\hat{p}}_{0_j,2}^{'T}[\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}\\+\bm{\hat{p}}_{0_j,2}^{'T} \bm{L}_{T,j}-m_j l_j^2\dot{\varphi}_j^2\cos(\vartheta_j)\sin(\vartheta_j)- m_j \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg]
	\label{eq:FSE7}
\end{multline}

Eqs. \eqref{eq:FSE6} and \eqref{eq:FSE7} are the Fuel Slosh Particle equations.

\subsection{Back-substitution Method}

The equations presented in the previous sections result in $2N_P + 6$ coupled differential equations. Therefore, if the EOMs were placed into state space form, a system mass matrix of size $2N_P + 6$ would need to be inverted to numerically integrate the EOMs. This can result in a computationally expensive simulation. The computation effort to numerically invert an $N\times N$ matrix scales with $N^{3}$. In the following section, the EOMs are manipulated using a back-substitution method to increase the computational efficiency.

This manipulation involves inverting twice a ($3\times 3$) matrix, the $A^{-1}$ and $(D-CA^{-1}B)^{-1}$ matrices as it is shown in eqs. \eqref{eq:finalsystemomega}  and \eqref{eq:finalsystemr}. Then the system is completely solved back substituting for fuel slosh and translational motions. The derivation of the back-substitution method can be seen in the following sections.
\\

\subsubsection{Fuel Slosh Motion}
Starting from eq. \eqref{eq:FSE6}
\begin{multline}
	\ddot{\varphi}_j  =\frac{1}{m_j l_j^2 \cos^2(\vartheta_j)}\Big\{m_{j}\bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]( [\bm{\tilde{l}_j}]+[\bm{\tilde{d}}]) \bm{\dot{\omega}}_{B/N} -m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N} -m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}\\+\bm{\hat{p}}_{0_j,3}^T \bm{L}_{T,j}+2m_j l_j^2\dot{\varphi}_j\dot{\vartheta}\cos(\vartheta_j)\sin(\vartheta_j)- m_j \bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg]\Big\}
	\label{eq:BSM1}
\end{multline}

\begin{equation}
	\ddot{\varphi}_j  =\frac{1}{m_j l_j^2 \cos^2(\vartheta_j)}\Big(m_{j}\bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}](  [\bm{\tilde{l}_j}]+ [\bm{\tilde{d}}]) \bm{\dot{\omega}}_{B/N} -m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N}+a_{\varphi_j} \Big)
	\label{eq:BSM2}
\end{equation}
Writing it this way instead
\begin{equation}
	\ddot{\varphi}_j  = \bm a_{\varphi_j}^T \ddot{\bm{r}}_{B/N} + \bm b_{\varphi_j}^T \dot{\bm\omega}_{\cal B/N} +c_{\varphi_j}
	\label{eq:BSM3}
\end{equation}
Where

\begin{equation}
	\bm a_{\varphi_j}^{T} = -\frac{\bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}]}{ l_j^2 \cos^2(\vartheta_j)}
	\label{eq:BSM4}
\end{equation}

\begin{equation}
	\bm b_{\varphi_j}^{T} = \frac{\bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]( [\bm{\tilde{l}_j}]+ [\bm{\tilde{d}}])}{ l_j^2 \cos^2(\vartheta_j)}
	\label{eq:BSM5}
\end{equation}

\begin{multline}
	c_{\varphi_j} = \frac{1}{m_j l_j^2 \cos^2(\vartheta_j)}\Big\{-m_{j} \bm{\hat{p}}_{0_j,3}^{T} [\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}+\bm{\hat{p}}_{0_j,3}^T \bm{L}_{T,j}\\+2m_j l_j^2\dot{\varphi}_j\dot{\vartheta}\cos(\vartheta_j)\sin(\vartheta_j)- m_j \bm{\hat{p}}_{0_j,3}^T [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg]\Big\}
	\label{eq:BSM6}
\end{multline}
Doing the same for eq. \eqref{eq:FSE7}

\begin{multline}
	\ddot{\vartheta}_j
	=\frac{1}{m_j l_j^2}\Big\{m_{j}\bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]( [\bm{\tilde{l}_j}] + [\bm{\tilde{d}}])\bm{\dot{\omega}}_{B/N}
	-m_{j} \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N}-m_{j} \bm{\hat{p}}_{0_j,2}^{'T}[\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}\\+\bm{\hat{p}}_{0_j,2}^{'T} \bm{L}_{T,j}-m_j l_j^2\dot{\varphi}_j^2\cos(\vartheta_j)\sin(\vartheta_j)- m_j \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg]\Big\}
	\label{eq:BSM7}
\end{multline}

\begin{equation}
	\ddot \vartheta_j =\frac{1}{m_j l_j^2} \Big(m_{j}\bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]([\bm{\tilde{l}_j}] + [\bm{\tilde{d}}])\bm{\dot{\omega}}_{B/N}
	-m_{j} \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}] \bm{\ddot{r}}_{B/N} + a_{\vartheta_j} \Big)
	\label{eq:BSM8}
\end{equation}
Writing this a different way

\begin{equation}
	\ddot \vartheta_j = \bm a_{\vartheta_j}^T \ddot{\bm r}_{B/N} + \bm b_{\vartheta_j}^T \dot{\bm\omega}_{\cal B/N} + c_{\vartheta_j}
	\label{eq:BSM9}
\end{equation}
Where

\begin{equation}
	\bm a_{\vartheta_j}^{T} = - \frac{ \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]}{ l_j^2}
	\label{eq:BSM10}
\end{equation}

\begin{equation}
	\bm b_{\vartheta_j}^{T} = \frac{\bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]( [\bm{\tilde{l}_j}] + [\bm{\tilde{d}}])}{ l_j^2}
	\label{eq:BSM11}
\end{equation}

\begin{multline}
	c_{\vartheta_j} = \frac{1}{m_j l_j^2}\Big\{-m_{j} \bm{\hat{p}}_{0_j,2}^{'T}[\bm{\tilde{l}_j}][\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{d}+\bm{\hat{p}}_{0_j,2}^{'T} \bm{L}_{T,j}-m_j l_j^2\dot{\varphi}_j^2\cos(\vartheta_j)\sin(\vartheta_j)\\- m_j \bm{\hat{p}}_{0_j,2}^{'T} [\bm{\tilde{l}_j}]\bigg[2[\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j'}+[\bm{\tilde{\omega}}_{\cal B/N}][\bm{\tilde{\omega}}_{\cal B/N}] \bm{l_j}\bigg] \Big\}
	\label{eq:BSM12}
\end{multline}

\subsubsection{Translation}

Plugging these definitions into the translation equation

\begin{multline}
	\ddot{\bm r}_{B/N}-[\tilde{\bm{c}}] \dot{\bm\omega}_{\cal B/N}-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\ddot{\varphi}_j \\+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\ddot{\vartheta}_j
	\bigg]= \ddot{\bm r}_{C/N} 	- 2[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	\\-[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	\\+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 \\+
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	\bigg]
	\label{eq:Rbddot4_bis}
\end{multline}
Results in

\begin{multline}
	\ddot{\bm r}_{B/N}-[\tilde{\bm{c}}] \dot{\bm\omega}_{\cal B/N}-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)(\bm a_{\varphi_j}^T \ddot{\bm{r}}_{B/N} + \bm b_{\varphi_j}^T \dot{\bm\omega}_{\cal B/N} +c_{\varphi_j}) \\ +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)(\bm a_{\vartheta_j}^T \ddot{\bm r}_{B/N} + \bm b_{\vartheta_j}^T \dot{\bm\omega}_{\cal B/N} + c_{\vartheta_j})
	\bigg]
	\\= \ddot{\bm r}_{C/N} 	- 2[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	-[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2\\
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2\\ +
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	\bigg]
	\label{eq:Rbddot5}
\end{multline}
Simplifying

\begin{multline}
	\Big\{[I_{3\times3}] -\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm a_{\varphi_j}^T +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm a_{\vartheta_j}^T \bigg]\Big\}\ddot{\bm r}_{B/N}
	+\Big\{-[\tilde{\bm{c}}] -\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm b_{\varphi_j}^T +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm b_{\vartheta_j}^T \bigg] \Big\}\dot{\bm\omega}_{\cal B/N}
	\\= \ddot{\bm r}_{C/N} 	- 2[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	-[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\frac{1}{m_{\text{sc}}}\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 \\+
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	-\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)c_{\varphi_j} - \Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big) c_{\vartheta_j}
	\bigg]
	\label{eq:Rbddot6}
\end{multline}
Multiply both sides by $m_{\text{sc}}$.

\begin{multline}
	\Big\{m_{\text{sc}}[I_{3\times3}] -\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm a_{\varphi_j}^T +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm a_{\vartheta_j}^T \bigg]\Big\}\ddot{\bm r}_{B/N}
	+\Big\{-m_{\text{sc}}[\tilde{\bm{c}}] -\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm b_{\varphi_j}^T +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm b_{\vartheta_j}^T \bigg] \Big\}\dot{\bm\omega}_{\cal B/N}
	\\= m_{\text{sc}}\ddot{\bm r}_{C/N} - 2m_{\text{sc}}[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	-m_{\text{sc}}[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	-\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 \\+
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	-\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)c_{\varphi_j} - \Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big) c_{\vartheta_j}
	\bigg]
	\label{eq:Rbddot7}
\end{multline}

\subsubsection{Rotation}

Same thing for rotation:

\begin{multline}
	m_{\text{sc}}[\tilde{\bm{c}}]\ddot{\bm r}_{B/N}+[I_{\text{sc},B}] \dot{\bm\omega}_{\cal B/N}  - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)(\bm a_{\varphi_j}^T \ddot{\bm{r}}_{B/N} + \bm b_{\varphi_j}^T \dot{\bm\omega}_{\cal B/N}+c_{\varphi_j})
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\\+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)(\bm a_{\vartheta_j}^T \ddot{\bm r}_{B/N} + \bm b_{\vartheta_j}^T \dot{\bm\omega}_{\cal B/N} + c_{\vartheta_j})
	\bigg] = \\
	\bm{L}_B-[\bm{\tilde{\omega}}_{\cal B/N}] [I_{\text{sc},B}] \bm\omega_{\cal B/N}
	- [I'_{\text{sc},B}] \bm\omega_{\cal B/N}- \sum\limits_{j=1}^{N_P} m_j \Big\{[\tilde{\bm\omega}_{\cal B/N}] [\tilde{\bm{r}}_{P_{c,j}/B}] \bm{r}'_{P_{c,j}/B}\\
	+l_j[\tilde{\bm{r}}_{P_{c,j}/B}]\bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 +
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	\bigg]\Big\}
	\label{eq:Final6_1}
\end{multline}
Next

\begin{multline}
	\Big\{m_{\text{sc}}[\tilde{\bm{c}}] - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm a_{\varphi_j}^T
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\bm a_{\vartheta_j}^T
	\bigg]
	\Big\}\ddot{\bm r}_{B/N}
	+\Big\{[I_{\text{sc},B}] - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm b_{\varphi_j}^T
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}
	+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\bm b_{\vartheta_j}^T
	\bigg]
	\Big\}\dot{\bm\omega}_{\cal B/N}
	\\=
	\bm{L}_B-[\bm{\tilde{\omega}}_{\cal B/N}] [I_{\text{sc},B}] \bm\omega_{\cal B/N}
	- [I'_{\text{sc},B}] \bm\omega_{\cal B/N}- \sum\limits_{j=1}^{N_P} m_j \Big\{[\tilde{\bm\omega}_{\cal B/N}] [\tilde{\bm{r}}_{P_{c,j}/B}] \bm{r}'_{P_{c,j}/B}
	\\+l_j[\tilde{\bm{r}}_{P_{c,j}/B}]\bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 +
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1} \\-2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	- \Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1} -\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)c_{\varphi_j} \\-   \Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big) c_{\vartheta_j}
	\bigg]\Big\}
	\label{eq:Final7}
\end{multline}

\subsubsection{Remaining Back-substitution Steps}

The following definitions can be defined:

\begin{multline}
	[A] = \Big\{m_{\text{sc}}[I_{3\times3}] -\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm a_{\varphi_j}^T \\ +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm a_{\vartheta_j}^T \bigg]\Big\}
\end{multline}

\begin{multline}
	[B] = 	\Big\{-m_{\text{sc}}[\tilde{\bm{c}}] -\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm b_{\varphi_j}^T\\ +\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big)\bm b_{\vartheta_j}^T \bigg] \Big\}
\end{multline}

\begin{multline}
	[C] = \Big\{m_{\text{sc}}[\tilde{\bm{c}}] - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm a_{\varphi_j}^T \\
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\bm a_{\vartheta_j}^T
	\bigg]
	\Big\}
\end{multline}

\begin{multline}
	[D] = \Big\{[I_{\text{sc},B}] - \sum\limits_{j=1}^{N_P}m_j l_j [\tilde{\bm{r}}_{P_{c,j}/B}] \bigg[
	\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\bm b_{\varphi_j}^T \\
	+\Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}
	+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\bm b_{\vartheta_j}^T
	\bigg]
	\Big\}
\end{multline}

\begin{multline}
	\bm v_{\text{trans}} = m_{\text{sc}}\ddot{\bm r}_{C/N} - 2m_{\text{sc}}[\tilde{\bm\omega}_{\cal B/N}] \bm c'
	-m_{\text{sc}}[\tilde{\bm\omega}_{\cal B/N}][\tilde{\bm\omega}_{\cal B/N}]\bm{c}
	\\-\sum_{j=1}^{N_{P}}m_j l_j \bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 +
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\ -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	-\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)c_{\varphi_j}\\ - \Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big) c_{\vartheta_j}
	\bigg]
\end{multline}

\begin{multline}
	\bm v_{\text{rot}} = 	\bm{L}_B-[\bm{\tilde{\omega}}_{\cal B/N}] [I_{\text{sc},B}] \bm\omega_{\cal B/N}
	- [I'_{\text{sc},B}] \bm\omega_{\cal B/N}\\- \sum\limits_{j=1}^{N_P} m_j \Big\{[\tilde{\bm\omega}_{\cal B/N}] [\tilde{\bm{r}}_{P_{c,j}/B}] \bm{r}'_{P_{c,j}/B}
	+l_j[\tilde{\bm{r}}_{P_{c,j}/B}]\bigg[
	\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1} -\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j^2
	\\+\Big(-\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1}-\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\sin(\vartheta_j)\bm{\hat{p}}_{0_j,3} \Big)\dot{\vartheta}_j^2 +
	\Big(2\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}\\ -2\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)\dot{\varphi}_j\dot{\vartheta}_j
	-\Big(\sin(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,1} -\cos(\varphi_j)\cos(\vartheta_j)\bm{\hat{p}}_{0_j,2}\Big)c_{\varphi_j} \\-   \Big(\cos(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,1}+\sin(\varphi_j)\sin(\vartheta_j)\bm{\hat{p}}_{0_j,2}+\cos(\vartheta_j)\bm{\hat{p}}_{0_j,3}\Big) c_{\vartheta_j}
	\bigg]\Big\}
\end{multline}

Therefore the translation and rotation EOMs are written in the following form

\begin{equation}
	\begin{bmatrix}
		[A] & [B]\\
		[C] & [D]
	\end{bmatrix} \begin{bmatrix}
		\ddot{\bm r}_{B/N}\\
		\dot{\bm\omega}_{\cal B/N}
	\end{bmatrix} = \begin{bmatrix}
		\bm v_{\text{trans}}\\
		\bm v_{\text{rot}}
	\end{bmatrix}
\end{equation}

Solving the system-of-equations by

\begin{equation}
	\dot{\bm\omega}_{\cal B/N} = \Big([D] - [C]][A]^{-1}[B]\Big)^{-1}(\bm v_{\text{rot}} - [C][A]^{-1}\bm v_{\text{trans}})
	\label{eq:finalsystemomega}
\end{equation}

\begin{equation}
	\ddot{\bm r}_{B/N} = [A]^{-1} (\bm v_{\text{trans}} - [B]\dot{\bm\omega}_{\cal B/N})
	\label{eq:finalsystemr}
\end{equation}

Now the other state variables can be solved using Eqs. \eqref{eq:BSM3} and \eqref{eq:BSM9}:

\begin{equation}
	\ddot{\varphi}_j  = \bm a_{\varphi_j}^T \ddot{\bm{r}}_{B/N} + \bm b_{\varphi_j}^T \dot{\bm\omega}_{\cal B/N} +c_{\varphi_j}
\end{equation}

\begin{equation}
	\ddot \vartheta_j = \bm a_{\vartheta_j}^T \ddot{\bm r}_{B/N} + \bm b_{\vartheta_j}^T \dot{\bm\omega}_{\cal B/N} + c_{\vartheta_j}
\end{equation}\\
\subsection{Rotational Kinetic Energy}
The total rotational kinetic energy (i.e. kinetic energy about the center of mass) of
the spacecraft is:
\begin{equation}
	T_{rot}=\frac{1}{2}\bm\omega_{\cal B/N}^T [I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+\frac{1}{2}m_{\text{hub}}\bm{\dot{r}}_{B_c,C}\cdot\bm{\dot{r}}_{B_c,C}+\sum\limits_{j=1}^{N_P} \frac{1}{2} m_j \bm{\dot{r}}_{P_{c,j}/C}\cdot\bm{\dot{r}}_{P_{c,j}/C}
	\label{eq:RKE1}
\end{equation}
Expanding these terms results in
\begin{equation}
	T_{rot}=\frac{1}{2}\bm\omega_{\cal B/N}^T [I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+\frac{1}{2}m_{\text{hub}}(\bm{\dot{r}}_{B_c,B}-\bm{\dot{c}})\cdot(\bm{\dot{r}}_{B_c,B}-\bm{\dot{c}})+\sum\limits_{j=1}^{N_P} \frac{1}{2} m_j (\bm{\dot{r}}_{P_{c,j}/B}-\bm{\dot{c}})\cdot(\bm{\dot{r}}_{P_{c,j}/B}-\bm{\dot{c}})
	\label{eq:RKE2}
\end{equation}
Expanding further
\begin{multline}
	T_{rot}=\frac{1}{2}\bm\omega_{\cal B/N}^T [I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+\frac{1}{2}m_{\text{hub}}(\bm{\dot{r}}_{B_c,B}\cdot\bm{\dot{r}}_{B_c,B}-2\bm{\dot{r}}_{B_c,B}\cdot\bm{\dot{c}}+\bm{\dot{c}}\cdot\bm{\dot{c}})\\+\sum\limits_{j=1}^{N_P} \frac{1}{2} m_j (\bm{\dot{r}}_{P_{c,j}/B}\cdot\bm{\dot{r}}_{P_{c,j}/B}-2\bm{\dot{r}}_{P_{c,j}/B}\cdot\bm{\dot{c}}+\bm{\dot{c}}\cdot\bm{\dot{c}})
	\label{eq:RKE3}
\end{multline}
Combining like terms results in
\begin{multline}
	T_{rot}=\frac{1}{2}\bm\omega_{\cal B/N}^T [I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+\frac{1}{2}m_{\text{hub}}\bm{\dot{r}}_{B_c,B}\cdot\bm{\dot{r}}_{B_c,B}+\sum\limits_{j=1}^{N_P} \frac{1}{2} m_j \bm{\dot{r}}_{P_{c,j}/B}\cdot\bm{\dot{r}}_{P_{c,j}/B}\\-\bigg[m_{\text{hub}}\bm{\dot{r}}_{B_c,B}+\sum\limits_{j=1}^{N_P} m_j \bm{\dot{r}}_{P_{c,j}/B}\bigg]\cdot\bm{\dot{c}}+\frac{1}{2}\bigg[m_{\text{hub}}+\sum\limits_{j=1}^{N_P} m_j \bigg]\bm{\dot{c}}\cdot\bm{\dot{c}}
	\label{eq:RKE3_1}
\end{multline}
Performing a final simplification yields
\begin{equation}
	T_{rot}=\frac{1}{2}\bm\omega_{\cal B/N}^T [I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+\frac{1}{2}m_{\text{hub}}\bm{\dot{r}}_{B_c,B}\cdot\bm{\dot{r}}_{B_c,B}+\sum\limits_{j=1}^{N_P} \frac{1}{2} m_j \bm{\dot{r}}_{P_{c,j}/B}\cdot\bm{\dot{r}}_{P_{c,j}/B}-\frac{1}{2}m_{SC}\bm{\dot{c}}\cdot\bm{\dot{c}}
	\label{eq:RKE4}
\end{equation} \\
\subsection{Rotational Angular Momentum}
The total rotational angular momentum of the spacecraft about point C is
\begin{equation}
	\bm{H}_{rot,C}=[I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+m_{\text{hub}}\bm{r}_{B_c,C}\times\bm{\dot{r}}_{B_c,C}+\sum\limits_{j=1}^{N_P}  m_j \bm{r}_{P_{c,j}/C}\times\bm{\dot{r}}_{P_{c,j}/C}
	\label{eq:RAM1}
\end{equation}
Expanding these terms yields
\begin{equation}
	\bm{H}_{rot,C}=[I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+m_{\text{hub}}(\bm{r}_{B_c,B}-\bm{c})\times(\bm{\dot{r}}_{B_c,B}-\bm{\dot{c}})+\sum\limits_{j=1}^{N_P}  m_j (\bm{r}_{P_{c,j}/B}-\bm{c})\times(\bm{\dot{r}}_{P_{c,j}/B}-\bm{\dot{c}})
	\label{eq:RAM2}
\end{equation}
Distributing this result
\begin{multline}
	\bm{H}_{rot,C}=[I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+m_{\text{hub}}(\bm{r}_{B_c,B}\times\bm{\dot{r}}_{B_c,B}-\bm{r}_{B_c,B}\times\bm{\dot{c}}-\bm{c}\times\bm{\dot{r}}_{B_c,B}+\bm{c}\times\bm{\dot{c}})\\+\sum\limits_{j=1}^{N_P} m_j (\bm{r}_{P_{c,j}/B}\times\bm{\dot{r}}_{P_{c,j}/B}-\bm{r}_{P_{c,j}/B}\times\bm{\dot{c}}-\bm{c}\times\bm{\dot{r}}_{P_{c,j}/B}+\bm{c}\times\bm{\dot{c}})
	\label{eq:RAM3}
\end{multline}
Simplifying this result yields the final equation
\begin{equation}
	\bm{H}_{rot,C}=[I_{\text{hub},B_c}] \bm\omega_{\cal B/N}+m_{\text{hub}}\bm{r}_{B_c,B}\times\bm{\dot{r}}_{B_c,B}+\sum\limits_{j=1}^{N_P} m_j \bm{r}_{P_{c,j}/B}\times\bm{\dot{r}}_{P_{c,j}/B}-m_{SC}\bm{c}\times\bm{\dot{c}}
	\label{eq:RAM4}
\end{equation}
\subsection{Reference System Change}

As we can see in Eqs. \eqref{eq:BSM4}, \eqref{eq:BSM5} and \eqref{eq:BSM6}, the problem is singular for $\vartheta=\pi/2+k\pi, (k=0,1,2...)$. In order to solve this issue, a rotation of the pendulum frame, $\mathcal{P}_{0,j}$, is necessary. This rotation is performed when $\vartheta_j$ reaches a value multiple of $\pi/4$, to remain always far enough from the singularity. The new pendulum frame $\mathcal{P}_{0,j}^{\text{new}}$ is obtained with a rotation of the actual value of $\varphi$ around the $\bm{\hat{p}}_{3,j}$ axes, and of $\vartheta$ around $\bm{\hat{p}}_{2,j}'$ axes. This would lead to a new pendulum reference frame with $\bm{\hat{p}}_{1,j}^{\text{new}}$ aligned along the pendulum direction. The Fig. \ref{fig:newreferencesystem} shows the $\mathcal{P}_{0,j}^{\text{new}}$ respect to $\mathcal{P}_{0,j}$.
\begin{figure}[ht]
	\centering
	\includegraphics[width=13cm]{Figures/referencesystemsP0.pdf}
	\caption{$\mathcal{P}_{0,j}^{\text{new}}$ frame definition}
	\label{fig:newreferencesystem}
\end{figure}
At this point is easy to see that the new value of $\varphi_j$ and $\vartheta_j$ are equal to 0. To compute the new value of $\dot{\varphi}_j$ and $\dot{\vartheta}_j$, Eq. \eqref{eq:ljprime} is reversed and it yields:
\begin{equation}
	\dot{\varphi}=\frac{\bm{l}_j[2]}{l_j}
	\label{eq:RSC1}
\end{equation}
\begin{equation}
	\dot{\vartheta}=-\frac{\bm{l}_j[3]}{l_j}
	\label{eq:RSC2}
\end{equation}
The integration can continue using these new values and the new reference systems. This would lead to discontinuities on $\varphi_j$, $\theta_j$, $\varphi_j$ and $\vartheta_j$ but not on the vectors $\bm{l}_j$ and $\bm{l}_{j}'$.


\subsection{Algorithm 1:  Combinatorial Blocking}

The first algorithm uses additional unmodified delta debugging passes, but
``blocks'' them from producing the same reduced test.  Given test $t$
that reduces to $r$, we compute all subsets of components of $r$,
$C_r$.  The set of reduced tests is then computed by running delta
debugging starting with each $t-c$ that fails, where $c \in C_r$: $c$
is the blocked components of $r$.  So long as even one component is
blocked, it is impossible to reproduce the same $r$.  The intuition
is that to find a reduced failing test that exhibits a different fault
than $r$, we want to run delta debugging in such a way as to produce a
test as different as possible from $r$; ideally we would like a
reduced test sharing no components with $r$.  However, $r$ will likely contain
components that must appear in any failing test:  for example,
calls to {\tt mount} appear in all useful file system tests,
and interesting XML files seldom lack the {\tt <} character.
Therefore, rather than ``blocking'' all components of $r$, we try
delta debugging with different sets of components blocked.

In practice, iterating through all subsets may be too expensive if $r$
is large.  We therefore make an assumption:  if $t-c_1$ does not fail,
and $c_1 \subset c_2$, then $t-c_2$ also does not fail.  The blocking
algorithm begins its search by blocking all single components of $r$,
then proceeds to all combinations of 2 components, etc., at each stage
only considering combinations that contain no combination that did not
yield a failing test.  With this optimization, the expense of blocking
becomes low enough to also apply the approach to the new
reduced tests found at each stage.  To block all previously discovered
reductions, it is neccessary to compute combinations that include at
least one component from each reduced test produced thus far.

 Algorithm \ref{comb-block} shows
the formal definition of the algorithm, which we refer to as {\tt
  comb-block} (combinatorial blocking).  This algorithm depends on a
function {\tt block-all ($T$,$s$)}, which given a set of tests $T$ and
a combination size $s$,  returns all combinations of components of tests $t
\in T$ of size $s$ such that each combination has at least one element
from each $t \in T$.  We omit the definition of {\tt block-all} in
the interests of space.

\begin{algorithm}
\caption{}
\label{comb-block}
\begin{algorithmic}[1]
\Require{failing test $t$, reduced failing test $r$, search depth
  $d$, max combinations to consider $m$}
\State {reductions = \{$r$\}}
\State {handled = $\emptyset$}
\State {notfailed = $\emptyset$}
\State {count = 0}
\While {$d$ > 0}
\State{new = $\emptyset$}
\For {$s$ = 1 to total components in reductions}
\For {$c \in$ {\tt block-all}(reductions-handled, $s$)}
\State {count = count + 1}
\If {count > $m$}
\Return {reductions}
\EndIf
\State {handled = handled $\cup$ \{$c$\}}
\If {$c \not\in$ notfailed}
\If {fails($t-c$)}
\State{new = new $\cup$ \{\tt{ddmin}($t-c$)\}}
\Else
\State{notfailed = notfailed $\cup$ \{$c$\}}
\EndIf
\EndIf
\EndFor
\EndFor
\State{$d$ = $d - 1$}
\State{reductions = reductions $\cup$ new}
\EndWhile
\State {return reductions}
\end{algorithmic}
\end{algorithm}


%!TEX root = thesis.tex

\chapter{I-POMDPs for Object Detection}
\label{ch:IPOMDP}
The problem of object detection can be formulated as an I-POMDP using the game ``Where's Waldo?'' as an example. This example is presented in \cite{Butko2010b}. The goal of the game is to find a person, Waldo, in an illustrated image full of people and objects that have similar appearance as Waldo himself. For the evaluation we assume we have a detector that recognizes Waldo but the people and objects that are similar to Waldo act as noise in the detector.

From the agent's point of view, the goal in the ``Where's Waldo?'' game is to find Waldo in an image by fixating on different parts of the image using as few fixations as possible. To accomplish that the agent needs to learn a good policy. The policy determines which part of the image the agent fixates on in every time step and the number of fixations needed to find Waldo gives a measure of how well the policy performs. The part of the image that Waldo occupies is the state of the world and we assume that Waldo doesn't move so the state never changes. The agent's belief for each state is  the probability of Waldo being in that state, i.e. positioned in that part of the image, given previous observations and actions.

In this chapter we describe the problem specific models that were implemented and used for evaluation of the ``Where's Waldo?'' problem.

\section{Observation Model}
\label{sec:ObservationModelImpl}
Two different observation models are used for the evaluation. The first one is a model where the agent's ability to distinguish between a signal from an object and noise decays exponentially from the point where the agent is focusing. This observation model is
\begin{equation}\label{eq:ObservationModel}
  \begin{split}
    O_t^j &= \delta (S_t, j) d_{j,k} + Z_t^j \\
          &= \begin{cases}
                d_{j,k} + Z_t^j & \text{if $S_t = j$}\\
                Z_t^j           & \text{otherwise}
             \end{cases}
  \end{split}
\end{equation}
where $Z_t^j$ is zero mean, unit variance Gaussian random noise (i.e. white noise) and
\begin{equation}
  d_{j,k} = 3 \cdot e^{-dist(j,k)}
\end{equation}
where $dist(j,k)$ is the Euclidean distance between locations $j$ and $k$.

We will call this model the \emph{Exponential model}. An example of how this vision system sees an image (without noise) can be seen in Figure \ref{fig:ObsmodelExp}.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=1\textwidth]{figures/obsmodel_exp}
  \caption{A vision system with an exponential decay of focus. The agent focuses on the center of the image and the the focus point is the most reliable one. The ability to distinguish between noise and a signal from an object decreases with the distance from the agent's focus point.}
  \label{fig:ObsmodelExp}
\end{figure}

The second model is a model of the properties of the human eye. This model takes the same form as the exponential model in equation \eqref{eq:ObservationModel} but now $d_{j,k}$ is as described in \cite{Najemnik2005}.

We will call this model the \emph{Human eye model}. An example of how this vision system sees an image (without noise) can be seen in Figure \ref{fig:ObsmodelCont}.

\begin{figure}[!htp]
  \centering
  \includegraphics[width=1\textwidth]{figures/obsmodel_cont}
  \caption{A vision system with the characteristics modeled after the human eye. The agent focuses on the center of the image and is able to distinguish between noise and a signal from an object in and around the center. The reliability of the vision drops dramatically in locations further away from the agent's focus point.}
  \label{fig:ObsmodelCont}
\end{figure}

\section{Observation Likelihood}
\label{sec:ObservationLikelihoodImpl}
We assume that given an image, individual observations (i.e. each pixel or cell)
\begin{equation}
  o_t = (o_t^1, \dotsc, o_t^{|\mathcal{S}|})
\end{equation}
are conditionally independent. Then we can write the probability of an observation as
\begin{subequations}
  \begin{align}
    p(o_t | S_t = i, A_t = k)
      &= \prod_j p(o_t^j | S_t = i, A_t = k) \\
      &= p(o_t^i | S_t = i, A_t = k) \prod_{j \neq i} p(o_t^j | S_t = i, A_t = k) \\
      \intertext{Given the observation model from equation \eqref{eq:ObservationModel} we get}
      &= \gaussianexp{o_t^i - d_{i,k}} \prod_{j \neq i} \gaussianexp{o_t^j} \\
      &= \frac{1}{\sqrt{2\pi}} \frac{\gaussianexppart{o_t^i - d_{i,k}}}{\gaussianexppart{o_t^i}} \prod_j \gaussianexp{o_t^j} \\
      &= \frac{\gaussianexppart{o_t^i - d_{i,k}}}{\gaussianexppart{o_t^i}} Z \\
      &= \exp((o_t^i - \frac{d_{i,k}}{2}) d_{i,k}) K
  \end{align}
\end{subequations}
where $K$ is a constant. Ignoring the constant $K$ and terms not containing $o_t^i$ we can write
\begin{equation}
\label{eq:ProportionalObservationLikelihood}
  p(o_t | S_t = i, A_t = k) \propto \exp{(d_{i,k} o_t^i)}
\end{equation}
and this is the way the observation likelihood has been implemented.

\section{Proportional Belief Updates}
\label{sec:ProportinalBeliefUpdates}
We can combine equation \eqref{eq:UpdateBeliefFixedTarget} for the belief updates with equation \eqref{eq:ProportionalObservationLikelihood} for the proportional observation likelihood and then we get
\begin{equation}
  b_{t+1}^i \propto \exp{(d_{i,k} o_t^i)} b_t^i
\end{equation}
which enables us to calculate the updated belief proportionally. The belief vector can then be normalized after every update to make sure
\begin{equation}
  \sum_i{b_{t+1}^i} = 1
\end{equation}
holds.


\documentclass[main.tex]{subfiles}
\begin{document}

\subsubsection{Locking and alignment}

So far, we have always assumed that the cavity is at resonance.

\marginpar{Monday\\ 2020-5-11, \\ compiled \\ \today}

We have an issue if noise is strong enough to move our mirrors out of lock, even if we do not care to observe GW at the frequency of that noise.

Our cavities have a finesse of \(\mathcal{F} \sim 500\), and the free spectral range will be of the order of \(c / 2L \sim \SI{50}{kHz}\).
This means that the FWHM of the peaks will be of the order of \(\text{FWHM} \approx \text{FSR} / \mathcal{F} \approx \SI{100}{Hz} = \Delta f\).

If the variation of the frequency is due to a variation of the length of the cavity then the relative variations will be equal (at least to the linear level): \(\Delta L / L = \Delta f / f\), which means that, \emph{at the very least}, we will need to control the length of the cavity to the order of
%
\begin{align}
\Delta L = L \frac{ \Delta f}{f} \approx \SI{e-9}{m}
\,.
\end{align}

In reality, we are able to control arm lengths to within \SI{e-15}{m} (root-mean-square of the position variation).
There are many sources of noise in this respect: the seismic motion of the ground, the moon's pull, the intrinsic laser noise.
Fortunately, there is a technique we can use to \textbf{keep} the cavity locked onto the wavelength of the laser.

The first thing we might try is to measure the transmitted intensity of the laser light from the FP cavity to check whether the length is the correct one.
This has two issues: if the power decreases we cannot tell whether the cavity is slightly too \emph{long} or too \emph{short}; also, we cannot distinguish an intensity fluctuation due to a length imperfection from an intrinsic fluctuation of the laser.

The solution is the \textbf{Pound-Drever-Hall} technique: an electro-optical modulator is used in order to insert sidebands at \(\omega_{l} \pm \Omega \) by doing phase modulation.
These can be used as oscillators which detect any departure from resonance: they are \emph{not} at resonance in the cavity, so while a length fluctuation of the cavity affect the carrier frequency a lot, it leaves them basically unchanged.
So, we see a term oscillating at \(\Omega \) whose amplitude is linear in \(\Delta \phi \), measuring it we can tell the sign of the length variation, and we can distinguish it from a laser power oscillation.

If we know this, we can then actuate the cavity to follow the laser.

Also, we need actuators to control the beam position: the angular control we need in order to prevent noise is of the order of \SI{e-9}{rad}.

\subsubsection{Antenna pattern}

The antenna pattern of the interferometer is described by the \textbf{detector tensor} \(D_{ij}\), which transforms the perturbation \(h_{ij}\) into the observed time-dependent scalar as \(h (t) = D_{ij} h_{ij}(t)\). It is given by
%
\begin{align}
D_{ij} = \frac{1}{2} \qty(\hat{x}_{i} \hat{x}_{j} - \hat{y}_{i} \hat{y}_{j})
\,,
\end{align}
%
so the output of the detector will look like
%
\begin{align}
h(t) = \frac{1}{2} \qty(\ddot{h}_{xx} - \ddot{h}_{yy})
\,,
\end{align}
%
as long as the arms are aligned with the \(\hat{x}\) and \(\hat{y}\) axes.
Note that this is similar to the antenna pattern of the resonant bar, but now we have two arms, as opposed to the single ``arm'' we had in that case.
% The function \(D_{ij}\) describes the sensitivity of our detector in different directions.

% These kinds of detectors return a scalar (a timeseries, yes, but a scalar with respect to 3D space). This scalar will be linear in the tensor \(h_{ij}\), so we can express the observation as
% %
% \begin{align}
% h(t) = D_{ij} h_{ij} (t)
% \,.
% \end{align}

We must perform a rotation with two angles \(\phi \) and \(\theta \) to go from the orthogonal frame of the source and the orthogonal frame of the detector: it will look like
%
\begin{align}
R = \left[\begin{array}{ccc}
\cos \phi  & \sin \phi  & 0 \\
- \sin \phi  & \cos \phi  & 0 \\
0 & 0 & 1
\end{array}\right]
\left[\begin{array}{ccc}
\cos \theta  & 0 & \sin \theta  \\
0 & 1 & 0 \\
-\sin \theta  & 0 & \cos \theta
\end{array}\right]
\,,
\end{align}
%
\todo[inline]{Missing ones in the rotation matrices in the slides.}
and applying it (twice, once for each index of the perturbation tensor) we will find
%
\begin{align}
h_{xx} &= h_{+} \qty(\cos^2\theta  \cos^2\phi - \sin^2 \phi ) + 2 h_{\times } \cos \theta \sin \phi \cos \phi   \\
h_{yy} &= h_{+} \qty(\cos^2\theta \cos^2\phi  - \cos^2\phi )
- 2 h_{\times}  \cos \theta \sin \phi \cos \phi
\,,
\end{align}
%
so the output timeseries will look like
%
\begin{align}
h(t) &=  F_{+} (\theta, \phi ) h_{+} + F_\times (\theta , \phi ) h_{\times }  \\
F_{+} (\theta, \phi ) &= \frac{1}{2} \qty(1 + \cos^2 \theta ) \cos 2 \phi  \\
F_{\times} (\theta, \phi ) &= \cos \theta \sin 2 \phi
\,.
\end{align}

We have no way to distinguish these two components if we only have one detector; we must compare the outputs of different ones.

\subsection{The interferometer's noise budget}

The main sources of noise in the interferometer are
\begin{enumerate}
    \item \textbf{quantum noise}: it is not actually fundamental, we can decrease it by clever design;
    \item \textbf{seismic noise}: ground vibrations, this can be suppressed with better suspensions;
    \item \textbf{gravity gradients}: this is also a metric perturbation, so it is the hardest to work around, it is fundamental in a way;
    \item \textbf{thermal noise}, especially in the mirror coatings (which are exposed to hundreds of \SI{}{kW} of laser power!) is currently a big limiting factor.
\end{enumerate}

% The noise is dominated by the quantum noise, quantum fluctuations of the laser light.
% The other source of noise giving us problems in the \SI{100}{Hz} region is the coating Brownian noise.

At high frequencies, the problem is that it is hard to measure small displacements with small integration time.
At low frequencies, the problem is that the mirrors move too much.

\subsubsection{Quantum noise}

The \textbf{shot noise} is the error in the count of photons --- this is a Poisson process, since the photon arrivals are uncorrelated (the autocorrelation function is a \(\delta (t)\), the power spectrum is flat).
The power seen at the beamsplitter in an observation time \(T\) will look like
%
\begin{align}
P_0  = \frac{N_\gamma \overline{h}\omega_{L}}{T} = \frac{\Delta E}{T}
\,.
\end{align}

Its square fluctuation will be given by
%
\begin{align}
\Delta P^2 = \frac{\Delta E^2}{T^2} =
\frac{\Delta N^2 \hbar^2 \omega_{l}^2}{T^2}
= N \frac{\hbar^2   \omega_{l}^2}{T^2}
= \frac{P_0 \hbar \omega_{l}}{T}
= \frac{1}{2} \int_{0}^{1/T} S_P (\omega) \dd{\omega }
= \frac{1}{2} \frac{S_P(\omega )}{T}
\,,
\end{align}
%
so we get \(S_P (\omega ) = 2 P_0 \hbar \omega_{l}\).
\todo[inline]{Wrong factor of 2 in the slides!}

Note that this is a power-PSD: it measures the average square \emph{power}, so it has the dimensions of a power squared over a frequency (\(\SI{}{W^2}/\SI{}{Hz} = \SI{}{W J}\)).

The output of the detector, \(\Delta \phi \), is proportional to \(P_0\)..
It can be shown that the contribution to the noise PSD of the phase due to shot noise will be
%
\begin{align}
\sqrt{S_{\Delta \phi , \text{ shot}} (\omega )}  =
\frac{C}{P_0 } \sqrt{S_{P} (\omega )} = C \sqrt{\frac{2 \hbar \omega_{l}}{P_0 }}
\,,
\end{align}
%
where \(C\) is a dimensionless constant of order 1, accounting for the working point and the photodetector efficiency.
We can refer this to the input by making use of the \(T_{FP}\) transfer function: we will then have
%
\begin{align}
\sqrt{S_{h, \text{ shot}}} = \frac{\sqrt{S_{\Delta \phi, \text{ shot}}}}{T_{FP}} =
\frac{c}{8 \mathcal{F} L} \sqrt{\frac{4 \pi \hbar c \lambda_{l}}{P_0 }}
\sqrt{1 + \qty( \frac{f_{GW}}{f_{p}})^2}
\,.
\end{align}

This then diminishes as we increase the effective length of the cavity.
So, one might say, why would we build a cavity which is several km long, instead of a tabletop experiment with a very high finesse? We shall answer shortly.

We also have \textbf{radiation pressure} noise, which scales differently: it is due to the fact that each photon impacting on the mirror gives it a bump of momentum \(2 \omega_{l} \hbar / c\).
With a reasoning not unlike the previous one we find
%
\begin{align}
\sqrt{S_{F, \text{ rp}}} = 2 \sqrt{\frac{2 P_0 \omega_{l}}{c^2}}
\,,
\end{align}
%
so the spectral density of the displacement of the mirror will be
%
\begin{align}
\sqrt{S_{x, \text{ rp}}} = \frac{2}{M \omega^2} \sqrt{\frac{2 P_0 \hbar \omega_{l}}{c^2}}
\,,
\end{align}
%
which means that the amplitude spectral density of the input will be
%
\begin{align}
\sqrt{S_{h, \text{ rp}}} = \frac{16 \sqrt{2} \mathcal{F}}{ML (2 \pi f_{GW})^2} \sqrt{\frac{P_0 \hbar}{2 \pi c^2 \lambda_{l}}} \frac{1}{\sqrt{1 + (f_{GW} / f_{p})^2}}
\,.
\end{align}

The interesting thing to note here is that this noise scales \emph{directly} with the finesse.
This answers the question: if we try to raise the finesse too much, the power inside the laser increases by a lot, and this creates a huge amount of radiation pressure noise on the mirrors.
The fact that we found a factor \(\mathcal{F}\) is due to the fact that a photon makes \(\mathcal{F} / 2 \pi \) bounces inside the cavity, creating noise for each.

So, we must reach a compromise for the finesse (or for the circulating power \(P_0 \)).

% The shot noise is flat in frequency, the RP noise decreases with frequency.
% At each frequency, we can define a Standard Quantum Limit, which is the lowest noise we could have at that frequency.
The shot noise is proportional to \(P_0^{-1/2}\), the radiation pressure noise is proportional to \(P_0^{1/2}\).
Their sum gives the total quantum noise, whose expression is
%
\begin{align}
\sqrt{S_{h, \text{qn}}} (f) = \frac{1}{L \pi f_0 }
\sqrt{\frac{\hbar}{M}}
\sqrt{\qty(1 + \frac{f^2}{f_p^2}) + \frac{f_0^{4}}{f^{4}} \frac{1}{1 + f^2 / f_p^2}}
\,,
\end{align}
%
where
%
\begin{align}
f_0 = \frac{4 \mathcal{F}}{\pi } \sqrt{\frac{P_0 }{\pi \lambda_{l} cM}}
\,.
\end{align}

The shot noise is flat in frequency (for \(f < f_p\)), while the radiation pressure noise decreases when frequency increases. By changing \(P_0 \) we can raise one and lower the other; for each frequency we have a minimum for the uantum noise, which is called the \textbf{Standard Quantum Limit}. This is given by minimizing the noise.
The optimal value for the frequency \(f_0 \) comes out to be the one satisfying
%
\begin{align}
1 + \frac{f^2}{f_p^2} = \frac{f_0^2}{f^2}
\,,
\end{align}
%
and the result for the SQL is
%
\begin{align}
\sqrt{S_{h, \text{ SQL}}} (f) = \frac{1}{2 \pi f L} \sqrt{\frac{8 \hbar}{M}}
\,.
\end{align}

Note that this limit can be reached for a specific, fixed frequency \(f\): we cannot achieve it for all the spectrum.

We can go below this limit using Quantum Vacuum Squeezing, in which we gain precision in the measurement of one variable (photon number) at the expense of another (phase).

\subsubsection{Thermal Noise}

We have contribution from all dissipation sources, be they mechanical or not.
There is thermo-elastic noise: as a material bends, the side which compresses heats up a little, while the side which expands cools a little.

The ultimate limit is the internal dissipation: by the fluctuation-dissipation theorem,
%
\begin{align}
S_{F, \text{ th}} = 4 k_B T \Re[Z(\omega )]
\,,
\end{align}
%
where \(Z(\omega )\) is the characteristic impedance of the system.

For the \textbf{mirror suspensions} we can have loss comparable to the seismic noise. If we use high-loss materials we get lots of noise, so we try to use low-loss materials like fused silica, which can reach quality factors like \(Q \sim \num{e9}\).
Lowering the temperature is also a thing to do: detectors are going cryogenic.

We also have \textbf{mirror coating Browian motion}: unfortunately, the multilayer coating of the dielectric mirrors is relatively high-loss.

The expression for this kind of noise is
%
\begin{align}
S_x (f, T) = \frac{2 k_B T}{\pi^2f} \frac{d}{w^2 Y} \phi \qty(\frac{Y'}{Y} + \frac{Y}{Y'})
\,,
\end{align}
%
where \(w\) is the beam radius, \(\phi \) is the coating mirror loss and \(d\) is the coating thickness.
\todo[inline]{what are the other variables? Eh.}
People are investigating techniques which could lower \(\phi \): new materials, heat treatment which could aid with the relaxation of the material, new layer structures, monolithic crystalline coatings.

We could also try to have larger mirrors and/or materials with higher optical contrast.

\subsubsection{Seismic noise}

The ground vibrations have a very large amplitude, of the order of \SI{e-6}{m}, which is about ten orders of magnitude larger than the precision we need.
Fortunately, most of it has a very low frequency compared to GW: human activity gives vibrations at around \SI{1}{Hz} to \SI{10}{Hz}, while the ``oceanic peak'' is at around \SI{.1}{Hz}.

Nevertheless, this pushes the mirrors out of alignment, so we need active stabilization.

The seismic noise which is in our band is more concerning, although its amplitude is lower than the peak of the seismic noise.
This might \textbf{mimic a signal}: we must suppress it.

We use a passive approach: a cascade of pendula, for each of them we get a transfer function
%
\begin{align}
H_{x_{n} \to x_{n+1}} (f) \sim \frac{1}{1 - f^2/f_0^2}
\qquad \text{where} \qquad
f_0 \sim \sqrt{ \frac{g}{l} } \sim \SI{1}{Hz}
\,,
\end{align}
%
so each pendulum acts as a high-pass filter: if \(f \gg f_0 \) (which is the case for the high-frequency seismic noise we want to eliminate) we get an attenuation \( \sim (f / f_0 )^{-2 \text{\# pendulums}}\). We use about 5 pendula, so very roughly this will be \(100^{2 \times 5}\).

\subsubsection{Newtonian noise}

This noise is about stochastic variations of the local gravitational field. Its main causes are seismic movements and variations in atmospheric pressure.
We cannot shield from it: it is a metric perturbation like the GW, we cannot distinguish them \emph{a priori}!

There are two main ways to deal with this:
\begin{enumerate}
    \item the active approach is to have many sensors detecting ground displacements and atmospheric pressure variations, model the expected disturbances and subtract this from the GW signal;
    \item the passive approach is to move the detector underground, where we do not need to worry about surface waves and atmospheric effects are reduced.
\end{enumerate}

\subsubsection{Quantum Vacuum Squeezing}

A good reference for this is Miao's PhD thesis \cite[sec.\ 2.8]{miaoExploringMacroscopicQuantum2010}.

We quantize the electromagnetic field:
%
\begin{align}
\hat{E} = u(x,y,z) \int_{0}^{\infty } \frac{ \dd{\omega }}{2 \pi }
\sqrt{\frac{2 \pi \hbar \omega }{\mathcal{A} c}}
\qty[ \hat{a}_{\omega } e^{ikz - i \omega t} + \hat{a}^\dag_{\omega } e^{-ikz + i \omega t}]
\,,
\end{align}
%
where \(\mathcal{A}\) is the beam area.
We will need creation and annihilation operators corresponding to the sidebands: \(\hat{a}_{\pm}= \hat{a}_{\omega_0 \pm\Omega }\), and we define
%
\begin{align}
\hat{a}_{1} = \frac{\hat{a}_{+} + \hat{a}^\dag_{-}}{\sqrt{2}}
\qquad \text{and} \qquad
\hat{a}_{2} = \frac{\hat{a}_{+} - \hat{a}^\dag_{-}}{i \sqrt{2}}
\,.
\end{align}

The state of the laser light is a \textbf{coherent state}; it is not an eigenstate of photon number, and it can be defined as
%
\begin{align}
\ket{\alpha } = \exp(\int \frac{ \dd[]{\Omega }}{2 \pi } \qty(\alpha _{\Omega } \hat{a} ^\dag_{\Omega } - \alpha^{*}_{\Omega } \hat{a}_{\Omega })) \ket{0 }
\,.
\end{align}

The \(\hat{a}_{1, 2}\) are the \emph{quadratures}. The product of their standard deviations \(S_{\hat{a}_{1, 2}} (\Omega )\) must be larger than a certain constant by Heisenberg, but we need not have a circular distribution: we can squeeze it in one direction and stretch it in the orthogonal one.

The result for the spectral density at the input is
%
\begin{align}
S^{h} (\Omega ) = \qty[\frac{S_{\hat{a}_2 (\Omega )}}{k} + k S_{\hat{a}_{1}} (\Omega )]\frac{h^2_{SQL}}{2}
\,,
\end{align}
%
which still does not allow us to beat the standard quantum limit: the bound is the same, although we can work on it without increasing the power which could be useful.

The trick comes from the fact that we can do \textbf{frequency-dependent} squeezing! The relation of \(\Delta \hat{a}_{1, 2}\) at a specific frequency is independent of that at another!

So, we can define
%
\begin{align}
\frac{\Delta \hat{a}_{1}}{\Delta \hat{a}_{2}} = k(\omega )
\,,
\end{align}
%
which allows us to get, if we do the rotation optimally:
%
\begin{align}
S^{h} (\Omega ) =   e^{-2r} \qty[ \frac{1}{k} + k] \frac{h^2_{SQL}}{2}
\,.
\end{align}

The way to \textbf{generate squeezed light} is through the use of nonlinear crystals (whose polarization has non-negligible terms depending on higher-than-linear powers of the field).

If we input into a nonlinear crystal a combination of a seed field at a frequency \(\omega \) and a pump field a \(2 \omega \), we can control the squeezing through their relative phase.

We can think of squeezing as generating correlations between the sidebands' oscillations.

% Qualitatively, we can say that we can make it so the qu
We can describe a fixed-frequency EM signal with two operators in QM, for example amplitude and phase.

A squeezed vacuum is a vacuum state whose fluctuations are asymmetric.
At low frequency, we want to squeeze amplitude, so that the radiation pressure is more predictable and we have less test mass motion; at high frequency we want to squeeze phase, so that the number of photons is more predictable.

\todo[inline]{Hold on though: different \textbf{GW} frequencies, not different laser frequencies! How can we change what we do for different GW frequencies before seeing the signal?}

\end{document}