\section*{Exercises}

\begin{ex}
  Find the (real or complex) eigenvalues and eigenvectors of the
  following matrices. Diagonalize each matrix if possible.
  \begin{equation*}
    A = \begin{mymatrix}{rr}
      2 & 1 \\
      -1 & 2 \\
    \end{mymatrix},
    \quad
    B = \begin{mymatrix}{rr}
      -1 & -2 \\
      1 &  1 \\
    \end{mymatrix},
    \quad
    C = \begin{mymatrix}{rrr}
      2   & -1  &  3  \\
      0   &  1  &  1  \\
      -1  &  1  &  0  \\
    \end{mymatrix},
    \quad
    D = \begin{mymatrix}{rrr}
      1  &  1 & 1 \\
      -1 &  2 & 0 \\
      1  & -1 & 1 \\
    \end{mymatrix}
  \end{equation*}
  \begin{sol}
    \begin{enumerate}
    \item The characteristic polynomial is
      $\eigenvar^2 -4\eigenvar + 5$, the eigenvalues are
      $\eigenvar_1 = 2+i$ and $\eigenvar_2 = 2-i$, and the
      corresponding basic eigenvectors are
      $\vect{v}_1 = \mat{1, i\,}^T$ and
      $\vect{v}_2 = \mat{1, -i\,}^T$, respectively. The matrix $A$ is
      diagonalizable as $A=PDP^{-1}$, where
      \begin{equation*}
        P = \begin{mymatrix}{cc}
          1 & 1 \\
          i & -i \\
        \end{mymatrix}
        \quad\mbox{and}\quad
        D = \begin{mymatrix}{cc}
          2+i & 0 \\
          0 & 2-i \\
        \end{mymatrix}.
      \end{equation*}
    \item The characteristic polynomial is $\eigenvar^2 + 1$, the
      eigenvalues are $\eigenvar_1=i$ and $\eigenvar_2=-i$, and the
      corresponding basic eigenvectors are
      $\vect{v}_1 = \mat{1-i, -1}^T$ and
      $\vect{v}_2 = \mat{1+i, -1}^T$, respectively. Therefore
      $B=PDP^{-1}$, where
      \begin{equation*}
        P = \begin{mymatrix}{cc}
          1-i & 1+i \\
          -1 & -1 \\
        \end{mymatrix}
        \quad\mbox{and}\quad
        D = \begin{mymatrix}{cc}
          i & 0 \\
          0 & -i \\
        \end{mymatrix}.
      \end{equation*}
    \item The characteristic polynomial is
      $x^2 -2x + 2 - (x^3 -2x^2 + 2x)$
      $-\eigenvar^3 - \eigenvar^2 + 2 =
      (1-\eigenvar)(\eigenvar^2-2\eigenvar+2)$.  The eigenvalues are
      $\eigenvar_1 = 1$, $\eigenvar_2 = 1+i$, and $\eigenvar_3 =
      1-i$. The corresponding basic eigenvectors are
      $\vect{v}_1 = \mat{1, 1, 0}^T$,
      $\vect{v}_2 = \mat{-1-2i, -i, 1}^T$,
      and $\vect{v}_2 = \mat{1+2i, i, 1}^T$,
      respectively. Therefore
      $C=PDP^{-1}$, where
      \begin{equation*}
        P = \begin{mymatrix}{ccc}
          1 & -1-2i & 1+2i \\
          1 &  -i   &  i   \\
          0 &   1   &  1   \\
        \end{mymatrix}
        \quad\mbox{and}\quad
        D = \begin{mymatrix}{ccc}
          1 &  0  &  0  \\
          0 & 1+i &  0  \\
          0 &  0  & 1-i \\
        \end{mymatrix}.
      \end{equation*}
    \item The characteristic polynomial is
      $-\eigenvar^3+4\eigenvar^2-5\eigenvar+2 =
      -(\eigenvar-1)(\eigenvar-1)(\eigenvar-2)$. Therefore the
      eigenvalues are $\eigenvar=1$ with algebraic multiplicity 2 and
      $\eigenvar=2$ with algebraic multiplicity 1. The eigenspace for
      $\eigenvar=1$ is $1$-dimensional; it is spanned by
      $\mat{1,1,-1}^T$. Since the geometric multiplicity of the
      eigenvalue $1$ is less than its algebraic multiplicity, the
      matrix is not diagonalizable, not even over the complex numbers.
    \end{enumerate}
  \end{sol}
\end{ex}

\begin{ex}
  I know a certain real $2\times 2$-matrix $A$. My matrix has complex
  eigenvalue $\eigenvar=1+2i$ and corresponding eigenvector
  $\vect{v}=\begin{mymatrix}{c}1\\i\end{mymatrix}$.
  \begin{enumerate}
  \item Find another eigenvalue and corresponding eigenvector of $A$.
  \item Diagonalize $A$.
  \item What is the secret matrix $A$?
  \end{enumerate}

  \begin{sol}
    \begin{enumerate}
    \item By Proposition~\ref{prop:conjugate-eigenvalues}, the other
      eigenvalue is $1-2i$ with corresponding eigenvector
      $\begin{mymatrix}{c} 1 \\ -i \end{mymatrix}$.
    \item From the eigenvalues and eigenvectors, we know that
      $A=PDP^{-1}$, where
      \begin{equation*}
        P = \begin{mymatrix}{cc}
          1 & 1 \\
          i & -i
        \end{mymatrix}
        \quad\mbox{and}\quad
        D = \begin{mymatrix}{cc}
          1+2i & 0 \\
          0 & 1-2i
        \end{mymatrix}.
      \end{equation*}
    \item $A = PDP^{-1} = \begin{mymatrix}{cc}
        1 & 2 \\
        -2 & 1 \\
      \end{mymatrix}$.
    \end{enumerate}
  \end{sol}
\end{ex}

\begin{ex}
  Solve the recurrence
    \begin{equation*}
    \begin{array}{l@{~}c@{~}l}
      a_0 &=& 0, \\
      a_1 &=& 1, \\
      a_{n+2} &=& 4a_{n+1} - 5a_n, \quad\mbox{for all $n\geq 0$.} \\
    \end{array}
  \end{equation*}
\end{ex}


\section{Exercises in Conditional Probability}\label{S:xsCondProb}

\begin{ExerciseList}

\Exercise
What gives the greater probability of hitting some target at least
  once:
\begin{enumerate}
\item  hitting in a shot with probability $\frac{1}{2}$ and firing 1 shot, or
\item hitting in a shot with probability $\frac{1}{3}$ and firing 2 shots?
\end{enumerate}
First guess. Then calculate.

\Answer
We can assume  that the first shot is independent of
the second shot so we can multiply the probabilities here.

For case A, there is only one shot so the probability of hitting at least once is $\frac{1}{2}$.

For case B, the probability of missing both shots is
$\frac{2}{3}\,\frac{2}{3}\,=\,\frac{4}{9}$,  so  the probability hitting some target at least once is
  \[ 1- \P(\text{missing the target both times})\;=\; 1-\frac{4}{9}\;=\;\frac{5}{9}\]
Therefore, case B has the greater probability of hitting the target at least once.

\Exercise
Suppose we independently roll two fair dice each of whose faces are marked by numbers
  $\sf 1$,$\sf 2$,$\sf 3$,$\sf 4$, $\sf 5$ and $\sf 6$.
\begin{enumerate}
\item List the sample space for the experiment if we note the   numbers
  on the 2 upturned faces.
\item What is the probability of obtaining a sum greater than 4 but less
  than 7?
\end{enumerate}

\Answer
\be
\item The sample space is
$$
\begin{aligned}
\{
\mathsf{(1,1),(1,2),(1,3),(1,4),(1,5),(1,6),\quad (2,1),(2,2),(2,3),(2,4),(2,5),(2,6),}\\
\mathsf{(3,1),(3,2),(3,3),(3,4),(3,5),(3,6),\quad (4,1),(4,2),(4,3),(4,4),(4,5),(4,6),}\\
\mathsf{(5,1),(5,2),(5,3),(5,4),(5,5),(5,6),\quad (6,1),(6,2),(6,3),(6,4),(6,5),(6,6)}
\}
\end{aligned}
$$
Note: Order matters here. For example, the outcome ``16'' refers to a ``1'' on the first die and a ``6'' on the second,
whereas the outcome ``61'' refers to a ``6'' on the first die and a ``1'' on the
second.

\item First tabulate all possible sums as follows:
$$
\begin{array}{c|cccccc}
+       &       1       &       2       &       3       &       4       &       5       &       6       \\\hline
1       &       2       &       3       &       4       &       \mathbf{5}      &       \mathbf{6}      &       7       \\
2       &       3       &       4       &       \mathbf{5}      &       \mathbf{6}      &       7       &       8       \\
3       &       4       &       \mathbf{5}      &       \mathbf{6}      &       7       &       8       &       9       \\
4       &       \mathbf{5}      &       \mathbf{6}      &       7       &       8       &       9       &       10      \\
5       &       \mathbf{6}      &       7       &       8       &       9       &       10      &       11      \\
6       &       7       &       8       &       9       &       10      &       11      &       12      \\
\end{array}$$
 Let $A$ be the event {\em the sum is 5} and $B$ be the event {\em
    the sum is 6}, then $A$ and $B$ are mutually exclusive events with
  probabilities \[\P(A) = \frac{4}{36} \quad \text{and}\quad \P(B) =
  \frac{5}{36} \,.\]
Therefore,
   $$\P(4<\textrm{sum }<7)\;=\; \P( A \cup B) \;=\; \P(A)\,+\,\P(B)\;=\; \frac{4}{36} +
\frac{5}{36} \;=\;\frac{1}{4}$$
\ee

\Exercise
Based on past experience, 70\% of students in a certain course pass the midterm test.
The final exam is passed by 80\% of those who passed the midterm test, but only by 40\% of those who fail the midterm test.
What fraction of students pass the final exam?

\Answer
First draw a tree  with the first split based on the outcome of the midterm test and the second on the outcome of the final exam.
Note that the probabilities involved in this second branch are {\em conditional} probabilities that depend on the outcome of the midterm test.
Let $A$ be the event that the student passes the final exam and let $B$ be the event that the student passes the midterm test.

\begin{center}
\begin{picture}(100,160)(75,30){\drawline(0,90)(75,120)(125,140)
\drawline(75,120)(125,100)\drawline(0,90)(75,60)(125,40)
\drawline(75,60)(125,80)
\put(55,125){$B$}\put(55,50){$B^c$}
\put(130,140){$A$\quad $\P(A \cap  B) = 0.56$}\put(130,100){$A^c$ \quad
  $\P(A^c\cap B)= 0.14$}
\put(130,80){$A$ \quad $\P(A\cap B^c) = 0.12$ }\put(130,40){$A^c$ \quad
  $\P(A^c\cap B^c)= 0.18$}
\put(100,137){0.8}\put(100,112){0.2}
\put(100,77){0.4}\put(100,52){0.6}
\put(30,110){0.7}\put(30,85){0.3}}
\put(40,165){Midterm}
\put(120,165){Final}
\end{picture}
\end{center}

Then the probability of passing the final exam is:
\[ \P(A)\;=\; 0.56\,+\,0.12\;=\;0.68\,.\]

To do this with formulae,  partitioning according to the midterm test
result  and using the multiplication rule, we get:
\begin{eqnarray*}
\P(A)&=& \P(A\cap B)+\P(A\cap B^c)\\
&=& \P(A|B)\P(B)+\P(A|B^c)\P(B^c)\\
&=& (0.8)(0.7)+(0.4)(0.3)\;=\;0.68
\end{eqnarray*}

\Exercise
A small brewery has two bottling machines.
Machine 1 produces 75\% of the bottles and machine 2 produces 25\%.
One out of every 20 bottles filled by machine 1 is rejected for some reason, while one out of every 30 bottles filled by machine 2 is rejected.
What is the probability that a randomly selected bottle comes from machine 1 given that it is accepted?
\Answer
Let $A$ be the event that bottles are produced by machine 1; and $A^c$ is the event that bottles are produced by machine 2.
$R$ denotes the event that the bottles are rejected; and $R^c$ denotes the event that the bottles are accepted.
We know the following probabilities:

\[ \P(A) \;=\; 0.75 \quad \text{and} \quad \P(A^c) \;=\; 0.25\]
\[ \P(R | A) \;=\; \frac{1}{20} \quad \text{and } \quad  \P(R^c | A) \;=\;
\frac{19}{20}\]

\[ \P(R | A^c) \;=\; \frac{1}{30} \quad \text{and} \quad  \P(R^c | A^c) \;=\;
\frac{29}{30}\]

We want $\P(A|R^c)$ which is give by
$$\P(A|R^c)\;=\;\frac{\P(R^c\cap A)}{\P(R^c)}\;=\;\frac{\P(R^c\cap A)}{\P(R^c\cap A)+\P(R^c\cap A^c)}$$
where, $$\P(R^c\cap A)\;=\;\P(R^c| A)\P(A)\;=\;\frac{19}{20}\times0.75$$
and, $$\P(R^c\cap A^c)\;=\;\P(R^c|A^c)\P(A^c)\;=\;\frac{29}{30}\times0.25$$
Therefore,
$$\P(A|R^c)\;=\;\frac{\frac{19}{20}\times0.75}{\frac{19}{20}\times
  0.75+\frac{29}{30}\times0.25}\;\approxeq \;0.747\quad $$\\[6pt]

The  tree diagram for this problem is:
\begin{center}
\begin{picture}(100,140)(75,30){\drawline(0,90)(75,120)(125,140)
\drawline(75,120)(125,100)\drawline(0,90)(75,60)(125,40)
\drawline(75,60)(125,80)
\put(60,120){$A$}
\put(60,50){$A^c$}
\put(130,140){$\mathsf{R}$}
\put(130,100){$\mathsf{R^c}$ \;\;$\P(A\cap R^c)= 0.75\times 19/20$}
\put(130,80){$\mathsf{R}$}
\put(130,40){$\mathsf{R^c}$ \;\;$\P(A^c\cap R^c)= 0.25\times 29/30$}
\put(90,140){$1/20$}\put(90,95){$19/20$}
\put(90,75){$1/30$}\put(90,35){$29/30$}
\put(30,110){$0.75$}\put(30,60){$0.25$}
\put(40,160){Machine 1}
\put(120,160){Rejection}
}
\end{picture}
\end{center}

So the required probability is
$$\P(A|R^c)\;=\;\frac{\P(R^c\cap A)}{\P(R^c)}\;=\;\frac{\frac{19}{20}\times0.75}{\frac{19}{20}\times
  0.75+\frac{29}{30}\times0.25}\;\approxeq \;0.747$$

\Exercise
A process producing micro-chips, produces 5\% defective, at random.
Each micro-chip is tested, and the test will correctly detect a defective one $4/5$ of the time, and if a good micro-chip is tested the test will declare it is defective with probability $1/10$.
\begin{itemize}
 \item[(a)]If a micro-chip is chosen at random, and tested to be good, what was the probability that it was defective anyway?
\item[(b)]If a micro-chip is chosen at random, and tested to be defective, what was the probability that it was good anyway?
\item[(c)]If 2 micro-chips are tested and determined to be good, what is
  the probability that at least one is in fact defective?
\end{itemize}
\Answer
Let  the event that a micro-chip is defective be $D$, and the event  that the test  is correct be  $C$.
So  the probability that the micro-chip is defective is $P(D)=0.05$, and the probability that it is effective is $P(D^c)=0.95$.

The probability that  the test correctly detects a defective micro-chip is the conditional probability $P(C|D)=0.8$, and the probability that if a good micro-chip is tested but the test declares it is defective is the conditional probability $P(C^c|D^c)=0.1$.
Therefore, we also have the probabilities $P(C^c|D)=0.2$, and $P(C|D^c)=0.9$.

Moreover, the probability that a micro-chip is defective, and has been declared as defective is $$P(C\cap D)\;=\;P(C|D)P(D)\;=\;0.8\times0.05\;=\;0.04\,.$$
The probability that a micro-chip is effective, and has been declared as effective is $$P(C\cap D^c)\;=\;P(C|D^c)P(D^c)\;=\;0.9\times0.95\;=\;0.855\,.$$
The probability that a micro-chip is defective, and has been declared as effective is $$P(C^c\cap D)\;=\;P(C^c|D)P(D)\;=\;0.2\times 0.05=0.01\,.$$
The probability that a micro-chip is effective, and has been declared as defective is $$P(C^c\cap D^c)\;=\;P(C^c|D^c)P(D^c)\;=\;0.1\times0.95\;=\;0.095\,.$$

The tree diagram for  these events  and probabilities is:
\begin{center}
\begin{picture}(100,140)(75,30){\drawline(0,90)(75,120)(125,140)
\drawline(75,120)(125,100)\drawline(0,90)(75,60)(125,40)
\drawline(75,60)(125,80)
\put(60,120){$D$}
\put(60,50){$D^c$}
\put(130,140){$C$\;\;$P(C\cap D)= 0.04$}
\put(130,100){$C^c$ \;\;$P(C^c\cap D)=  0.01$}
\put(130,80){$C$\;\;$P(C\cap D^c)= 0.855$}
\put(130,40){$C^c$ \;\;$P(C^c\cap D^c)= 0.095$}
\put(90,140){$0.8$}\put(90,95){$0.2$}
\put(90,75){$0.9$}\put(90,35){$0.1$}
\put(30,110){$0.05$}\put(30,60){$0.95$}
\put(40,160){ Defective}
\put(100,160){ Tested Correctly}
}
\end{picture}
\end{center}

\begin{itemize}
\item[(a)]
If a micro-chip is tested to be good, it could be defective but tested incorrectly, or it could be effective and tested correctly. Therefore, the probability that the micro-chip is tested good, but it is actually defective is
$$\frac{P(C^c\cap D)}{P(C^c\cap D)+P(C\cap D^c)}\;=\;\frac{0.01}{0.01+0.855}\;\approxeq\; 0.012$$
\item[(b)]
Similarly,  the probability that a micro-chip is  tested to be defective, but it was good is
$$\frac{P(C^c\cap D^c)}{P(C\cap D)\;+\;P(C^c\cap
  D^c)}=\frac{0.095}{0.095+0.04} \approxeq 0.704$$
\item[(c)]
The  probability that  both  the micro-chips are effective, and have been
tested and determined to be good,  is
\[\left(\frac{P(C\cap D^c)}{P(C^c\cap D)+P(C\cap D^c)}\right)^2\]
and so  the probability that at least one is defective is:
$$1\;-\;\left(\frac{P(C\cap D^c)}{P(C^c\cap D)+P(C\cap
    D^c)}\right)^2\;=\;1-\left(\frac{0.855}{0.01+0.855 }\right)^2\;\approxeq\;0.023$$
\end{itemize}

\Exercise
Suppose that $\frac{2}{3}$  of all gales are  force 1, $\frac{1}{4}$  are force 2 and $\frac{1}{12}$  are force 3.
Furthermore, the probability that force 1 gales cause damage is
$\frac{1}{4}$,  the probability that force 2 gales cause damage is
$\frac{2}{3}$  and  the probability that force 3 gales cause damage is
$\frac{5}{6}$.

\begin{itemize}
\item[(a)]If a  gale is reported,  what is the probability of it causing damage?
\item[(b)] If the gale caused damage, find  the probabilities that it
  was  of:  force 1;  force 2;  force 3.
\item[(c)] If the gale did  NOT cause damage, find  the probabilities
  that it was of: force 1; force 2; force 3.
\end{itemize}
\Answer
\begin{itemize}
\item[(a)] Let $F1$ be the event a gale of force 1 occurs, let $F2$
be the event a gale of force 2 occurs and $F3$ be the event a gale
of force 3 occurs.  Now we know that
\[ P(F1)\; =\; \frac{2}{3}, \quad  P(F2) \;= \;\frac{1}{4},  \quad P(F3) \;= \;\frac{1}{12}\,.\]
If $D$ is the event that a gale causes damage, then we also know the
following conditional probabilities:
\[ P(D|F1) \;= \;\frac{1}{4}, \quad  P(D|F2) \;=\; \frac{2}{3},  \quad  P(D|F3)\; = \;\frac{5}{6}\,.\]
The probability that a reported gale causes damage is
\[P(D)\;=\;P(D\cap F1)\;+\;P(D\cap F2)\;+\;P(D\cap F3)\]
where
\[P(D\cap F1)\;=\; P(D| F1)P(F1)\;=\;\frac{1}{4} \times \frac{2}{3}
\;=\; \frac{1}{6}\,, \]
\[P(D\cap F2)\;=\; P(D| F2)P(F2)\;=\;\frac{2}{3} \times \frac{1}{4}
\;=\; \frac{1}{6}\,, \]
and
\[P(D\cap F3)\;=\; P(D| F3)P(F3)\;=\;\frac{5}{6} \times \frac{1}{12}
\;=\; \frac{5}{72} \,.\]
Hence \[P(D)\;=\;  \frac{1}{6}\,+\,  \frac{1}{6}\,+\,\frac{5}{72}\;=\; \frac{29}{72} \]

\item[(b)] Knowing that the gale did cause damage we can calculate the probabilities that it was of the various forces using the probabilites in (a) as follows (Note: $P(D\cap F1)= P(F1\cap D)$ etc.):
{$$P(F1|D)\;=\;\frac{P(F1\cap D)}{P(D)}\;=\;\frac{1/6}{29/72}\;=\;\frac{12}{29}$$
$$P(F2|D)\;=\;\frac{P(F2\cap D)}{P(D)}\;=\;\frac{1/6}{29/72}\;=\;\frac{12}{29}$$
$$P(F3|D)\;=\;\frac{P(F3\cap D)}{P(D)}\;=\;\frac{5/72}{29/72}\;=\;\frac{5}{29}$$
}

\item[(c)]First note that the probability that a reported gale does NOT
  cause damage is:
\[ P(D^c)\;=\; 1-P(D)\;=\; 1- \frac{29}{72}\;=\; \frac{43}{72}\,.\]
Now we need to find probabilities like $P(F1\cap D^c)$. The best way to
do this is to use the partitioning idea of the  ``Total Probability
Theorem'', and write:
\[ P(F1) \;=\;  P(F1\cap D^c) \;+\; P(F1\cap D)\,,\]
Rearranging this gives
\[  P(F1\cap D^c) \;= \;P(F1) \;- \; P(F1\cap D) \]
and so
\[P(F1|D^c)\;=\;\frac{P(F1\cap D^c)}{P(D^c)}\;=\;\frac{P(F1)-P(D\cap
  F1)}{P(D^c)}\;=\;\frac{2/3-1/6}{43/72}\;=\;\frac{36}{43}\,.
\]
Similarly,
\[P(F2|D^c)\;=\;\frac{P(F2\cap D^c)}{P(D^c)}\;=\;\frac{P(F2)-P(D\cap F2)}{P(D^c)}\;=\;\frac{1/4-1/6}{43/72}\;=\;\frac{6}{43}\,,\]
and
\[P(F3|D^c)\;=\;\frac{P(F3\cap D^c)}{P(D^c)}\;=\;\frac{P(F3)-P(D\cap F3)}{P(D^c)}\;=\;\frac{1/12-5/72}{43/72}\;=\;\frac{1}{43}\,.\]

\end{itemize}
\newpage

\Exercise
{**}The sensitivity and specificity of a medical diagnostic test for a disease are defined as follows:
\begin{eqnarray*}
\text{sensitivity } &=& \P \left( \text{ test is positive } | \text{ patient has the disease } \right) \enspace ,\\
\text{specificity} &=& \P \left( \text{ test is negative } | \text{ patient does not have the disease } \right) \enspace .
\end{eqnarray*}
Suppose that a medical test has a sensitivity of $0.7$ and a specificity of $0.95$.
If the prevalence of the disease in the general populaiton is $1\%$, find
\begin{itemize}
\item[(a)] the probability that a patient who tests positive actually has the disease,
\item[(b)] the probability that a patient who tests negative is free from the disease.
\end{itemize}

\Exercise
{**}The detection rate and false alarm rate of an intrusion sensor are defined as
\begin{eqnarray*}
\text{detection rate} &=& \P \left( \text{ detection declared } | \text{ intrusion } \right) \enspace ,\\
\text{false alarm rate} &=& \P \left( \text{ detection declared } | \text{ no intrusion } \right) \enspace .
\end{eqnarray*}
If the detection rate is $0.999$ and the false alarm rate is $0.001$, and the probability of an intrusion occuring is $0.01$, find
\begin{itemize}
\item[(a)] the probability that there is an intrusion when a detection is declared,
\item[(b)] the probability that there is no intrusion when no detection is declared.
\end{itemize}

\Exercise
{**}Let $A$ and $B$ be events such that $\P(A) \neq 0$ and $\P(B) \neq 0$.
When $A$ and $B$ are disjoint, are they also independent?
Explain clearly why or why not.

\end{ExerciseList}


\section{Informed Search}

\subsection{Heuristics}

\paragraph{Admissibility} An admissible heuristic never
overestimates the cost to reach the goal, that is it is
optimistic. A heuristic h is admissible if:
\begin{math}
  \forall\medspace node \medspace n, \medspace h(n) \leq h^*(n)
\end{math}
where $h^*$ is true cost to reach the goal from $n$.

In a map, the air distance between two points is an admissible
heuristic because it is by definition the shortest distance
between the two points.

\paragraph{Consistency}

\begin{math}
h(a) - h(b) \leq cost(a to b)
\end{math}

Which implies:
\begin{math}
h(a) \leq cost(a to b) + h(b)
\end{math}

\begin{table}[hb!]
\begin{tabular}{lL}
  Strategy & Implementation \\
  Greedy search &
  \multicolumn{1}{p{0.65\linewidth}}{
    Expands the node that appears to be closest to goal
  } \\
  $A^*$ &
  \multicolumn{1}{p{0.65\linewidth}}{
    Minimize the total estimated solution cost ($f$), that is
    the cost to reach node $n$ ($g$), and the cost to
    get from $n$ to the goal ($h$)
  }
\end{tabular}
\caption{Informed Search Strategies}
\label{tab:informed_search_strategies}
\end{table}

\subsection{A*}

\begin{itemize}
  \item Complete
  \item Time: exponential
  \item Space: keeps every node in memory
\end{itemize}

\subsection{A* optimality}

If the heuristic function used by A* is admissible, then A* is admissible.

\paragraph{Sketch of proof} When A* terminates its search,
it has found a path from start to goal whose actual cost is
lower than the estimated cost of
any path from start to goal through any open node (the node's
$f$ value).
When the heuristic is admissible, those estimates are
optimistic (not quite—see the next paragraph), so $A^{*}$ can
safely ignore those nodes because they cannot possibly lead
to a cheaper solution than the one it already has.
In other words, $A^{*}$ will never overlook the
possibility of a lower-cost path from start to goal and so it
will continue to search until no such possibilities exist.

The actual proof is a bit more involved because the
$f$ values of open nodes are not guaranteed to
be optimistic even if the heuristic is admissible. This is
because the $g$ values of open nodes are not guaranteed to be
optimal, so the sum $g+h$ is not guaranteed to be optimistic.


\section*{Introduction}

The problem of learning smooth functions is a key problem in machine learning, as many problems
are framed as finding continuous solutions to problems with only a small number of data points.
This smoothness is often not guaranteed, and is enforced through regularization of the output,
usually using something like $L_2$ loss or temporal consistency~\cite{tretschk2021nonrigid}. Since
the consistency is usually imposed as some weighted loss, it is not a guaranteed property of the
network. This leads to difficulties in interpolation between time-steps, which can be used to
exaggerate motion, or predict intermediate time steps. In addition, there is also the
possibility for sudden changes in motion.
Notably, we are interested in constructing functions with $C^0$ continuity. That is, the
function must be continuous on some domain. We are also to some extent interested in $C^1$
continuity, or the derivative of a function is continuous on some domain, which often is
reflected in the realism of motion by enforcing smooth velocity changes.

We examine the specific problem of predicting movement for dynamic scenes using NeRF. For this,
we define some static configuration, which is referred to as the canonical scene. From this, we
march rays into the scene, warping them in order to deform the rendered view, which is
essentially a perspective shift from moving objects in the scene. This is layered on top of the
original NeRF model in order to reconstruct movement from a fixed set of views. This simple
formulation is highly effective at reconstructing lambertian scenes with continuous movement as
described in D-NeRF~\cite{pumarola2020dnerf} and NR(non-rigid)-NeRF~\cite{tretschk2021nonrigid}. These works show convincing
reconstructions of dynamic movement in scenes, predicting accurate reconstructions on both real
and synthetic scenes. If we are satisfied with pure reconstruction these methods suffice, but we
are also interested in performing operations on movement, such as interpolating between frames,
exaggerating it, or classifying regions of movement. These methods demonstrate capability to
perform well on certain tasks such as motion interpolation, but require specific optimizations
in order to demonstrate improvements. In contrast, we examine classical animation tools in order
to better handle movement.

In animation, there are many existing tools for creating smooth movement with a high-degree of
control for artists and animators. For example, there are tools such as keyframing, splines,
and other techniques. These tools allow artists and animators to breathe life into animation,
with a high degree of control. Mathematical constructs such as splines have also been thoroughly
studied to understand their behaviour, as well as how they can be manipulated. These tools are
clearly powerful enough to represent most movement, but have not been leveraged in machine
learning for this purpose.

We blend these existing tools in order to apply a prior on movement in Dynamic NeRF, finding that we are able to get a slight increase in performance without additional cost. In addition, we propose a new architecture for long duration $C^0$-continuous signal reconstruction. In summary, our contributions are as follows:

\begin{enumerate}
    \item A formulation of a prior on top of existing D-NeRF, which enforces smoothness of movement, a canonical basis, and an analytic form at no additional cost, while slightly outperforming the original.
    \item An evaluation of our architecture against D-NeRF which demonstrates its performance.
    \item A general architecture for reconstructing long, continuous signals, which guarantees smoothness. This architecture can be used to reconstruct long, dynamic sequences, but is more general and can be applied broadly to smooth signal reconstruction.
\end{enumerate}


\chapter{Arithmetic}

\section{Big Number}
\rih{Plus One.} Given a non-negative number represented as an array of digits, plus one to the number.
\begin{python}
def plusOne(self, digits):
    for i in xrange(len(digits)-1, -1, -1):
        digits[i] += 1
        if digits[i] < 10:
            return digits
        else:
            digits[i] -= 10

    # if not return within the loop
    digits.insert(0, 1)
    return digits
\end{python}

\section{Polish Notations}
Polish Notation is in-fix while Reverse Polish Notation is post-fix.

Reverse Polish notation (RPN) is a mathematical notation in which every operator follows all of its operands (i.e. operands are followed by operators). RPN should be treated as the orthogonal expression.

Polish notation (PN) is a mathematical notation in which every operator is followed by its operands.

\subsection{Convert in-fix to post-fix (RPN)}
\pyinline{ret} stores the final result of reverse polish notation. \pyinline{stk} stores
the temporary result in strictly increasing order.

In-fix
\begin{python}
5 + ((1 + 2) * 4) - 3
\end{python}

can be written as
\begin{python}
5 1 2 + 4 * + 3 -
\end{python}
Core clues:
\begin{enumerate}
\item \rih{Stack}. The stack temporarily stores the operators of \textit{strictly increasing precedence order}.
\item \rih{Precedence}. Digits have the highest precedence, followed by \pyinline{*, /, +, (}. Notice that \pyinline{(} operator itself has the \textit{lowest} precedence.
\item \rih{Bracket}. \textit{Match} the brackets.
\end{enumerate}
Code:
\begin{python}
def infix2postfix(self, lst):
  stk = []
  ret = []  # post fix result
  for elt in lst:
    if elt.isdigit():
      ret.append(elt)
    elif elt == "(":
      stk.append(elt)
    elif elt == ")":
      while stk and stk[-1] != "(":
        ret.append(stk.pop())
      stk.pop()  # pop "("
    else:
      while stk and precdn(elt) <= precdn(stk[-1]):
        ret.append(stk.pop())
      stk.append(elt)

  while stk:  # clean up
    ret.append(stk.pop())

  return ret
\end{python}

\subsection{Evaluate post-fix expressions}\label{section:evaluationPostFix}
Consider:

In-fix
\begin{python}
5 + ((1 + 2) * 4) - 3
\end{python}

Post-fix
\begin{python}
5 1 2 + 4 * + 3 -
\end{python}
Straightforward: use a \textit{stack} to store the number. Iterate the input, push
stack when hit numbers, pop stack when hit operators.

\subsection{Convert in-fix to pre-fix (PN)}
PN is the \textit{reverse} of RPN, thus, scan the expression from right to left; and \pyinline{stk} stores the temporary result in non-decreasing order.

In-fix
\begin{python}
5 + ((1 + 2) * 4) - 3
\end{python}

can be written as
\begin{python}
3 4 2 1 + * 5 + -
\end{python}

reverse as
\begin{python}
- + 5 * + 1 2 4 3
\end{python}

\begin{python}
  def infix2prefix(self, lst):
    """starting from right the left"""
    stk = []
    pre = []
    for elt in reversed(lst):
      if elt.isdigit():
        pre.append(elt)
      elif elt == ")":
        stk.append(elt)
      elif elt == "(":
        while stk and stk[-1] != ")":
          pre.append(stk.pop())
        stk.pop()
      else:
        # < rather than <=
        while stk and precdn(elt) < precdn(stk[-1]):
          pre.append(stk.pop())
        stk.append(elt)

    while stk:
      pre.append(stk.pop())

    pre.reverse()
    return pre
\end{python}

\subsection{Evaluate pre-fix (PN) expressions}
Consider:

In-fix
\begin{python}
5 + ((1 + 2) * 4) - 3
\end{python}

Pre-fix
\begin{python}
- + 5 * + 1 2 4 3
\end{python}

reverse as
\begin{python}
3 4 2 1 + * 5 + -
\end{python}
Put into \textit{stack}, similar to evaluating post-fix \ref{section:evaluationPostFix}, but pay attention to operands order, which should be reversed when hitting a operator.


\documentclass[12pt]{matlatex}
\usepackage{examples}

\begin{document}

\section*{Quadratic convergence of Newton-Raphson iterations}

This is a simple example that uses the Matlab Symbolic Toolbox to demonstrate the quadratic converegnce of Newton-Raphson iterations to the exact root of a non-linear equation.

\begin{matlab}
   syms x f(x) df(x) Step(x)

   f(x)    = x-exp(-x);
   df(x)   = diff(f,x);
   Step(x) = x- f(x)/df(x);

   digits(200);

   x_new = vpa (1/2);
   f_new = vpa (f(x_new));

   % matBeg (table)

   fprintf ('\\RuleA %2d & % .25f & % .10e &\\\\\n',[0,x_new,f_new]);

   for n = 1:6
      x_old = x_new;
      x_new = vpa (Step(x_new));
      f_old = vpa (f(x_old));
      f_new = vpa (f(x_new));
      ratio = vpa (f_new / f_old^2);
      fprintf ('\\RuleA %2d & % .25f & % .10e & % .5f\\\\\n',[n,x_new,f_new,ratio]);
   end

   % matEnd (table)
\end{matlab}

\clearpage

Note the clear quadratic convergence in the iterations -- the last column settles to approximately $-0.11546$ independent of the number of iterations. This behaviour would not be seen using normal floating point computations as they are normally limited to no more than 18 decimal digits. This computation used 200 decimal digits.

\def\RuleA{\vrule depth0pt  width0pt height14pt}
\def\RuleB{\vrule depth8pt  width0pt height14pt}
\def\RuleC{\vrule depth10pt width0pt height16pt}

\setlength{\tabcolsep}{0.025\textwidth}%

\begin{center}
   \begin{tabular}{cccc}%
      \noalign{\hrule height 1pt}
      \multicolumn{4}{c}{\RuleC\rmfamily\bfseries%
      Newton-Raphson iterations \quad%
      $x_{n+1} = x_n - f_n/f'_n\ ,\quad f(x) = x-e^{-x}$}\\
      \noalign{\hrule height 1pt}
      \RuleB$n$&$x_n$&$\epsilon_{n} = x_{n} - e^{-x_{n}}$&$\epsilon_{n}/\epsilon_{n-1}^2$\\
      \noalign{\hrule height 0.5pt}
      \mat{table}
      \noalign{\hrule height 1pt}
   \end{tabular}
\end{center}

\vspace{20pt}

\begin{latex}
   \def\RuleA{\vrule depth0pt  width0pt height14pt}
   \def\RuleB{\vrule depth8pt  width0pt height14pt}
   \def\RuleC{\vrule depth10pt width0pt height16pt}

   \setlength{\tabcolsep}{0.025\textwidth}%

   \begin{center}
      \begin{tabular}{cccc}%
         \noalign{\hrule height 1pt}
         \multicolumn{4}{c}{\RuleC\rmfamily\bfseries%
         Newton-Raphson iterations \quad%
         $x_{n+1} = x_n - f_n/f'_n\ ,\quad f(x) = x-e^{-x}$}\\
         \noalign{\hrule height 1pt}
         \RuleB$n$&$x_n$&$\epsilon_{n} = x_{n} - e^{-x_{n}}$&$\epsilon_{n}/\epsilon_{n-1}^2$\\
         \noalign{\hrule height 0.5pt}
         \mat{table}
         \noalign{\hrule height 1pt}
      \end{tabular}
   \end{center}
\end{latex}

\end{document}


\section*{Chapter 4: Euclid's Algorithm}

\paragraph{Exercise 4.3}
Prove that $\KthRoot{3}{16} + \KthRoot{3}{54} = \KthRoot{3}{250}$

\begin{proof}
$16 = 2^4$, $54 = 2 \cdot 3^3$ and $250 = 2 \cdot 5^3$. Then,
\begin{eqnarray*}
\KthRoot{3}{16} + \KthRoot{3}{54} &=& \KthRoot{3}{2^4} +
                                      \KthRoot{3}{2 \cdot 3^3} \\
                                  &=& 2 \KthRoot{3}{2} + 3 \KthRoot{3}{2} \\
                                  &=& 5 \KthRoot{3}{2} \\
                                  &=& \KthRoot{3}{5^3} \cdot \KthRoot{3}{2} \\
                                  &=& \KthRoot{3}{2 \cdot 5^3} \\
                                  &=& \KthRoot{3}{250}
\end{eqnarray*}
\end{proof}

\paragraph{Exercise 4.4}
Prove that, for any odd square number $x$, there is an even square number $y$
such that $x+y$ is a square number.

\begin{proof}
Since $x$ is square and odd, there must be an $n \in \Nat$ such that
$x = (2n+1)^2$. Let $y$ be some even square number. Thus, there must be an
$m \in \Nat$ such that $y = (2m)^2$. It follows that
\begin{eqnarray*}
x+y &=& (2n+1)^2 + (2m)^2 \\
    &=& 4(n^2 + m^2) + 4n + 1
\end{eqnarray*}
We must define $m$ as a function of $n$ in such a way that this number conforms
a square. In order to do this, let's see what happens for some small cases:
\begin{itemize}
    \item If $n = 1$, then $x = 9$. If we set $m = 2$, $y = 16$ and $x+y = 25$,
    which is a square.
    \item If $n = 2$, then $x = 25$. Taking $m = 6$, $y = 144$ and $x+y = 169$,
    which is a square (since $13^2 = 169$).
    \item If $n = 3$, then $x = 49$. Now, $m$ can be $12$, and then $y = 576$
    and $x+y = 625 = 25^2$.
\end{itemize}
A careful analysis of these cases reveals a pattern: $m = n^2 + n$. Substituting
this in the equation shown before,
\begin{eqnarray*}
x+y &=& 4(n^2 + m^2) + 4n + 1  \\
    &=& 4(n^2 + (n^2 + n)^2) + 4n + 1 \\
    &=& 4n^2 + 4(n^2 + n)^2 + 4n + 1 \\
    &=& 4(n^2 + n)^2 + 4(n^2 + n) + 1 \\
    &=& (2(n^2 + n) + 1)^2 \\
\end{eqnarray*}
\end{proof}

\newsavebox\sqpython
\begin{lrbox}{\sqpython}
    \begin{minipage}[t]{3in}
         \vspace{4px}
         \begin{verbatim}
def find_squares(x, y):
    x1, x2 = x
    y1, y2 = y
    n = (x1**2 + x2**2)*(y1**2 + y2**2)
    return [(i,j) for i in xrange(n)
                  for j in xrange(i,n)
                  if n == i**2 + j**2]
         \end{verbatim}
    \end{minipage}
\end{lrbox}

\paragraph{Exercise 4.5}
Prove that, if $x$ and $y$ are both sums of two squares, then so is their
product $xy$.

\begin{proof}
Being $x$ and $y$ both sums of two squares, we can write them like so:
\begin{eqnarray*}
    x &=& x_1^2 + x_2^2 \\
    y &=& y_1^2 + y_2^2
\end{eqnarray*}
This implies that
\begin{eqnarray*}
    xy &=& (x_1^2 + x_2^2) \, (y_1^2 + y_2^2)  \\
       &=& x_1^2 y_1^2 + x_1^2 y_2^2 + x_2^2 y_1^2 + x_2^2 y_2^2
\end{eqnarray*}
After several failed attempts at completing the squares (i.e., adding and
subtracting the same thing), the following Python
script was used to gain some insight into the underlying pattern of $xy$:
    \begin{center}
    \framebox[8.5cm]{
    \usebox\sqpython}
    \end{center}
For example,
\begin{itemize}
    \item \texttt{find\_squares((2,3), (5,7))} $\rightarrow$ \texttt{[(1, 31), (11, 29)]}.
    \item \texttt{find\_squares((1,2), (3,4))} $\rightarrow$ \texttt{[(2, 11), (5, 10)]}.
\end{itemize}
Playing with this script and guessing how to combine the elements in the input
tuples in order to generate an output tuple $(z_1, z_2)$, the following
pattern emerged:
\begin{eqnarray*}
    z_1 &=& x_2 y_1 + x_1 y_2  \\
    z_2 &=& x_2 y_2 - x_1 y_1
\end{eqnarray*}
Indeed,
\begin{eqnarray*}
    z_1^2 + z_2^2 &=& (x_2 y_1 + x_1 y_2)^2 + (x_2 y_2 - x_1 y_1)^2  \\
                  &=& ((x_2 y_1)^2 + (x_1 y_2)^2 + 2 x_2 y_1 x_1 y_2)
                      + ((x_2 y_2)^2 + (x_1 y_1)^2 - 2 x_2 y_2 x_1 y_1) \\
                  &=& x_2^2 y_1^2 + x_1^2 y_2^2 + x_2^2 y_2^2 + x_1^2 y_1^2 \\
                  &=& x_1^2 y_1^2 + x_1^2 y_2^2 + x_2^2 y_1^2 + x_2^2 y_2^2 \\
                  &=& xy
\end{eqnarray*}

\end{proof}


%
% Chapter 4.5
%

\section*{4.5 Substitution Rule}

\subsection*{Substitution Rule for Indefinite Integrals}

If \(u=g(x)\) is a differentiable function whose range is an interval \(I\) and \(f\) is continuous on \(I\), then
$$ \int f(g(x))g'(x)dx = \int f(u)du $$

\subsection*{Substitution Rule for Definite Integrals}

If \(g'\) is continuous on \([a, b]\) and \(f\) is continuous on the range of \(u=g(x)\), then
$$ \int_a^b f(g(x))g'(x)dx=\int_{g(a)}^{g(b)}f(u)du $$

\subsection*{Integrals of Symmetric Functions}

Suppose \(f\) is continuous on \([-a, a]\).
$$ \text{If } f \text{ is even } [f(-x)=f(x)] \text{, then } \int_{-a}^a f(x)dx = 2 \int_{0}^{a} f(x)dx. $$
$$ \text{If } f \text{ is odd } [f(-x)=-f(x)] \text{, then } \int_{-a}^a f(x)dx = 0. $$


\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=1.0in]{geometry}
\usepackage{xcolor}

\begin{document}

\noindent
Does $\displaystyle \sum_{n=1}^\infty \frac{5^n \ln 5}{5^n-1}$
diverge, converge absolutely, or converge conditionally?

\subsection*{Solution 1}

\begin{align*}
\lim_{n \to \infty} a_n
&= \lim_{n \to \infty} \frac{5^n \ln 5}{5^n-1} \\
&= \lim_{n \to \infty} \frac{5^n \ln 5 \ln 5}{5^n \ln 5} \quad\text{by L'Hopital} \\
&= \lim_{n \to \infty} \frac{\ln 5}{1} \quad\text{by algebra cancellation} \\
& = \ln 5
\end{align*}
so the series $\displaystyle \sum_{n=1}^\infty \frac{5^n \ln 5}{5^n-1}$ diverges by the Test for Divergence.

\subsection*{Solution 2}

The function $f(x)=\frac{5^x \ln 5}{5^x-1}$ is continuous, positive, and decreasing on $[1,\infty)$.

We first find the indefinite integral by substitution $u=5^x-1$ so $du = 5^x \ln 5\,dx$:
\begin{align*}
\int \frac{5^x \ln 5}{5^x-1}\,dx
&= \int \frac1u\,du\\
&= \ln |u|+C\\
&= \ln |5^x-1|+C.
\end{align*}

So, going to our definite (improper) integral,
\begin{align*}
\int_1^\infty  \frac{5^x \ln 5}{5^x-1}\,dx
&= \lim_{t \to \infty} \int_1^t  \frac{5^x \ln 5}{5^x-1}\,dx\\
&= \lim_{t \to \infty} ( \ln |5^t-1| - \ln |5^1-1| )\\
&= \infty.
\end{align*}
Since the integral $\displaystyle \int_1^\infty \frac{5^x \ln 5}{5^x-1}\,dx$ diverges, the  series  $\displaystyle \sum_{n=1}^\infty \frac{5^n \ln 5}{5^n-1}$ diverges by the Integral Test.

\end{document}%%%%%%%%%%%%%%%%%

\begin{align*}
L&=\lim_{n \to \infty} \sqrt[n]{|a_n|}\\
&= \lim_{n \to \infty} \sqrt[n]{\left| \right|}\\
\end{align*}

Since $\sum |a_n| = \sum a_n$, the series $\displaystyle \sum_{n=1}^\infty AAAAAAAAAAAAAA$ converges absolutely.

Since $|r| < 1$, the series ...  converges by the Geometric Series Test.

Since $|r| \geq 1$, the series ...  diverges by the Geometric Series Test.

The function $f(x)=\frac{}{}$ is continuous, positive, and decreasing on $[1,\infty)$.

\subsection*{Solution}


\section{CW-complexes and cellular homology}
Recall:
\begin{definition}
A \emph{CW-complex} is a space $X$ with a sequence of subspaces $\emptyset=X_{-1}\subseteq X_0\subseteq X_1\subseteq\cdots\subseteq X$ (could be an infinite sequence) such that for all $n$, there is a map $f:\coprod_{\alpha\in A_n}S^{n-1}_\alpha\to X_{n-1}$ (called the \emph{attaching map}), such that there is a pushout diagram like this:
\begin{equation*}
\xymatrix{\coprod_{\alpha\in A_n}S^{n-1}_\alpha\ar[r]^f\ar@{^(->}[d]_i & X_{n-1}\ar[d]\\
\coprod_{\alpha\in A_n}D^n_\alpha\ar[r] & X_{n}}
\end{equation*}
And $X=\bigcup X_n$, topologically (i.e. $A\subseteq X$ is open if and only if $A\cap X_n$ is open for all $n$). Often, $X_n$ is written $\mathrm{Sk}_n(X)$, and is called the $n$-skeleton of $X$.
\end{definition}
\begin{remark}
This means that if you ignore the topology, i.e., as sets: $X=\coprod_{n\geq 0}\left(\coprod_{\alpha\in A_n}\mathrm{Int}(D^n_\alpha)\right)$ where $\mathrm{Int}(D^n)=\{x\in D^n: |x|<1\}$ (the interior of $D^n$), so that $\mathrm{Int}(D^0)=D^0=\ast$. The $\mathrm{Int}(D^n_\alpha)$ are called ``open $n$-cells''. Note that the open $n$-cells are not generally open in the topology on $X$.
\end{remark}
\begin{example}
The $n$-sphere $S^n$. Let $\mathrm{Sk}_0(S^n)=\ast=\mathrm{Sk}_1(S^n)=\cdots=\mathrm{Sk}_{n-1}(S^n)\subseteq \mathrm{Sk}_n(S^n)=S^n$. We attach it by using the pushout:
\begin{equation*}
\xymatrix{S^{n-1}\ar[d]\ar[r] & \ast\ar@{^(->}[d]\\
D^n\ar[r] & S^n}
\end{equation*}
Here's another CW-structure. Let $\mathrm{Sk}_0(S^n)=S^0=S^n\cap \mathbf{R}^1\langle \mathbf{e}_1\rangle$, $\mathrm{Sk}_1(S^n)=S^{1}=S^n\cap\mathbf\mathbf{R}\langle \mathbf{e}_1,\mathbf{e}_2\rangle$, $\mathrm{Sk}_2(S^n)=S^2=S^n\cap\mathbf{R}\langle \mathbf{e}_1,\mathbf{e}_2,\mathbf{e}_3\rangle$, etc. until $\mathrm{Sk}_n(S^n)=S^n$. I have to give maps $u,\ell:D^k\to S^k$ so that you have a pushout:
\begin{equation*}
\xymatrix{D^k\ar[r] & S^k\\
S^{k-1}\ar@{^(->}[u]\ar@{=}[r] & \mathrm{Sk}_k(S^n)\ar@{^(->}[u]}
\end{equation*}
Let $u(x)=(x,\sqrt{1-|x|^2})$ and $\ell(x)(x,-\sqrt{1-|x|^2})$ where $x\in D^k$. Clearly $u,\ell$ take values in $S^k$.
\end{example}
There's another definition I have to make.
\begin{definition}
Let $X$ be a CW-complex. A subcomplex of $X$ is a subspace $Y\subseteq X$ such that $\emptyset\subseteq Y\cap X_0\subseteq Y\cap X_1\subseteq\cdots\subseteq Y\cap X_k\subseteq \cdots\subseteq Y$ is a CW-structure on $Y$.
\end{definition}
\begin{example}
$X_n\subseteq X$ is a subcomplex of a CW-complex $X$. It's not that hard to see why. In particular, $S^0\subseteq S^1\subseteq S^2\subseteq\cdots\subseteq \bigcup_{n\geq 1}S^n=:S^\infty$. This of finite type, but isn't finite-dimensional.
\end{example}
\begin{lemma}
$S^\infty$ is contractible.
\end{lemma}
\begin{proof}
$S^0$ itself is not contractible, but attaching two $1$-cells makes this contractible. Similarly, $S^1$ isn't contractible, but attaching two $2$-cells makes this contractible. This is the idea. You have $S^{k-1}\times I\to S^k$ by $(x,t)\mapsto u(tx+(1-t)\mathbf{e}_1)$ where $u$ is the map we defined above. Therefore we get a map $S^\infty\times I\to S^\infty$ that's a contracting homotopy.
\end{proof}
\begin{example}
Recall $\mathbf{RP}^n=S^n/\sim$ where $x\sim -x$. There's a map from $S^n\to\mathbf{RP}^n$ that's a double cover. Let me propose a CW-decomposition. We have:
\begin{equation*}
\xymatrix{\cdots\ar@{^(->}[r] & S^{k-1}\ar@{^(->}[r]\ar[d] & S^k\ar[d]\ar[r] & \cdots\ar[r] & S^n\ar[d]\\
\cdots\ar@{^(->}[r] & \mathbf{RP}^{k-1}\ar@{^(->}[r] & \mathbf{RP}^k\ar@{^(->}[r] & \cdots\ar@{^(->}[r] & \mathbf{RP}^n}
\end{equation*}
We claim that this is a CW-decomposition. We have a double cover $S^1\to\mathbf{RP}^1=S^1$. The maps $S^{k-1}\to\mathbf{RP}^{k-1}$ are not degree $2$ maps -- they're different spaces! If we use the double cover $S^{k-1}\to\mathbf{RP}^{k-1}$, then we claim that there is a pushout:
\begin{equation*}
\xymatrix{\mathbf{RP}^{k-1}\ar@{^(->}[r]& \mathbf{RP}^k\ar@{^(->}[r] & \cdots\ar@{^(->}[r] & \bigcup_{k\geq 0}\mathbf{RP}^k=\mathbf{RP}^\infty\\
S^{k-1}\ar[u]^{\text{double cover}}\ar[r] & D^k\ar[u]}
\end{equation*}
This is true if you notice that the preimage of any point of $\mathbf{RP}^k$ must be two points, one of which must be in the upper hemisphere, which is a disk, unless both points are on the equatorial sphere.
\end{example}
\subsection{Homology of CW-complexes}
Consider:
\begin{equation*}
\xymatrix{A\ar@{^(->}[r]\ar[d]^f & B\ar[r]\ar[d] & B/A\ar@{-->}[d]\\
X\ar@{^(->}[r] & X\cup_f B\ar[r] & (X\cup_fB)/X}
\end{equation*}
By a diagram chase, the dotted arrow exists and is continuous. This is actually a pointed map. You can see that this is a homeomorphism. What if this is part of a CW-structure?
\begin{equation*}
\xymatrix{\coprod_{\alpha}S^{k-1}\ar@{^(->}[r]\ar[d]^f & \coprod_{\alpha}D^k_\alpha\ar[r]\ar[d] & \bigvee_{\alpha}S^k_\alpha\ar@{-->}[d]\\
X_{k-1}\ar@{^(->}[r] & X_k\cup_f B\ar[r] & X_k/X_{k-1}}
\end{equation*}
where $\bigvee$ is the wedge product (disjoint union with all basepoints identified). Then $\bigvee_{\alpha}S^k_\alpha$ is a bouquet of spheres. So $X_k/X_{k-1}\cong\bigvee_{\alpha}S^k_\alpha$. We know the homology of spheres very well by now, so let's exploit this.
\begin{lemma}
$ H_q(X_k,X_{k-1})\to H_q(X_k/X_{k-1},\ast)$ is an isomorphism.
\end{lemma}
\begin{proof}
Later.
\end{proof}
But now, we know $ H_q(X_k/X_{k-1},\ast)$ very well! It's exactly $\widetilde{ H}_q(\bigvee_{\alpha\in A_k}S^k_\alpha)\cong\begin{cases}\Z[A_k] & q=k \\ 0 & q\neq k\end{cases}$. Therefore the relative homology $ H_q(X_k,X_{k-1})$ counts the number of $k$-cells of $X$.
\begin{definition}
Let $C_k(X):= H_k(X_k,X_{k-1})$. This is the ``cellular $k$-chains'' of $X$.
\end{definition}
\begin{corollary}
There's an exact sequence:
\begin{equation*}
\xymatrix{ & & H_{k+1}(X_k,X_{k-1})=0\ar[dll]\\
 H_k(X_{k-1})\ar[r] & H_k(X_k)\ar[r] & C_k(X)\ar[dll]\\
 H_{k-1}(X_{k-1})\ar[r] & H_{k-1}(X_k)\ar[r] & H_{k-1}(X_k,X_{k-1})=0}
\end{equation*}
And in other dimensions, $ H_q(X_{k-1})\cong H_q(X_k)$ for $q\neq k,k-1$. So:
\begin{enumerate}
\item We have maps $ H_q(X_k)\to H_q(X_{k+1})\to\cdots$ that are all isomorphisms for $q<k$. (There was a lot of confusion here about what $q$ is greater than or less than). All of these map to $ H_q(X)$. There's another lemma that I will defer again:
	\begin{lemma}
	This limit $ H_q(X_k)\to H_q(X_{k+1})\to\cdots\to H_q(X)$ is an isomorphism.
	\end{lemma}
	\begin{proof}
	Deferred.
	\end{proof}
\item (There was a bit of confusion at this point, I'm not sure on what exactly.) $ H_q(X_0)\to H_q(X_1)\to\cdots\to H_q(X_k)$ are all isomorphisms for $q>k$. Agreed? That's not what I wanted to say. I'll continue this on Wednesday. It's not supposed to be confusing.
\end{enumerate}
\end{corollary}


\section{Measurement Uncertainty Analysis}

\subsection{Uncertainty of The Distance Measurement}
We use formula to calculate type-A uncertainty
\begin{multline*}
 u_A = t_{0.95} \sqrt{\frac{1}{3(3-1)} \sum_{k=1}^3{(S_k-\bar{S})^2} } = \\
4.30 \cdot \sqrt{1/6\cdot ( (147.0-  146.83)^2 +  (147.0-  146.83)^2 + (146.5-
  146.83)^2 ) } =   0.7 mm
\end{multline*}
And type-B uncertainty is $u_B = $ = 1 mm. Thus,

$$   u_s = \sqrt{u_A^2+u_B^2} = \sqrt{0.7^2+1^2} = 1.2 mm  $$
$$   u_{S,r} = 1.2 / 146.8 = 0.82 \% $$

\subsection{Uncertainty of The Time Measurement}
We use formula to calculate type-A uncertainty
\begin{equation}
 u_A = t_{0.95} \sqrt{\frac{1}{6(6-1)} \sum_{k=1}^6{(t_k-\bar{t})^2} } = 1.05
 \cdot 0.0252 = 0.0492 s
\end{equation}
And type-B uncertainty is $u_B = $ = 0.01 s. Thus,
$$   u_t = \sqrt{u_A^2+u_B^2} = \sqrt{0.0492^2+0.01^2} =  0.0502 s $$
$$   u_{t,r} = 0.050 / 6.8517= 0.73 \% $$

\subsection{Uncertainty of The Ball Diameter}
We use formula to calculate type-A uncertainty
\begin{equation}
  u_A = t_{0.95} \sqrt{\frac{1}{10(10-1)} \sum_{k=1}^{10}{(d_k-\bar{d})^2} }
 = 0.715  \cdot   0.0197 = 0.0141 s
\end{equation}
And type-B uncertainty is $u_B = $ = 0.005 mm. Thus,
$$   u_d = \sqrt{u_A^2+u_B^2} = \sqrt{0.0141^2+0.005^2} = 0.0150 mm $$
$$   u_{d,r} = 0.0150 / 1.977 =  0.76 \% $$

\subsection{Uncertainty of The Inner Diameter of The Flask}
We use formula to calculate type-A uncertainty
\begin{equation}
  u_A = t_{0.95} \sqrt{\frac{1}{6(6-1)} \sum_{k=1}^{6}{(D_k-\bar{D})^2} }
 = 1.05  \cdot 0.0523 =  0.0549 mm
\end{equation}
And type-B uncertainty is $u_B = $ = 0.02 mm. Thus,
$$   u_D = \sqrt{u_A^2+u_B^2} = \sqrt{0.0549^2+0.02^2} = 0.0584 mm $$
$$   u_{D,r} = 0.0584 /  61.3533 =  0.095 \% $$

\subsection{Uncertainty of The Mass of The Ball}
We have $u_m $ for 40 balls, thus
$$   u_{m_0} = u_m /40 = 0.0001 / 40 / 1000 = 2.5 \cdot 10^{-8} kg  $$

\subsection{Uncertainty of The Density of One Ball}
From
$$   \rho_2 = \frac{6m_0}{ \pi d^3 } $$
Then we can find that
$$ u_{\rho_2} = \sqrt{(\frac{\partial \rho_2}{\partial m_0})^2(u_{m_0})^2 +
  (\frac{\partial \rho_2}{\partial d})^2(u_d)^2
} = 96.70  $$
$$   u_{\rho_2,r} = u_{\rho_2 } / \rho_2  =  96.70 / 8.385 \cdot 10^3 =   1.14 \% $$
The code is included as matlab/cal1.m

\subsection{Uncertainty of The Viscosity Coefficient}

$$ \mu = \frac{2}{9} g R^2 \frac{( \rho_2 - \rho_1 ) t  }{s} (1 + 2.4
\frac{R}{R_c})  $$

Thus,
$$ u_{\mu} = \sqrt{(\frac{\partial \mu}{\partial d})^2(u_d)^2
  + (\frac{\partial \mu}{\partial s})^2(u_s)^2
  + (\frac{\partial \mu}{\partial t})^2(u_t)^2
  + (\frac{\partial \mu}{\partial \rho_1})^2(u_{\rho_1})^2
  + (\frac{\partial \mu}{\partial D})^2(u_D)^2 }  $$
$$ u_{\mu}  =  1.4264 \cdot 10^{-2}   $$
$$ u_{\mu,r} =\frac{u_\mu}{\mu}=  1.42 \cdot 10^{-2}  / 0.7307 =   1.94 \% $$

The code is included as matlab/cal2.m


\subsection{Extreme IID multinomial}

\subsubsection{IID}

The probability of \(j\) being chosen is:

\(P_{ij}=P(\epsilon_{ik} <v_{ij} -v_{ik} +\epsilon_{ij}\forall k\ne j)\)

If these are independent then we have:

\(P_{ij}=\prod_{k\ne j} P(\epsilon_{ik} <v_{ij} -v_{ik} +\epsilon_{ij})\)

\(P_{ij}=\prod_{k\ne j} F_\epsilon (v_{ij} -v_{ik} +\epsilon_{ij})\)

We do not know \(\epsilon_{ij}\) so we have to integrate over possibilities.

\(P_{ij}=\int [\prod_{k\ne j} F_\epsilon (v_{ij} -v_{ik} +\epsilon_{ij})]f_\epsilon(\epsilon_{ij})d\epsilon_{ij}\)

\subsubsection{Extreme values}

We have:

\(P_{ij}=\int [\prod_{k\ne j} F_\epsilon (v_{ij} -v_{ik} +\epsilon_{ij})]f_\epsilon(\epsilon_{ij})d\epsilon_{ij}\)

If \(\epsilon \) is extreme value type-I this gives us:

\(P_{ij}=\dfrac{e^{v_{ij}}}{\sum_k e^{v_{ik}}}\)

\subsubsection{Independence of irrelevant alternatives}

Consider the ratio two probabilities:

\(\dfrac{P_{ij}}{P_{im}}=\dfrac{e^{v_{ij}}}{e^{v_{im}}}\)

This means that changes to any other products do not affect relative odds.

This can be undesirable. For example removing one option may cause unbalanced substitution.

For example raising the price of buses may cause more substitution to trains than helicopter, for a commute.


\section{Measurement Error Modeling}

The general model of a measurement error is as follows:
\begin{equation}
	e = b + v
\end{equation}
where $b$ models the systematic errors, and $v$ models the measurement noise.  We assume that the measurement noise is a discrete sequence of uncorrelated random numbers.  Variables such as $v$ are known as random variables, and the next subsection describes how to model them.  Subsequent subsections describe models for the systematic errors.

The discussion of systematic errors treats such errors as scalar quantities to simplify the exposition; generalization to the vector case is straightforward.  Note that if the measurement is non-scalar, but the errors in the component measurements are independent of one another, then we can model each measurement independently, so modeling the biases as vector is not required.  If the measurement errors are not independent, then many estimators require that we apply a transformation to the data prior to processing so that the data input to the estimator have independent measurement errors; the next subsection describes some ways to accomplish this transformation.

\subsection{Models and Realizations of Random Variables}

A continuous random variable is a function that maps the outcomes of random events to the real line.  Realizations of random variables are thus real numbers.  A vector of $n$ random variables maps outcomes of random events to $\mathcal{R}^n$.  For our purposes, random variables will always be associated with a probability density function that indicates the likelihood that a realization occurs within a particular interval of the real line, or within a particular subspace of $\mathcal{R}^n$ for the vector case.  Currently, all of our models assume that this density is the normal or Gaussian density.  For the vector case, the normal probability density function is
\begin{equation}
	f(x) = \frac{1}{2\pi|P|}\text{e}^{-\frac{1}{2}(x-\mu)'P^{-1}(x-\mu)}
\end{equation}
where $\mu$ is a vector of mean values for each component of $x$, and $P$ is a matrix that contains the variances of each component of $x$ along its diagonal, and the covariances between each component as its off-diagonal components.  The covariances indicate the degree of correlation between the random variables composing $x$.  The matrix $P$ is thus called the variance-covariance matrix, which we will hereafter abbreviate to just ``covariance matrix,'' or ``covariance.''  Since the normal density is completely characterized by its mean and covariance, we will use the following notation as a shorthand to describe normally-distributed random vectors:
\begin{equation}
	x \sim N(\mu, P)
\end{equation}
Thus, the model for the measurement noise is
\begin{equation}
	v \sim N(0, R)
\end{equation}

For the scalar case, or for the vector case when the covariance is diagonal, we may directly generate realizations of a normally-distributed random vector from normal random number generators available in most software libraries.  If $P$ has non-zero off-diagonal elements, we must model the specified correlations when we generate realizations.  If $P$ is strictly positive definite, we can factor it as follows:
\begin{equation}
	P = SS'
\end{equation}
where $S$ is a triangular matrix known as a Cholesky factor; this can be viewed as a ``matrix square root.''  The Cholesky factorization is available in many linear algebra libraries.  We can then use $S$ to generate correlated realizations of $x$ as follows.  Let $z$ be a normally-distributed random vector of the same dimension as $x$, with zero mean and unit variance, that is
\begin{equation}
	z \sim N(0,I)
\end{equation}
Then, with
\begin{equation}
	x = S z
\end{equation}
we can generate properly correlated realizations of $x$.  We can also use a Cholesky factorization of the measurement noise covariance $R$, if $R$ is non-diagonal, to transform correlated measurements into uncorrelated auxiliary measurements for cases in which the estimator cannot handle correlated measurement data.

If $P$ is only non-negative definite, i.e.\@ $P \geq 0$ rather than $P > 0$ as above, the Cholesky factorization does not exist.  In this case, since $P$'s eigenvalues are real and distinct, it has a diagonal factorization:
\begin{equation}
	P = V D V'
\end{equation}
where $V$ is a matrix of eigenvectors and $D$ is a diagonal matrix of eigenvalues.
Then, with $z$ as above,
\begin{equation}
	x = V \sqrt{D} z
\end{equation}
where $\sqrt{D}$ implies taking the square roots of each diagonal element.

\subsection{Zero-Input Bias State Models}

The simplest non-zero measurement error consists only of measurement noise.  The next simplest class of measurement errors consists of biases which are either themselves constant, or are the integrals of constants.  We can view such biases as the output of a system which has zero inputs, and which may have internal states.  In the sequel, we will consider cases where there are random inputs to the system.

In cases were the bias is the output of a system with internal states, the estimator may treat the internal states as solve-for or consider parameters.  In such cases, the estimator requires a measurement partials matrix.  Otherwise, the ``measurement partial'' is just $H = \partial b / \partial b = 1$.

\subsubsection{Random Constant}

The simplest type of systematic error is a constant bias on the measurement.  There are two types of such biases: deterministic constants, which are truly constant for all time, and random constants, which are constant or very nearly so over a particular time of interest.  For example, each time a sensor is power-cycled, a bias associated with it may change in value, but so long as the sensor remains powered on, the bias will not change.

In some cases, we may have reason to believe that a particular systematic error source truly is a deterministic bias, but due to limited observability, we do not have knowledge of its true value.  In such cases, we may view our estimate of the bias as a random constant, and its variance as a measure of the imprecision of our knowledge.

Thus, we may view all constants that could be solve-for or consider parameters in orbit determination as random constants.  Our model for a random constant is
\begin{equation}
	\dot{b}(t) = 0, \, b(t_o) \sim N(0, p_{bo}).
\end{equation}
Since $b(t)$ is a zero-mean constant, its mean is zero for all time, and its covariance is constant for all time as well.  Thus, to simulate a realization of the random constant, we need only generate a random number according to $N(0, p_{bo})$, as the previous subsection described.

\subsubsection{Random Ramp}

The random ramp model assumes that the rate of change of the bias is itself a random constant; thus the random ramp model is
\begin{equation}
	\ddot{b}(t) = 0, \, \dot{b}(t_o) \sim N(0, p_{\dot{b}o}).
\end{equation}
Thus, the initial condition $\dot{b}(t_o)$ is a random constant.  For a pure random ramp, the initial condition on $b(t_o)$ and its covariance are taken to be zero, but an obvious and common generalization is to allow $b(t_o)$ to also be a random constant.

It is convenient to write this model as a first-order vector system as follows:
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \ddot{b}(t) \end{bmatrix} =
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \end{bmatrix} \\
	\dot{x}(t) &=& A(t) x(t)
\end{eqnarray}
The resulting output equation is
\begin{eqnarray}
	e & = &  \begin{bmatrix} 1 & 0 \end{bmatrix} x + v \\
	& = & H x + v
\end{eqnarray}
Note that the ensemble of realizations of $x(t)$ has zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o)
\end{equation}
where
\begin{equation}
	\Phi(t) = \begin{bmatrix} 1 & t \\ 0 & 1 \end{bmatrix} \, \text{and} \;
	P_{xo} = \begin{bmatrix} p_{bo} & 0 \\ 0 & p_{\dot{b}o} \end{bmatrix}
\end{equation}
which we can also write in recursive form as
\begin{equation}
	P_x(t+\Delta t) = \Phi(\Delta t)P_x(t)\Phi'(\Delta t)
\end{equation}
Thus, we can generate realizations of the random ramp with either $x(t) \sim N(0, P_x(t))$ or recursively from
\begin{equation}
	x(t+\Delta t) = \Phi(\Delta t) x(t)
\end{equation}

Note that $\|P_x\|$ becomes infinite as $t^2$ becomes infinite.  This could lead to an overflow of the representation of $P_x$ in a computer program if the propagation time is large, and could also lead to the representation of $P_x$ losing either its symmetry and/or its positive definiteness due to roundoff and/or truncation.

\subsubsection{Higher-Order Derivatives of Random Constants}

In principle, a random constant may be associated with any derivative of the bias in a straightforward extension of the models above.  In practice, it is rare to need more than two derivatives.  Conventional terminology does not appear in the literature for derivatives of higher order than the random ramp.  The slope of the bias is most commonly described as the ``bias drift,'' so that a ``drift random ramp'' would be one way to describe a bias whose second derivative is a random constant.  The measurement partials matrix needs to be accordingly padded with trailing zeros for the derivatives of the bias in such cases.

\subsection{Single-Input Bias State Models}

The simplest non-constant systematic errors are systems with a single input that is a random process.  We can think of a random process as the result of some kind of limit in which the intervals between an uncorrelated sequence of random variables get infinitesimally small.  In this limit, each random increment instantaneously perturbs the sequence, so that the resulting process is continuous but non-differentiable.  We call this kind of a random input ``process noise.''

Although such random processes are non-differentiable, there are various techniques for generalizing the concept of integration so that something like integrals of the process noise exist, and hence so do the differentials that appear under the integral signs.  It turns out that so long as any coefficients of the process noise are non-random, these differentials behave for all practical purposes as if they were differentiable.

\subsubsection{Random Walk}

The random walk is the simplest random process of the type described above.  In terms of the ``formal derivatives'' mentioned above, the random walk model for a measurement bias is
\begin{equation}
	\dot{b}(t) = w(t), \, w(t) \sim N(0, q\delta(t-s))
\end{equation}
The input noise process on the right hand side is known as ``white noise,'' and the Dirac delta function that appears in the expression for its variance indicates that the white noise process consists of something like an infinitely-tightly spaced set of impulses.  The term $q$ that appears along with the delta function is the intensity of each impulse\footnote{Another way to imagine the input sequence, in terms of a frequency domain interpretation, is that it is a noise process whose power spectral density, $q$, is non-zero at all frequencies, which implies infinite bandwidth.}.  The initial condition $b(t_o)$ is an unbiased random constant.  Since $b(t_o)$ and $w(t)$ are zero-mean, then $b(t)$ is also zero-mean for all time.  The variance of $b$ evolves in time according to
\begin{equation}
	p_b(t) = p_{bo} + q (t-t_o)
\end{equation}
which we can also write in recursive form as
\begin{equation}
	p_b(t+\Delta t) = p_b(t) + q\Delta t
\end{equation}
Thus, to generate a realization of the random walk at time $t$, we need only generate a random number according to $N(0, p_b(t))$.  Equivalently, we could also generate realizations of $w_\Delta(t) \sim N(0, q\Delta t)$, and recursively add these discrete noise increments to the bias as follows:
\begin{equation}
	 b(t+\Delta t) = b(t) + w_\Delta(t)
\end{equation}

Note that $p_b$ becomes infinite as $t$ becomes infinite.  This could lead to an overflow of the representation of $p_b$ in a computer program if both the propagation time and $q$ are large.

\subsubsection{Random Run}

The random run model assumes that the rate of change of the bias is itself a random walk; thus the random run model is
\begin{equation}
	\ddot{b}(t) = w(t), \, w(t) \sim N(0, q\delta(t-s))
\end{equation}
The initial condition $\dot{b}(t_o)$ is a random constant.  For a pure random run, the initial condition on $b(t_o)$ and its covariance are taken to be zero, but an obvious and common generalization is to allow $b(t_o)$ to also be a random constant.

It is convenient to write this model as a first-order vector system as follows:
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \ddot{b}(t) \end{bmatrix} =
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \end{bmatrix} +
	\begin{bmatrix} 0 \\ 1 \end{bmatrix} w(t) \\
	\dot{x}(t) &=& A(t) x(t) + b(t) w(t)
\end{eqnarray}
The measurement partial is the same as for the random ramp.  The initial condition $x(t_o)$ is an unbiased random constant.  Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o) + Q_\Delta(t-t_o)
\end{equation}
where
\begin{equation}
	\Phi(t) = \begin{bmatrix} 1 & t \\ 0 & 1 \end{bmatrix} \, \text{and} \;
	P_{xo} = \begin{bmatrix} p_{bo} & 0 \\ 0 & p_{\dot{b}o} \end{bmatrix}
\end{equation}
and
\begin{equation}
	Q_\Delta(t) = q\begin{bmatrix} t^3/3 & t^2/2 \\ t^2/2 & t \end{bmatrix}
\end{equation}
which we can also write in recursive form as
\begin{equation}
	P_x(t+\Delta t) = \Phi(\Delta t)P_x(t)\Phi'(\Delta t) + Q_\Delta(\Delta t)
\end{equation}
Thus, we can generate realizations of the random run with either $x(t) \sim N(0, P_x(t))$ or recursively from
\begin{equation}
	x(t+\Delta t) = \Phi(\Delta t) x(t) + w_\Delta(t)
\end{equation}
where $w_\Delta(t) \sim N(0, Q_\Delta(\Delta t))$.  Note that a Cholesky decomposition of $Q_\Delta(t)$ is
\begin{equation}
	\sqrt[C]{Q_\Delta(t)} = \begin{bmatrix} \sqrt{3t^3}/3 & 0 \\ \sqrt{3t}/2 & \sqrt{t}/2 \end{bmatrix}
\end{equation}

Note that $\|P_x\|$ becomes infinite as $t^3$ becomes infinite.  This could lead to an overflow of the representation of $P_x$ in a computer program if both the propagation time and $q$ are large, and could also lead to the representation of $P_x$ losing either its symmetry and/or its positive definiteness due to roundoff and/or truncation.

\subsubsection{Higher-Order Derivatives of Random Walks}

In principle, a random walk may be associated with any derivative of the bias in a straightforward extension of the models above.  In practice, it is rare to need more than two derivatives.  Conventional terminology does not appear in the literature for derivatives of higher order than the random run.  A ``drift random run'' would be one way to describe a bias whose second derivative is a random walk.  Below, we will refer to such a model as a ``random zoom.''

\subsubsection{First-Order Gauss-Markov}

The first-order Gauss-Markov (FOGM) process is one of the simplest random processes that introduces time correlation between samples.  In terms of a frequency domain interpretation, we can view it as white noise passed through a low-pass filter.  Since such noise, often called ``colored noise,'' has finite bandwidth, it is physically realizable, unlike white noise.  In the notation of formal derivatives, the FOGM model is
\begin{equation}
	\dot{b}(t) = -\frac{1}{\tau} b(t) + w(t),
\end{equation}
where, as with the random walk, $b(t_o) \sim N(0, P_{bo})$, and $w(t) \sim N(0, q\delta(t-s))$.  The time constant, $\tau$, also known as the ``half-life,'' gives the correlation time, or the time over which the intensity of the time correlation will fade to half its value.

Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	p_b(t) = \text{e}^{-\frac{2}{\tau}(t-t_o)}p_{bo} + q_\Delta(t-t_o)
\end{equation}
where
\begin{equation}
	q_\Delta(t-t_o) = \frac{q\tau}{2}\left(1-\text{e}^{-\frac{2}{\tau}(t-t_o)}\right)
\end{equation}
which we can also write in recursive form as
\begin{equation}
	p_b(t+\Delta t) = \text{e}^{-\frac{2\Delta t}{\tau}}p_b(t) + q_\Delta(\Delta t)
\end{equation}
Thus, to generate a realization of the random walk at time $t$, we need only generate a random number according to $N(0, p_b(t))$.  Equivalently, we could also generate realizations of $w_\Delta(t) \sim N(0, q_\Delta(\Delta t))$, and recursively add these discrete noise increments to the bias as follows:
\begin{equation}
	 b(t+\Delta t) = \text{e}^{-\frac{\Delta t}{\tau}}b(t) + w_\Delta(t)
\end{equation}

Note that $p_b$ approaches a finite steady-state value of $q\tau/2$ as $t$ becomes infinite.  We can choose the parameters of the FOGM so that this steady-state value avoids any overflow of the representation of $p_b$ in a computer program.

\subsubsection{Integrated First-Order Gauss-Markov Model}

As with the random walk and random constant models, any number of derivatives of the bias may be associated with a FOGM process.  However, integation of the FOGM destroys its stability.  For example, the singly integrated first-order Gauss-Markov model is given by
\begin{equation}
	\left[\begin{array}{c}
		\dot{b}(t) \\
		\dot{d}(t)
	\end{array}\right] =
	\left[\begin{array}{cc}
		0 & 1 \\
		0 & -1/\tau
	\end{array}\right]
	\left[\begin{array}{c}
		b(t) \\
		d(t)
	\end{array}\right]
	+ \left[\begin{array}{c}
		0 \\
		w(t)
	\end{array}\right],
\end{equation}
which leads to the following state transition matrix,
\begin{equation}
	\Phi(t) = \left[\begin{array}{cc}
		1 & \tau \left( 1-e^{-t/\tau} \right) \\
		0 & e^{-t/\tau}
	\end{array}\right],
\end{equation}
and process noise covariance,
\begin{equation}
	Q_\Delta(t) = \frac{q\tau}{2} \left[\begin{array}{cc}
		\tau^2 \left\{ \left( 1-e^{-2t/\tau} \right)^2  +2t/\tau
		+ 4 \left( 1-e^{-t/\tau} \right) \right\}
		& \tau \left( 1-e^{-t/\tau} \right)^2 \\
		\tau \left( 1-e^{-t/\tau} \right)^2 & \left( 1-e^{-2t/\tau} \right)
	\end{array}\right].
\end{equation}
Clearly, this is an unstable model, as the bias variance increases linearly with elapsed time.  If a Gauss-Markov model is desired because of its stability properties, the following second-order model is available.

\subsubsection{Second-Order Gauss-Markov}

The model for a second-order Gauss-Markov random process is
\begin{equation}
	\ddot{b}(t) = -2\zeta\omega_n \dot{b}(t) -\omega_n^2 b(t) + w(t), \, w(t) \sim N(0, q\delta(t-s))
\end{equation}
The initial conditions $b(t_o)$ and $\dot{b}(t_o)$ are random constants.  It is convenient to write this model as a first-order vector system as follows:
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \ddot{b}(t) \end{bmatrix} =
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} 0 & 1 \\ -\omega_n^2 & -2\zeta\omega_n \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \end{bmatrix} +
	\begin{bmatrix} 0 \\ 1 \end{bmatrix} w(t) \\
	\dot{x}(t) &=& A(t) x(t) + b(t) w(t)
\end{eqnarray}
The measurement partial is the same as for the random ramp.  The initial condition $x(t_o)$ is an unbiased random constant.  Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.

The covariance evolves in time according to according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o) + Q_\Delta(t-t_o)
\end{equation}
which we can also write in recursive form as
\begin{equation}
	P_x(t+\Delta t) = \Phi(\Delta t)P_x(t)\Phi'(\Delta t) + Q_\Delta(\Delta t)
\end{equation}
Thus, we can generate realizations of the random run with either $x(t) \sim N(0, P_x(t))$ or recursively from
\begin{equation}
	x(t+\Delta t) = \Phi(\Delta t) x(t) + w_\Delta(t)
\end{equation}
where $w_\Delta(t) \sim N(0, Q_\Delta(\Delta t))$.

For the underdamped case ($\zeta < 1$), the state transition matrix and discrete process noise covariance are given by\footnote{M.~C. Wang and G.~E. Uhlenbeck. On the theory of brownian motion ii. In N.~Wax, editor, {\em Selected Papers on Noise and Stochastic Processes}, pages 113--132. Dover, 1954.}:
\begin{equation}
	\Phi(t) = \frac{\text{e}^{-\zeta\omega_{n}t}}{w_{d}}
	\begin{bmatrix}
		(\omega_{d}\cos\omega_{d}t + \zeta\omega_{n}\sin\omega_{d}t) &
		\sin\omega_{d}t  \\
		-\omega_{n}^{2}\sin\omega_{d}t &
		(\omega_{d}\cos\omega_{d}t - \zeta\omega_{n}\sin\omega_{d}t)
	\end{bmatrix}
\end{equation}
and
\begin{eqnarray}
	Q^{(1,1)}_\Delta(t) &=&  \frac{q}{4\zeta\omega_{n}^{3}}\left[ 1
	- \frac{\text{e}^{-2\zeta\omega_{n}t}}{w_{d}^{2}}(\omega_{d}^{2}
	+ 2\zeta\omega_{n}\omega_{d}\cos\omega_{d}t\sin\omega_{d}t
	+ 2\zeta^{2}\omega_{n}^{2}\sin^{2}\omega_{d}t)\right] \\
	Q^{(2,2)}_\Delta(t) &=&  \frac{q}{4\zeta\omega_{n}}\left[ 1
	- \frac{\text{e}^{-2\zeta\omega_{n}t}}{w_{d}^{2}}(\omega_{d}^{2}
	- 2\zeta\omega_{n}\omega_{d}\cos\omega_{d}t\sin\omega_{d}t
	+ 2\zeta^{2}\omega_{n}^{2}\sin^{2}\omega_{d}t)\right] \\
	Q^{(2,1)}_\Delta(t) = Q^{(1,2)}_\Delta(t) &=& \frac{q}{2\omega_{d}^{2}}
	\text{e}^{-2\zeta\omega_{n}t}\sin^{2}\omega_{d}t
\end{eqnarray}
where $\omega_d = \omega_n\sqrt{1-\zeta^2}$. In the over-damped case ($\zeta > 1$), replace $\sin$ and $\cos$ with $\sinh$ and $\cosh$, respectively.  In the critically-damped case,
\begin{equation}
	\Phi(t) =
	\begin{bmatrix}
		\text{e}^{-\omega_{n}t}(1 + \omega_{n}t) &
		t\text{e}^{-\omega_{n}t}  \\
		-\omega_{n}^{2}t\text{e}^{-\omega_{n}t} &
		 \text{e}^{-\omega_{n}t}(1 - \omega_{n}t)
	\end{bmatrix}
\end{equation}
and
\begin{eqnarray}
	Q^{(1,1)}_\Delta(t) &=& \frac{q}{4\omega_{n}^{3}}\left[ 1
	- \text{e}^{-2\omega_{n}t}(1
	+ 2\omega_{n}t
	+ 2\omega_{n}^{2}t^2)\right]  \\
	Q^{(2,2)}_\Delta(t) &=& \frac{q}{4\omega_{n}}\left[ 1
	- \text{e}^{-2\omega_{n}t}(1
	- 2\omega_{n}t
	+ 2\omega_{n}^{2}t^2)\right]  \\
	Q^{(2,1)}_\Delta(t) = Q^{(1,2)}_\Delta(t) &=& \frac{q t^2}{2}
	\text{e}^{-2\omega_{n}t}
\end{eqnarray}

Note that for any damping ratio, $\|P_x\|$ remains finite, since as $t\rightarrow\infty$,
\begin{equation}
	P_x(t\rightarrow\infty) = \frac{q}{4\zeta\omega_{n}}\left[
	\begin{array}{cc}
		1/\omega_{n}^{2} & 0  \\
		0 & 1
	\end{array}\right].
\end{equation}
Thus, the ratio of the steady-state standard deviations of $x$ and $\dot{x}$ will be
\begin{equation}
	\frac{\sigma_{d}}{\sigma_{b}} = \omega_{n},
\end{equation}
and these are related to the power spectral density by
\begin{equation}
	q = 4\zeta\frac{\sigma_{d}^{3}}{\sigma_{b}}.
\end{equation}
Hence, we can choose the parameters of the SOGM so that we avoid any overflow, loss of symmetry and/or positive definiteness of $P_x$ due to roundoff and/or truncation.

\subsection{Multi-Input Bias State Models}

We may combine any of the above models to create multi-input bias models; for example the bias could be a second-order Gauss-Markov, and the bias rate could be a first-order Gauss-Markov.  In practice, the most useful have been found to be the following.

\subsubsection{Bias and Drift Random Walks (Random Walk + Random Run)}

A common model for biases in clocks, gyros, and accelerometers is that the bias is driven by both its own white noise input, and also by the integral of the white noise of its drift.  Such models derive from observations that the error magnitudes of these devices depend on the time scale over which the device is observed.  They are often characterized by Allan deviation specifications, which may be heuristically associated with the white noise power spectral densities.  The model is as follows:
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \end{bmatrix} +
	\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
	\begin{bmatrix} w_b(t) \\ w_d(t) \end{bmatrix} \\
	\dot{x}(t) &=& A(t) x(t) + B(t) w(t)
\end{eqnarray}
The measurement partial is the same as for the random ramp.  The initial condition $x(t_o)$ is an unbiased random constant.  Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o) + Q_\Delta(t-t_o)
\end{equation}
where
\begin{equation}
	\Phi(t) = \begin{bmatrix} 1 & t \\ 0 & 1 \end{bmatrix} \, \text{and} \;
	P_{xo} = \begin{bmatrix} p_{bo} & 0 \\ 0 & p_{\dot{b}o} \end{bmatrix}
\end{equation}
and
\begin{equation}
	Q_\Delta(t) = \begin{bmatrix} q_b t + q_d t^3/3 & q_d t^2/2 \\ q_d t^2/2 & q_d t \end{bmatrix}
\end{equation}
which we can also write in recursive form as
\begin{equation}
	P_x(t+\Delta t) = \Phi(\Delta t)P_x(t)\Phi'(\Delta t) + Q_\Delta(\Delta t)
\end{equation}
Thus, we can generate realizations of the random run with either $x(t) \sim N(0, P_x(t))$ or recursively from
\begin{equation}
	x(t+\Delta t) = \Phi(\Delta t) x(t) + w_\Delta(t)
\end{equation}
where $w_\Delta(t) \sim N(0, Q_\Delta(\Delta t))$.  Note that a Cholesky decomposition of $Q_\Delta(t)$ is
\begin{equation}
	\sqrt[C]{Q_\Delta(t)} = \begin{bmatrix} \sqrt{q_b t + q_d t^3/12} & 0 \\ \sqrt{q_d t^3}/2 & \sqrt{q_d t} \end{bmatrix}
\end{equation}

Note that $\|P_x\|$ becomes infinite as $t^3$ becomes infinite.  This could lead to an overflow of the representation of $P_x$ in a computer program if both the propagation time and $q$ are large, and could also lead to the representation of $P_x$ losing either its symmetry and/or its positive definiteness due to roundoff and/or truncation.

\subsubsection{Bias, Drift, and Drift Rate Random Walks (Random Walk + Random Run + Random Zoom)}

Another model for biases in very-high precision clocks, gyros, and accelerometers is that the bias is driven by two integrals of white noise in addition to its own white noise input.  Such models are often characterized by Hadamard deviation specifications, which may be heuristically associated with the white noise power spectral densities.  The model is as follows:
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \\ \ddot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} 0 & 1 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \\ \dot{d}(t) \end{bmatrix} +
	\begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \end{bmatrix}
	\begin{bmatrix} w_b(t) \\ w_d(t) \\ w_{\dot{d}}(t) \end{bmatrix} \\
	\dot{x}(t) &=& A(t) x(t) + B(t) w(t)
\end{eqnarray}
The resulting output equation is
\begin{eqnarray}
	e & = &  \begin{bmatrix} 1 & 0 & 0 \end{bmatrix} x + v \\
	& = & H x + v
\end{eqnarray}
The initial condition $x(t_o)$ is an unbiased random constant.  Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o) + Q_\Delta(t-t_o)
\end{equation}
where
\begin{equation}
	\Phi(t) = \begin{bmatrix} 1 & t & t^2/2 \\ 0 & 1 & t \\ 0 & 0 & 1 \end{bmatrix} \, \text{and} \;
	P_{xo} = \begin{bmatrix} p_{bo} & 0 & 0 \\ 0 & p_{do} & 0 \\ 0 & 0 & p_{\dot{d}o} \end{bmatrix}
\end{equation}
and
\begin{equation}
	Q_\Delta(t) = \begin{bmatrix}
	q_b t + q_d t^3/3 + q_{\dot{d}} t^5/5 &
	q_d t^2/2 + q_{\dot{d}} t^4/8 &
	q_{\dot{d}}t^3/6 \\
	q_d t^2/2 + q_{\dot{d}} t^4/8 &
	q_d t + q_{\dot{d}} t^3/3 &
	q_{\dot{d}}t^2/2 \\
	q_{\dot{d}}t^3/6 & q_{\dot{d}}t^2/2 &  q_{\dot{d}} t
	\end{bmatrix}
\end{equation}
which we can also write in recursive form as
\begin{equation}
	P_x(t+\Delta t) = \Phi(\Delta t)P_x(t)\Phi'(\Delta t) + Q_\Delta(\Delta t)
\end{equation}
Thus, we can generate realizations of the random run with either $x(t) \sim N(0, P_x(t))$ or recursively from
\begin{equation}
	x(t+\Delta t) = \Phi(\Delta t) x(t) + w_\Delta(t)
\end{equation}
where $w_\Delta(t) \sim N(0, Q_\Delta(\Delta t))$.  Note that a Cholesky decomposition of $Q_\Delta(t)$ is
\begin{equation}
	\sqrt[C]{Q_\Delta(t)} = \begin{bmatrix}
	\sqrt{q_b t + q_d t^3/12 + q_{\dot{d}}t^5/720} & 0 & 0 \\
	t/2\sqrt{q_d t + q_{\dot{d}}t^3/12} & \sqrt{q_d t + q_{\dot{d}}t^3/12} & 0 \\
	t^2/6\sqrt{q_{\dot{d}}t} & t/2\sqrt{q_{\dot{d}}t} &
	\sqrt{q_{\dot{d}} t}
	\end{bmatrix}
\end{equation}

Note that $\|P_x\|$ becomes infinite as $t^3$ becomes infinite.  This could lead to an overflow of the representation of $P_x$ in a computer program if both the propagation time and $q$ are large, and could also lead to the representation of $P_x$ losing either its symmetry and/or its positive definiteness due to roundoff and/or truncation.

\subsubsection{Bias and Drift Coupled First- and Second-Order Gauss-Markov}

The following model provides a stable alternative to the ``Random Walk + Random Run'' model\footnote{R.~Carpenter and T.~Lee. A stable clock error model using coupled first- and second-order gauss-markov processes. In {\em Astrodynamics 2008}, Advances in the Astronautical Sciences. Univelt, 2008.}.  Its transient response can be tuned to approximate the Random Walk + Random Run model, and its stable steady-state response can be used to avoid computational issues with long propagation times.  The model is as follows.
\begin{eqnarray}
	\begin{bmatrix} \dot{b}(t) \\ \dot{d}(t) \end{bmatrix} &=&
	\begin{bmatrix} -1/\tau & 1 \\ -\omega_n^2 & -2\zeta\omega_n \end{bmatrix}
	\begin{bmatrix} b(t) \\ d(t) \end{bmatrix} +
	\begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix}
	\begin{bmatrix} w_b(t) \\ w_d(t) \end{bmatrix} \\
	\dot{x}(t) &=& A(t) x(t) + B(t) w(t)
\end{eqnarray}
The measurement partial is the same as for the random ramp.  The initial condition $x(t_o)$ is an unbiased random constant.  Since $x(t_o)$ and $w(t)$ are zero-mean, then $x(t)$ is also zero-mean for all time.  The covariance evolves in time according to
\begin{equation}
	P_x(t) = \Phi(t-t_o)P_{xo}\Phi'(t-t_o) + Q_\Delta(t-t_o)
\end{equation}
where
\begin{equation}
	\Phi(t) = \frac{e^{at}}{b}\left[\begin{array}{cc}
		b\cos bt + \left(a + 2\zeta\omega_n\right)\sin bt & \sin bt \\
		-\omega_n^2\sin bt & b\cos bt + \left(a + \beta\right)\sin bt
	\end{array}\right]
\end{equation}
where
\begin{align}
	\beta &= 1/\tau, \\
	a &= -\frac{1}{2}\left(\beta + 2\zeta\omega_n\right), \\
	b &= \sqrt{\omega_d^2 + \beta\zeta\omega_n - \frac{1}{4}\beta^2}, \\
	\omega_d &= \omega_n\sqrt{1 - \zeta^2},
\end{align}
and we assume that $b^2 > 0$.
Let $$c = -\frac{\beta}{2} + \zeta\omega_n;$$ then, the process noise covariance is given by the following:
\begin{align}\begin{split}
	Q_\Delta^{(1,1)}(t) =\; & q_b \left[ \frac{e^{2at}-1}{4a}
	\left( 1+\frac{c^2}{b^2} \right) + \frac{e^{2at}\sin2bt}{4(a^2+b^2)}
	\left( \frac{b^2-c^2+2ac}{b} \right) \right. \\
	&\left. + \frac{e^{2at}\cos2bt-1}{4(a^2+b^2)}
	\left( \frac{ab^2-ac^2+2b^2c}{b^2} \right) \right] \\
	& + \frac{q_d}{b^2} \left( \frac{e^{2at}-1}{4a} -
	\frac{e^{2at}(b\sin2bt + a\cos2bt) - a}{4(a^2+b^2)} \right)
\end{split} \\
\begin{split}
	Q_\Delta^{(2,2)}(t) =\; & q_d \left[ \frac{e^{2at}-1}{4a}
	\left( 1+\frac{c^2}{b^2} \right) + \frac{e^{2at}\sin2bt}{4(a^2+b^2)}
	\left( \frac{b^2-c^2+2ac}{b} \right) \right. \\
	&\left. + \frac{e^{2at}\cos2bt-1}{4(a^2+b^2)}
	\left( \frac{ab^2-ac^2+2b^2c}{b^2} \right) \right] \\
	& + \frac{q_b \omega_n^4}{b^2} \left( \frac{e^{2at}-1}{4a} -
	\frac{e^{2at}(b\sin2bt + a\cos2bt) - a}{4(a^2+b^2)} \right)
\end{split} \\
\begin{split}
	Q_\Delta^{(1,2)}(t) =\; & \frac{q_b \omega_n^2}{b^2} \left[ \frac{c}{4a}
	\left( 1 - e^{2at} \right)
	+ \frac{e^{2at} \left[ (bc-ab)\sin2bt + (ac-b^2)\cos2bt \right]
	-(ac-b^2)}{4(a^2+b^2)} \right] \\
	& + \frac{q_d}{b^2} \left[ \frac{c}{4a} \left( 1 - e^{2at} \right)
	+ \frac{e^{2at} \left[ (ab+bc)\sin2bt + (ac-b^2)\cos2bt \right]
	-(ac-b^2)}{4(a^2+b^2)} \right].
\end{split}\end{align}

Examining the solution given above, we see that the parameter $a$ governs the rate of decay of all of the exponential terms.  Therefore, we define the ``rise time'' as that interval within which the transient response of the covariance will reach a close approximation to the above steady-state value; thus, we define the rise time as follows:
\begin{equation}
	t_r = -\frac{3}{a}.
\end{equation}

Next, we note that all of the trigonometric terms are modulated by $2b$; thus we may view this value as a characteristic damped frequency of the coupled system.  The period of the oscillation, $\Pi$, is then
\begin{equation}
	\Pi = \pi/b
\end{equation}

In the limit as $t\rightarrow\infty$, all the exponential terms in the analytical solution die out, so that the steady-state value of the covariance simplifies to:
\begin{equation}
	P(\infty) = -\frac{1}{4a(a^2+b^2)}
	\left[\begin{array}{cc}
		q_d + (2a^2 + b^2 + c^2 - 2ac) q_b & \beta (q_d + q_b \omega_n^2) \\
		\beta (q_d + q_b \omega_n^2) & (2a^2 + b^2 + c^2 + 2ac) q_d
		+ q_b \omega_n^4
	\end{array}\right]
\end{equation}