\chapter{Zener Diode-Voltage Regulator}
	\section{Aim}
		\begin{itemize}
			\tightlist
			\item Explain the function of a Zener diode
			\item Explain Zener Diode as Voltage Regulator
		\end{itemize}

	\section{Apparatus}
		\begin{itemize}
			\tightlist
			\item Zener Diode
			\item Resistors
			\item Ammeter
			\item Voltmeter
			\item DC Battery Source
		\end{itemize}

	\section{Theory}
		\subsection{Zener Diode}
			A Zener Diode is a special kind of diode which permits current to flow in the forward direction as normal, but will also allow it to flow in the reverse direction when the voltage is above the breakdown voltage or ‘zener’ voltage. Zener diodes are designed so that their breakdown voltage is much lower - for example just 2.4 Volts.
			\begin{figure}[ht]
				\centering
				\subfloat[Zener Diode]{\includegraphics[width=0.45\textwidth]{img/exp8/1}
					\label{fig:zener_pic}}
				\hfill
				\subfloat[Symbol of Zener Diode]{\includegraphics[width=0.45\textwidth,valign=c]{img/exp8/2}
					\label{fig:zener_symbol}}
				\caption{\textit{Zener Diode image and symbol}}
			\end{figure}

		\subsection{Function of Zener Diode}
			\begin{enumerate}
				\item Zener diodes are a special kind of diode which permits current to flow in the forward direction.
				\item Zener diodes will also allow current to flow in the reverse direction when the voltage is above a certain value. This breakdown voltage is known as the Zener voltage. In a standard diode, the Zener voltage is high, and the diode is permanently damaged if a reverse current above that value is allowed to pass through it.
				\item In the reverse bias direction, there is practically no reverse current flow until the breakdown voltage is reached. When this occurs there is a sharp increase in reverse current. Varying amount of reverse current can pass through the diode without damaging it. The breakdown voltage or zener voltage (\(V_Z\)) across the diode remains relatively constant.
			\end{enumerate}

		\subsection{Zener Diode As A Voltage Regulator}
			A voltage regulator is an electronic circuit that provides a stable DC voltage independent of the load current, temperature and AC line voltage variations. A Zener diode of break down voltage \(V_Z\) is reverse connected to an input voltage source \(V_I\) across a load resistance \(R_L\) and a series resistor \(R_S\). The voltage across the zener will remain steady at its break down voltage \(V_Z\) for all the values of zener current \(I_Z\)  as long as the current remains in the break down region. Hence a regulated DC output voltage \(V_0 = V_Z\) is obtained across \(R_L\), whenever the input voltage remains within a minimum and maximum voltage. Basically there are two type of regulations such as:

			\textbf{Line Regulation}: In this type of regulation, series resistance and load resistance are fixed, only input voltage is changing. Output voltage remains the same as long as the input voltage is maintained above a minimum value.

			\textbf{Load Regulation}: In this type of regulation, input voltage is fixed and the load resistance is varying. Output volt remains same, as long as the load resistance is maintained above a minimum value.

			\subsubsection{Line Regulation}
				\begin{figure}[h]
					\centering
					\includegraphics[width=0.5\linewidth]{img/exp8/3}
					\caption{Zener Diode for Line Regulation}
					\label{fig:zener_lineRegulation}
				\end{figure}
				In Line Regulation, Load resistance is constant and input voltage varies. \(V_I\) must be sufficiently large to turn the Zener Diode ON.
				$$V_L = V_Z= \frac{V_{Imin} \times R_L}{(R_S + R_L)}$$
				So, the minimum turn-on voltage \(V_{Imin}\) is :
				$$ V_{Imin}= \frac{V_Z \times (R_S + R_L)}{R_L}$$

				The maximum value of \(V_I\) is limited by the maximum zener current \(I_{Zmax}\)
				$$I_{Rmax}= I_{Zmax} + I_L $$

				\(I_L\) is fixed at :
				$$\frac{V_Z}{R_L} \qquad Since, V_L=V_Z $$

				So maximum \(V_I\) is
				$$ V_{Imax} = V_{Rmax} + V_Z$$
				or,
				$$V_{Imax} = I_{Rmax} \times R + V_Z$$

				For \(V_I < V_Z\),
				$$ V_O= V_I$$

				For \(V_I > V_Z\),
				$$ V_O = V_I − I_S \times R_S$$

			\subsection{Load Regulation}
				\begin{figure}[h]
					\centering
					\includegraphics[width=0.5\linewidth]{img/exp8/4}
					\caption{Zener Diode for Load Regulation}
					\label{fig:zener_loadRegulation}
				\end{figure}
				In Load Regulation , input voltage is constant and Load resistance varies. Too small a Load Resistance \(R_L\) ,will result in \(V_{Th} < V_Z\) and Zener Diode will be OFF.
				$$V_L = V_Z = \frac{V_{Imin} \times R_L}{(R_S + R_L)}$$

				So the minimum load resistance \(R_L\)
				$$R_{Lmin} = \frac{V_Z \times R_S}{V_I− V_Z}$$

				Any load resistance greater than \(R_{Lmin}\) will make Zener Diode ON
				$$ I_S = I_L + I_Z$$

				\(R_{Lmin}\) will establish maximum \(I_L\) as
				$$I_{Lmax}=\frac{V_L}{R_{Lmin}}= \frac{V_Z}{R_{Lmin}} \qquad Since, V_L=V_Z$$

				\(V_S\)is the voltage drop across \(R_S\)
				$$V_S = V_{Imin} - V_Z$$
				$$I_S = \frac{V_{Imin}− V_Z}{R_S}$$

				For \(R_L\) < \(R_{Lmin}\),
				$$V_O= V_I$$

				For \(R_L\) > \(R_{Lmin}\),
				$$V_O = V_I − I_S \times R_S$$

		\section{Procedure}
			\subsection{Zener Diode - Line Regulation}
				\begin{enumerate}
					\tightlist
					\item Set the Zener Voltage($V_Z$)
					\item Set the Series Resistance ($R_S$) value.
					\item Set the Load Resistance ($R_L$) value.
					\item Vary DC voltage.
					\item Voltmeter is placed parallel to load resistor and ammeter series with the series resistor.
					\begin{figure}[h]
						\centering
						\includegraphics[width=0.5\linewidth]{img/exp8/5}
						\caption{Simulation of Zener Diode for Line Regulation}
						\label{fig:zener_Procedure_lineRegulation}
					\end{figure}
					\item Choose appropriate DC voltage such that zener diode is 'on'.
					\item Now note the Voltmeter and Ammeter reading for various DC voltage.
					\item Note the Load current($I_L$), zener current($I_Z$), Output voltage($V_O$)
					\item Calculate the voltage regulation.
				\end{enumerate}

			\subsection{Zener Diode - Load Regulation}
				\begin{enumerate}
					\tightlist
					\item Set DC voltage.
					\item Set the Series Resistance ($R_S$) value.
					\item 1W D0-41 Glass Zener Diode 1N4740A, Zener voltage is 10 V.
					\item Vary the Load Resistance ($R_L$).
					\item Voltmeter is placed parallel to load resistor and ammeter series with the series resistor.
					\begin{figure}[h]
						\centering
						\includegraphics[width=0.5\linewidth]{img/exp8/6}
						\caption{Simulation of Zener Diode for Load Regulation}
						\label{fig:zener_Procedure_loadRegulation}
					\end{figure}
					\item Choose Load Resistance in such a manner, such that the Zener diode is 'on'.
					\item Now note the Voltmeter and Ammeter reading for various Load Resistance.
					\item Increase the load resistance ($R_L$).
					\item Note the Load current($I_L$), zener current($I_Z$), Output voltage($V_O$)
					\item Calculate the voltage regulation.
				\end{enumerate}

			\subsection{Zener Characteristics}
				\begin{enumerate}
					\tightlist
					\item Select the diode.
					\item Set the rheostat $R_h=1\Omega$
					\item By adjusting the rheostat, voltmeter reading is increased from 0 and in each time note the corresponding reading in milliammeter.
					\begin{figure}[h]
						\centering
						\includegraphics[width=0.5\linewidth]{img/exp8/7}
						\caption{Circuit using Zener Diode for knowing its Characteristics}
						\label{fig:zener_Procedure_charac}
					\end{figure}
					\item Take the readings and note Voltmeter reading across Zener diode and Ammeter reading.
					\item Plot the V-I graph and observe the change.
				\end{enumerate}

		\section{Observations}
			\subsection{Zener Diode - Line Regulator}
			Zener Voltage ($V_{Z}$): $5.1 V$\\
			Series Resistance($R_{S}$): $1 K\Omega$\\
			Load Resistance ($R_L$): $2 K\Omega$

			\begin{figure}[h!]
				\begin{longtable}[]{@{}llllll@{}}
					\toprule
					Sr No. & UnRegulated & Load & Zener & Regulated & \% Voltage\tabularnewline
					& Supply Voltage & Current & Current & Output Voltage & Regulation\tabularnewline
					& ($V_S$) (V) & ($I_L$) (mA) & ($I_Z$)(mA) & ($V_O$) (V) & \tabularnewline
					\midrule
					\endhead
					1 & 0 & 2.55 & 0 & 0 & NaN\tabularnewline
					2 & 2.4 & 2.55 & 0 & 2.4 & 100\tabularnewline
					3 & 5.6 & 2.55 & -2.050 & 5.10 & 100\tabularnewline
					4 & 9.6 & 2.55 & 1.950 & 5.10 & 55.6\tabularnewline
					5 & 12.8 & 2.55 & 5.150 & 5.10 & 41.7\tabularnewline
					6 & 16 & 2.55 & 8.350 & 5.10 & 31.3\tabularnewline
					7 & 18.2 & 2.55 & 10.550 & 5.10 & 27.8\tabularnewline
					8 & 22 & 2.55 & 14.350 & 5.10 & 22.7\tabularnewline
					9 & 26 & 2.55 & 18.350 & 5.10 & 19.2\tabularnewline
					10 & 29.2 & 2.55 & 21.550 & 5.10 & 17.2\tabularnewline
					11 & 30 & 2.55 & 22.350 & 5.10 & 16.7\tabularnewline
					\bottomrule
				\end{longtable}
				\caption{Zener Diode Line Regulation Observations}
			\end{figure}

			\begin{figure}[h]
				\centering
				\begin{tikzpicture}
					\begin{axis}[
						title={$V_S - V_O$ Plot},
						width=15cm, height = 6cm,
						xlabel={Source Voltage ($V_S$)},
						ylabel={Output Voltage ($V_O$)},
						xmin=0, xmax=30,
						ymin=0, ymax=6,
						xtick={0,5,10,15,20,25,30},
						ytick={0,2,4,6},
						legend pos=north west,
						ymajorgrids=true,
						grid style=dashed,
%						legend entries = {Forward Biased Silicon Diode}
						]

						\addplot[
						color=blue,very thick, mark = square*
						]
						coordinates {
							(0, 0)
							(2.4, 2.4)
							(5.6, 5.10)
							(9.6, 5.10)
							(12.8, 5.10)
							(16.2, 5.10)
							(18.2, 5.10)
							(22, 5.10)
							(26, 5.10)
							(29, 5.10)
							(30, 5.10)
						};
					\end{axis}
				\end{tikzpicture}
				\caption{$V_S - V_O$ Plot of Zener Diode - LINE Regulator}
			\end{figure}

		\newpage
		\subsection{Zener Diode - Load Regulator}
			Zener Voltage ($V_{Z}$): $5.1 V$\\
			Series Resistance($R_{S}$): $0.1 K\Omega$\\
			DC Voltage ($V_{DC}$): $6 V$

			\begin{figure}[h!]
				\begin{longtable}[]{@{}llllll@{}}
					\toprule
					Sr No. & Load & Load & Zener & Regulated & \% Voltage\tabularnewline
					& Resistance & Current & Current & Output Voltage & Regulation\tabularnewline
					& ($R_L$) ($\Omega$) & ($I_L$) (mA) & ($I_Z$)(mA) & ($V_O$) (V) & \tabularnewline
					\midrule
					\endhead
					1 & 150 & 34.0 & 0 & 6 & 40.0\tabularnewline
					2 & 266 & 19.2 & 0 & 6 & 27.3\tabularnewline
					3 & 395 & 12.9 & 0 & 6 & 20.2\tabularnewline
					4 & 505 & 10.1 & 0 & 6 & 16.5\tabularnewline
					5 & 609 & 8.37 & 0.626 & 5.10 & 14.1\tabularnewline
					6 & 749 & 6.81 & 2.19 & 5.10 & 11.8\tabularnewline
					7 & 865 & 5.90 & 3.10 & 5.10 & 10.4\tabularnewline
					8 & 969 & 5.26 & 3.74 & 5.10 & 9.35\tabularnewline
					9 & 1073 & 4.75 & 4.25 & 5.10 & 8.53\tabularnewline
					10 & 1195 & 4.27 & 4.73 & 5.10 & 7.72\tabularnewline
					11 & 1250 & 4.08 & 4.92 & 5.10 & 7.41\tabularnewline
					\bottomrule
				\end{longtable}
				\caption{Zener Diode Load Regulator Observations}
			\end{figure}
			\newpage
			\begin{figure}[h]
				\centering
				\begin{tikzpicture}
					\begin{axis}[
						title={$R_L - V_O$ Plot},
						width=15cm, height = 6cm,
						xlabel={Load Resistance ($\Omega$)},
						ylabel={Output Voltage ($V$)},
						xmin=0, xmax=1200,
						ymin=0, ymax=8,
						xtick={100,200,300,400,500,600,700,800,900,1000,1100,1200},
						ytick={0,2,4,6,8},
						legend pos=north west,
						ymajorgrids=true,
						grid style=dashed,
						%						legend entries = {Forward Biased Silicon Diode}
						]

						\addplot[
						color=red,very thick,mark = square*
						]
						coordinates {
							(150, 6)
							(266, 6)
							(395, 6)
							(505, 6)
							(609, 5.10)
							(749, 5.10)
							(865, 5.10)
							(969, 5.10)
							(1073, 5.10)
							(1195, 5.10)
							(1250, 5.10)
						};
					\end{axis}
				\end{tikzpicture}
				\caption{$R_L - V_O$ Plot of Zener Diode - LOAD Regulator}
			\end{figure}
		\subsection{Zener Characteristics}
			\begin{figure}[h]
				\begin{longtable}[]{@{}lll@{}}
					\toprule
					Sr No. & Zener Voltage (V) & Current (mA)\tabularnewline
					\midrule
					\endhead
					1 & 0.120 & 0.000\tabularnewline
					2 & 1.911 & 0.000\tabularnewline
					3 & 3.620 & 0.000\tabularnewline
					4 & 4.724 & 0.001\tabularnewline
					5 & 6.354 & 0.002\tabularnewline
					\bottomrule
				\end{longtable}
				\caption{Zener Diode Characteristics}
			\end{figure}

			\begin{figure}[h]
				\centering
				\begin{tikzpicture}
					\begin{axis}[
						title={$V - I$ Plot},
						width=15cm, height = 6cm,
						xlabel={Voltage ($V$)},
						ylabel={Current ($mA$)},
						xmin=0, xmax=7,
						ymin=0, ymax=0.003,
						xtick={0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7},
						ytick={0,0.001,0.002,0.003},
						legend pos=north west,
						ymajorgrids=true,
						grid style=dashed,
						%						legend entries = {Forward Biased Silicon Diode}
						]

						\addplot[
						color=orange,very thick,mark = square*
						]
						coordinates {
							(0.120, 0)
							(1.911, 0)
							(3.620, 0)
							(4.724, 0.001)
							(6.354, 0.002)
							(7.969, 0.003)
							(9.100, 0.006)
						};
					\end{axis}
				\end{tikzpicture}
				\caption{$V - I$ Plot of Zener Characteristics}
			\end{figure}

		\section{Result}
			A Zener Diode is a special kind of diode which permits current to flow in the forward direction as normal, but will also allow it to flow in the reverse direction when the voltage is above the breakdown voltage or ‘zener’ voltage. Zener diodes are designed so that their breakdown voltage is much lower e.g. 2.4 Volts.


\section{Micro-Cell Models and Optimization Scenarios}
\label{sec:63models}

\minitoc{62mm}{3}

\noindent
In the following, we present the different micro-cell models
and optimization scenarios for which we perform numerical
experiments in the next section.

\subsection{Micro-Cell Models}
\label{sec:631models}

We use the various micro-cell models that are depicted in \cref{fig:microCell}.
%\todo{mention paper if published}
The models differ in the spatial dimensionality $\dimobjdomain$
and the number $d$ of micro-cell parameters
$\*x \in \clint{\*0, \*1} = \clint{0, 1}^d$.
Note that the presented models are only some examples.
One can easily design complicated micro-cell models
with larger numbers of parameters.

\begin{figure}
  \subcaptionbox{%
    \lefthphantom{2D cross}{(2D-C, $d = 2$)}\\(2D-C, $d = 2$)%
    \label{fig:microCell_1}%
  }[31mm]{%
    \includegraphics{microCell_1}%
  }%
  \hfill%
  \subcaptionbox{%
    2D framed cross\\(2D-FC, $d = 4$)%
    \label{fig:microCell_2}%
  }[31mm]{%
    \includegraphics{microCell_3}%
  }%
  \hfill%
  \subcaptionbox{%
    2D sheared cross\\\rlap{\hspace*{11mm}{(2D-SC, $d = 3$)}}%
    \label{fig:microCell_3}%
  }[41mm]{%
    \includegraphics{microCell_2}%
  }%
  \hfill%
  \subcaptionbox{%
    2D sheared framed cross (2D-SFC, $d = 5$)%
    \label{fig:microCell_4}%
  }[37.5mm]{%
    \hspace*{-45mm}%
    \rlap{\includegraphics{microCell_4}}%
  }\\[2mm]%
  \subcaptionbox{%
    3D cross (3D-C, $d = 3$)%
    \label{fig:microCell_5}%
  }[44mm]{%
    \includegraphics{microCell_5}%
  }%
  \quad%
  \subcaptionbox{%
    3D sheared cross (3D-SC, $d = 5$)%
    \label{fig:microCell_6}%
  }[56mm]{%
    \hspace*{5mm}%
    \includegraphics{microCell_6}%
  }%
  \caption[Types of micro-cell models]{%
    Types of micro-cell models in two dimensions \emph{(top row)}
    and three dimensions \emph{(bottom row)}.%
  }%
  \label{fig:microCell}%
\end{figure}

\paragraph{Orthogonal (non-sheared) models in two dimensions}

The basic component of the four two-dimensional models
is a square with a cross (\cref{fig:microCell_1})
of two axis-aligned orthogonal bars,
whose widths are determined by two micro-cell parameters $x_1$ and $x_2$.
The micro-cell parameters are ratios of the bar widths
to the edge lengths of the micro-cell
(although the actual micro-cells are infinitesimally small).
This results in the \emph{cross model.}
For the \term{framed cross model} (\cref{fig:microCell_2}),
we add a diagonal cross with orthogonal bars
of widths $x_3$ and $x_4$ (horizontally measured).
To simplify the boundary treatment,
we shift the contents of the framed cross micro-cell by
\SI{50}{\percent} of the micro-cell's edge lengths in both directions,
such that previous corners of the micro-cell correspond to the new center.
%This is possible because the micro-cells are periodic.

\paragraph{Sheared models in two dimensions}

Both of these models can be extended by shearing.
The idea is to increase the stability of the resulting macro-structure
with respect to forces that act at angles other than
\ang{0} and \ang{90} (cross model) or
\ang{0}, \ang{90}, and \ang{45} (framed cross model).
If we just rotated the crosses in the micro-cells,
then the micro-structure would not be periodic.
Instead, we shear the whole micro-cell in the horizontal direction,
where the shearing angle $\theta$ is an additional micro-cell parameter,
which gives us another degree of freedom.%
\footnote{%
  To be more precise, the angle $\theta$ corresponds to an
  additional micro-cell parameter $x_3$ (sheared cross) or
  $x_5$ (sheared framed cross) that is determined by normalization
  from $\clint{-0.35\pi, 0.35\pi}$, i.e., $\theta/(0.7\pi) + 1/2$.%
}
This results in the \term{sheared cross model} (\cref{fig:microCell_3})
and \term{sheared framed cross model} (\cref{fig:microCell_4})
with three and five micro-parameters each.

\paragraph{Models in three dimensions}

The two-dimensional cross model can be transferred to three
spatial dimensions by just adding another bar in the new dimension.
Each of the three bars has square cross-section with given edge lengths
$x_1$, $x_2$, or $x_3$, respectively,
resulting in the \term{3D cross model} with three micro-cell parameters
(\cref{fig:microCell_5}).
By shearing in the two horizontal directions,
we obtain two new degrees of freedom $\theta_1$ and $\theta_2$
(shearing angles).
The emerging \term{3D sheared cross model} has five micro-cell parameters
(\cref{fig:microCell_6}).

\subsection{Test Scenarios}
\label{sec:632scenarios}

%\paragraph{Scenario settings}

To benchmark the performance of the new method,
we take a subset of the scenarios given in \cite{Valdez17Topology},
which reviews more than 100 papers on topology optimization
to determine the most common test scenarios in the field.
The geometry and the boundary conditions of the
four scenarios (two for each 2D and 3D)
are given in \cref{fig:topoOptScenario} (dimensions in meters).
In contrast to \cite{Valdez17Topology},
we only use single-point loads
(i.e., not loads applied to line segments, areas, or volumes)
for implementational reasons.
The upper bound on the density (see \cref{sec:611homogenization})
is $\densub = \SI{50}{\percent}$ for the 2D scenarios and
$\densub = \SI{10}{\percent}$ for the 3D scenarios.
As in \cite{Sigmund01Line} and for reasons of simplicity,
we apply a force $\force$ with unit value
(i.e., $\norm[2]{\force} = \SI{1}{\newton}$),
and we use a hypothetical material with
a Young's modulus (stiffness) of \SI{1}{\pascal} and
a Poisson ratio (transversal expansion to axial compression) of $0.3$.

\begin{figure}
  \subcaptionbox{%
    2D cantilever%
    \label{fig:topoOptScenario_1}%
  }[72mm]{%
    \includegraphics{topoOptScenario2D_1}%
  }%
  \hfill%
  \smash{\raisebox{-22mm}{\subcaptionbox{%
    2D L-shape%
    \label{fig:topoOptScenario_2}%
  }[72mm]{%
    \includegraphics{topoOptScenario2D_2}%
  }}}%
  \\[7mm]%
  \subcaptionbox{%
    3D cantilever%
    \label{fig:topoOptScenario_3}%
  }[72mm]{%
    \includegraphics{topoOptScenario3D_1}%
  }%
  \hfill%
  \subcaptionbox{%
    3D center-load%
    \label{fig:topoOptScenario_4}%
  }[72mm]{%
    \includegraphics{topoOptScenario3D_2}%
  }%
  \caption[Test scenarios in topology optimization]{%
    Test scenarios in topology optimization in
    two and three spatial dimensions.
    Shown are
    the domains $\objdomain$,
    load points,
    locations of homogeneous Dirichlet boundary conditions
    \emph{\textcolor{C1}{(red)},} and
    exemplary optimal structures \emph{\textcolor{C0}{(blue)}.}%
  }%
  \label{fig:topoOptScenario}%
\end{figure}

%\paragraph{Material}
%
%As in \cite{Valdez17Topology}, we use the ASTM A-36 steel,
%which is ``one of the most commonly used material in
%real-world structural mechanics'' according to \cite{Valdez17Topology},
%as test material.
%Its material properties are as follows \cite{Valdez17Topology}:
%$\text{Young modulus} = \SI{211}{\giga\pascal}$,
%$\text{Poisson ratio} = 0.29$,
%$\text{density} = \SI{7874}{\kilogram\per\meter\cubed}$, and
%$\text{yield stress} = \SI{220}{\mega\pascal}$.


\documentclass[12pt]{article}
\usepackage{fontspec}
\usepackage{fullpage}
\usepackage{hyperref}
\hypersetup{bookmarks=true,colorlinks=true,linkcolor=red,citecolor=blue,filecolor=magenta,urlcolor=cyan}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{unicode-math}
\usepackage{tabu}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{caption}
\usepackage{enumitem}
\usepackage{graphics}
\usepackage{filecontents}
\usepackage[backend=bibtex]{biblatex}
\usepackage{url}
\setmathfont{Latin Modern Math}
\newcommand{\gt}{\ensuremath >}
\newcommand{\lt}{\ensuremath <}
\global\tabulinesep=1mm
\newlist{symbDescription}{description}{1}
\setlist[symbDescription]{noitemsep, topsep=0pt, parsep=0pt, partopsep=0pt}
\bibliography{bibfile}
\title{Software Requirements Specification for Diagnose}
\author{Andrea Clemeno}
\begin{document}
\maketitle
\tableofcontents
\newpage
\section{Reference Material}
\label{Sec:RefMat}
This section records information for easy reference.

\subsection{Table of Units}
\label{Sec:ToU}
The unit system used throughout is SI (Système International d'Unités). In addition to the basic units, several derived units are also used. For each unit, \hyperref[Table:ToU]{Tab: ToU} lists the symbol, a description and the SI name.

\begin{longtable}{l l l}
\toprule
\textbf{Symbol} & \textbf{Description} & \textbf{SI Name}
\\
\midrule
\endhead
${\text{d}}$ & time & day
\\
${\text{mL}}$ & volume & millilitre
\\
${\text{mol}}$ & amount of substance & mole
\\
\bottomrule
\caption{Table of Units}
\label{Table:ToU}
\end{longtable}
\subsection{Table of Symbols}
\label{Sec:ToS}
The symbols used in this document are summarized in \hyperref[Table:ToS]{Tab: ToS} along with their units. Throughout the document, symbols in bold will represent vectors, and scalars otherwise. The symbols are listed in alphabetical order. For vector quantities, the units shown are for each component of the vector.

\begin{longtabu}{l X[l] l}
\toprule
\textbf{Symbol} & \textbf{Description} & \textbf{Units}
\\
\midrule
\endhead
$k$ & Elimination constant & $\text{d}^{-1}$
\\
$N$ & Viral load & $\frac{\text{mol}}{\text{mL}}$
\\
${N_{\text{o}}}$ & Initial viral load & $\frac{\text{mol}}{\text{mL}}$
\\
${N_{\text{p}}}$ & Predicted viral load at time t & $\frac{\text{mol}}{\text{mL}}$
\\
${N_{\text{t}}}$ & Viral load at user-defined time t & $\frac{\text{mol}}{\text{mL}}$
\\
$n$ & Number of virions & ${\text{mol}}$
\\
$r$ & Rate of change of the viral load & $\frac{\text{mol}}{\text{mL}\text{d}}$
\\
$t$ & Time & ${\text{d}}$
\\
${t_{\text{p}}}$ & Time duration of chosen prediction period & ${\text{d}}$
\\
${t_{\text{t}}}$ & Time duration between initial and secondary viral load test & ${\text{d}}$
\\
$V$ & Volume & ${\text{mL}}$
\\
\bottomrule
\caption{Table of Symbols}
\label{Table:ToS}
\end{longtabu}
\subsection{Abbreviations and Acronyms}
\label{Sec:TAbbAcc}
\begin{longtable}{l l}
\toprule
\textbf{Abbreviation} & \textbf{Full Form}
\\
\midrule
\endhead
A & Assumption
\\
DD & Data Definition
\\
GD & General Definition
\\
GS & Goal Statement
\\
IM & Instance Model
\\
PS & Physical System Description
\\
R & Requirement
\\
SRS & Software Requirements Specification
\\
TM & Theoretical Model
\\
Uncert. & Typical Uncertainty
\\
\bottomrule
\caption{Abbreviations and Acronyms}
\label{Table:TAbbAcc}
\end{longtable}
\section{Introduction}
\label{Sec:Intro}
HIV-1 is a virus that attacks cells of the immune system needed to fight off diseases. The virus leads to an uncurable disease called AIDs. Therefore, it is useful to have a program to model these types of problems. The program documented here is called Diagnose.

The following section provides an overview of the Software Requirements Specification (SRS) for Diagnose. This section explains the purpose of this document, the scope of the requirements, the characteristics of the intended reader, and the organization of the document.

\subsection{Scope of Requirements}
\label{Sec:ReqsScope}
The scope of the requirements includes the analysis of HIV-1 viral load concentration over time after the viremia peak of the initial infection without the influence of external factors that can affect the efficiency of the immune system.

\section{Specific System Description}
\label{Sec:SpecSystDesc}
This section first presents the problem description, which gives a high-level view of the problem to be solved. This is followed by the solution characteristics specification, which presents the assumptions, theories, and definitions that are used.

\subsection{Problem Description}
\label{Sec:ProbDesc}
A system is needed to assess the risk of progression to AIDs before substantial immune destruction has occurred. Diagnose will model the viral load over time for the HIV-1 virus responsible for AIDs. The system will determine the initial elimination rate of the virus and predict viral load at a user-defined time.

\subsubsection{Terminology and Definitions}
\label{Sec:TermDefs}
This subsection provides a list of terms that are used in the subsequent sections and their meaning, with the purpose of reducing ambiguity and making it easier to correctly understand the requirements.

\begin{itemize}
\item{Virus: Submicroscopic parasites that infect cells.}
\item{Viral load: The concentration of HIV virus at a point in time.}
\item{Replication: The process where infected cells rapidly reproduce genetic material of the virus rather than its normal process of reproducing itself.}
\item{Productivity:  Cells can be productive and non-productive. Productive means that infection occurs. The HIV-1 virus needs to interact with a cell to be productive and replicate.}
\item{Infected cells: Cells that interact with the virus replicate into cells altered by the virus.}
\item{Helper T cell: Cells of the immune system that neutralize infected cells.}
\item{Immune Response: The defensive reaction of the human body against harmful substances like the HIV-1 virus.}
\item{Elimination: Physical quantity undergoing a decline in amount.}
\item{Viremia Peak: The peak of viral load after the virus has entered the blood stream. There is a trend of elimination for viral load due to the body's immune response.}
\item{AIDs: Acquired Immunodeficiency Syndrome develops from an increase in HIV viral load to the extent where T cell count decreases to under 200 mol/L.}
\item{Diagnosis: The determination of a patient's condition reached by a healthcare professional.}
\item{Progression: The development towards a more advanced stage.}
\end{itemize}
\subsubsection{Physical System Description}
\label{Sec:PhysSyst}
The physical system of Diagnose, as shown in \hyperref[Figure:Virus]{Fig:Virus}, includes the following elements:

\begin{itemize}
\item[PS1:]{The HIV Virion.}
\item[PS2:]{The virus-infected cells.}
\item[PS3:]{The Helper T cell.}
\item[PS4:]{The human body.}
\item[PS5:]{The skin barrier of the human body.}
\end{itemize}
\begin{figure}
\begin{center}
\includegraphics[width=0.7\textwidth]{../../../datafiles/Diagnose/Virusinbody.JPG}
\caption{The physical system}
\label{Figure:Virus}
\end{center}
\end{figure}
\subsubsection{Goal Statements}
\label{Sec:GoalStmt}
Given two HIV-1 viral load test datum, time duration between the tests and the chosen prediction period, the goal statements are:

\begin{itemize}
\item[detElimrate:\phantomsection\label{detElimrate}]{Determine the elimination rate of the HIV virus due to immune response.}
\item[predictVL30:\phantomsection\label{predictVL30}]{Predict viral load after chosen prediction period.}
\end{itemize}
\subsection{Solution Characteristics Specification}
\label{Sec:SolCharSpec}
The instance models that govern Diagnose are presented in \hyperref[Sec:IMs]{Section: Instance Models}. The information to understand the meaning of the instance models and their derivation is also presented, so that the instance models can be verified.

\subsubsection{Assumptions}
\label{Sec:Assumps}
This section simplifies the original problem and helps in developing the theoretical models by filling in the missing information for the physical system. The assumptions refine the scope by providing more detail.

\begin{itemize}
\item[initialInf:\phantomsection\label{initialInf}]{Initial infection of HIV for patient is assumed (RefBy: \hyperref[verifyOutput]{FR: Verify-Output}, \hyperref[verifyInput]{FR: Verify-Input-Values}, \hyperref[IM:calofPredictedVL]{IM: calofPredictedVL}, and \hyperref[alwaysElim]{A: alwaysElim}.)}
\item[constGrowth:\phantomsection\label{constGrowth}]{The virions will invade uninfected cells at a constant rate.}
\item[constVolume:\phantomsection\label{constVolume}]{The dimensions of the location associated with the infection remains constant (RefBy: \hyperref[DD:viralLoad]{DD: viralLoad}.)}
\item[constConditions:\phantomsection\label{constConditions}]{Temperature of the location associated with the infection remains constant (RefBy: \hyperref[neglectSick]{A: neglectSick}.)}
\item[allProductive:\phantomsection\label{allProductive}]{All viruses within the volume infect cells productively (RefBy: \hyperref[moreInputs]{LC: More-Inputs}.)}
\item[alwaysElim:\phantomsection\label{alwaysElim}]{In accordance with \hyperref[initialInf]{A: initialInf}, after viremia peak, no significant upward trends occur. (RefBy: \hyperref[verifyOutput]{FR: Verify-Output}, \hyperref[verifyInput]{FR: Verify-Input-Values}, \hyperref[IM:calofPredictedVL]{IM: calofPredictedVL}, and \hyperref[IM:calofElimConst]{IM: calofElimConst}.)}
\item[neglectDrugs:\phantomsection\label{neglectDrugs}]{The effect of antibiotic drugs or therapy on the elimination rate will be not be considered. (RefBy: \hyperref[moreInputs]{LC: More-Inputs}.)}
\item[neglectSick:\phantomsection\label{neglectSick}]{With reference to \hyperref[constConditions]{A: constConditions}, the effect of other infections on the elimination rate will be not be considered. (RefBy: \hyperref[moreInputs]{LC: More-Inputs}.)}
\item[proportional:\phantomsection\label{proportional}]{The elimination of the virus is assumed to be proportional to the amount of viruses present (RefBy: \hyperref[IM:calofElimConst]{IM: calofElimConst}.)}
\end{itemize}
\subsubsection{Theoretical Models}
\label{Sec:TMs}
This section focuses on the general equations and laws that Diagnose is based on.

\vspace{\baselineskip}
\noindent
\begin{minipage}{\textwidth}
\begin{tabular}{>{\raggedright}p{0.13\textwidth}>{\raggedright\arraybackslash}p{0.82\textwidth}}
\toprule \textbf{Refname} & \textbf{TM:expElim}
\phantomsection
\label{TM:expElim}
\\ \midrule \\
Label & VLoadt

\\ \midrule \\
Equation & \begin{displaymath}
           r=\frac{\,d{N_{\text{t}}}}{\,dt}=-k {N_{\text{o}}}
           \end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
              \item{$r$ is the rate of change of the viral load ($\frac{\text{mol}}{\text{mL}\text{d}}$)}
              \item{$t$ is the time (${\text{d}}$)}
              \item{${N_{\text{t}}}$ is the viral load at user-defined time t ($\frac{\text{mol}}{\text{mL}}$)}
              \item{$k$ is the elimination constant ($\text{d}^{-1}$)}
              \item{${N_{\text{o}}}$ is the initial viral load ($\frac{\text{mol}}{\text{mL}}$)}
              \end{symbDescription}
\\ \midrule \\
Source & \cite{libretexts2020}

\\ \midrule \\
RefBy & \hyperref[GD:vLoadt]{GD: vLoadt}

\\ \bottomrule
\end{tabular}
\end{minipage}
\subsubsection{General Definitions}
\label{Sec:GDs}
This section collects the laws and equations that will be used to build the instance models.

\vspace{\baselineskip}
\noindent
\begin{minipage}{\textwidth}
\begin{tabular}{>{\raggedright}p{0.13\textwidth}>{\raggedright\arraybackslash}p{0.82\textwidth}}
\toprule \textbf{Refname} & \textbf{GD:vLoadt}
\phantomsection
\label{GD:vLoadt}
\\ \midrule \\
Label & VLoadt as a function of time for constant decay rate

\\ \midrule \\
Units & $\frac{\text{mol}}{\text{mL}}$

\\ \midrule \\
Equation & \begin{displaymath}
           {N_{\text{t}}}={N_{\text{o}}} e^{-k t}
           \end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
              \item{${N_{\text{t}}}$ is the viral load at user-defined time t ($\frac{\text{mol}}{\text{mL}}$)}
              \item{${N_{\text{o}}}$ is the initial viral load ($\frac{\text{mol}}{\text{mL}}$)}
              \item{$k$ is the elimination constant ($\text{d}^{-1}$)}
              \item{$t$ is the time (${\text{d}}$)}
              \end{symbDescription}
\\ \midrule \\
Source & \cite{hobbie1970}

\\ \midrule \\
RefBy & \hyperref[IM:calofPredictedVL]{IM: calofPredictedVL} and \hyperref[IM:calofElimConst]{IM: calofElimConst}

\\ \bottomrule
\end{tabular}
\end{minipage}
\paragraph{Detailed derivation of viral load at user-defined time t:}
\label{GD:vLoadtDeriv}
Using the First-Order rate Law in \hyperref[TM:expElim]{TM: expElim}, we have:

\begin{displaymath}
\frac{\,dN}{\,dt}=-k {N_{\text{o}}}
\end{displaymath}
Where ${N_{\text{t}}}$ denotes the viral load at user-defined time t, ${N_{\text{o}}}$ denotes the initial viral load and $k$ denotes the elimination constant. When rearranging for integration,  we have:

\begin{displaymath}
\int_{{N_{\text{o}}}}^{{N_{\text{t}}}}{1}\,d{N_{\text{t}}}=-\int_{0}^{t}{k}\,dt
\end{displaymath}
Performing the integration, we have the required equation:

\begin{displaymath}
{N_{\text{t}}}={N_{\text{o}}} e^{-k t}
\end{displaymath}
\subsubsection{Data Definitions}
\label{Sec:DDs}
This section collects and defines all the data needed to build the instance models.

\vspace{\baselineskip}
\noindent
\begin{minipage}{\textwidth}
\begin{tabular}{>{\raggedright}p{0.13\textwidth}>{\raggedright\arraybackslash}p{0.82\textwidth}}
\toprule \textbf{Refname} & \textbf{DD:viralLoad}
\phantomsection
\label{DD:viralLoad}
\\ \midrule \\
Label & Viral load

\\ \midrule \\
Symbol & $N$

\\ \midrule \\
Units & $\frac{\text{mol}}{\text{mL}}$

\\ \midrule \\
Equation & \begin{displaymath}
           N=\frac{n}{V}
           \end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
              \item{$N$ is the viral load ($\frac{\text{mol}}{\text{mL}}$)}
              \item{$n$ is the number of virions (${\text{mol}}$)}
              \item{$V$ is the volume (${\text{mL}}$)}
              \end{symbDescription}
\\ \midrule \\
Notes & The viral load describes the concentration of  a virus within the body at a certain time. It assumes that the volume of blood is constant with respect to \hyperref[constVolume]{A: constVolume}.

\\ \midrule \\
Source & --

\\ \midrule \\
RefBy & \hyperref[IM:calofPredictedVL]{IM: calofPredictedVL} and \hyperref[IM:calofElimConst]{IM: calofElimConst}

\\ \bottomrule
\end{tabular}
\end{minipage}

\subsubsection{Instance Models}
\label{Sec:IMs}
This section transforms the problem defined in \hyperref[Sec:ProbDesc]{Section: Problem Description} into one which is expressed in mathematical terms. It uses concrete symbols defined in \hyperref[Sec:DDs]{Section: Data Definitions} to replace the abstract symbols in the models identified in \hyperref[Sec:TMs]{Section: Theoretical Models} and \hyperref[Sec:GDs]{Section: General Definitions}.

\vspace{\baselineskip}
\noindent
\begin{minipage}{\textwidth}
\begin{tabular}{>{\raggedright}p{0.13\textwidth}>{\raggedright\arraybackslash}p{0.82\textwidth}}
\toprule \textbf{Refname} & \textbf{IM:calofElimConst}
\phantomsection
\label{IM:calofElimConst}
\\ \midrule \\
Label & Calculation of elimination rate

\\ \midrule \\
Input & ${N_{\text{t}}}$, ${N_{\text{o}}}$, ${t_{\text{t}}}$

\\ \midrule \\
Output & $k$

\\ \midrule \\
Input Constraints & \begin{displaymath}
                    0\lt{}{N_{\text{t}}}\lt{}{N_{\text{o}}}
                    \end{displaymath}
                    \begin{displaymath}
                    {N_{\text{o}}}\gt{}0
                    \end{displaymath}
                    \begin{displaymath}
                    {t_{\text{t}}}\gt{}0
                    \end{displaymath}
\\ \midrule \\
Output Constraints & \begin{displaymath}
                     k\gt{}0
                     \end{displaymath}
\\ \midrule \\
Equation & \begin{displaymath}
           k=\frac{\ln\left({N_{\text{o}}}\right)-\ln\left({N_{\text{t}}}\right)}{{t_{\text{t}}}}
           \end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
              \item{$k$ is the elimination constant ($\text{d}^{-1}$)}
              \item{${N_{\text{o}}}$ is the initial viral load ($\frac{\text{mol}}{\text{mL}}$)}
              \item{${N_{\text{t}}}$ is the viral load at user-defined time t ($\frac{\text{mol}}{\text{mL}}$)}
              \item{${t_{\text{t}}}$ is the time duration between initial and secondary viral load test (${\text{d}}$)}
              \end{symbDescription}
\\ \midrule \\
Notes & The constraint ${N_{\text{o}}}\gt{}{N_{\text{t}}}\gt{}0$ is required for the nature of the problem with respect to \hyperref[proportional]{A: proportional}. Due to the input constraint,  the $k\gt{}0$ is established due to \hyperref[alwaysElim]{A: alwaysElim}. Using this instance model, the goal of the software in  \hyperref[detElimrate]{GS: detElimrate}  can be achieved. In addition, this constraint is used to achieve a functional requirement seen in  \hyperref[verifyOutput]{FR: Verify-Output}.

\\ \midrule \\
Source & --

\\ \midrule \\
RefBy & \hyperref[IM:calofPredictedVL]{IM: calofPredictedVL}

\\ \bottomrule
\end{tabular}
\end{minipage}
\paragraph{Detailed derivation of elimination constant:}
\label{IM:calofElimConstDeriv}
Using the relationship for the viral load seen in \hyperref[DD:viralLoad]{DD: viralLoad} with respect to time in \hyperref[GD:vLoadt]{GD: vLoadt}, we have:

\begin{displaymath}
{N_{\text{t}}}={N_{\text{o}}} e^{-k {t_{\text{t}}}}
\end{displaymath}
Where ${N_{\text{t}}}$ denotes the viral load at user-defined time t, ${N_{\text{o}}}$ denotes the initial viral load and $k$ denotes the elimination constant. When isolating for the elimination constant,  we have:

\begin{displaymath}
\frac{{N_{\text{t}}}}{{N_{\text{o}}}}=e^{-k {t_{\text{t}}}}
\end{displaymath}
To isolate further, the natural logarithm is applied:

\begin{displaymath}
\ln\left(\frac{{N_{\text{t}}}}{{N_{\text{o}}}}\right)=-k {t_{\text{t}}}
\end{displaymath}
After using the logarithmic quotient property, we have the required equation:

\begin{displaymath}
k=\frac{\ln\left({N_{\text{o}}}\right)-\ln\left({N_{\text{t}}}\right)}{{t_{\text{t}}}}
\end{displaymath}
\vspace{\baselineskip}
\noindent
\begin{minipage}{\textwidth}
\begin{tabular}{>{\raggedright}p{0.13\textwidth}>{\raggedright\arraybackslash}p{0.82\textwidth}}
\toprule \textbf{Refname} & \textbf{IM:calofPredictedVL}
\phantomsection
\label{IM:calofPredictedVL}
\\ \midrule \\
Label & Calculation of elimination rate

\\ \midrule \\
Input & ${N_{\text{o}}}$, $k$, ${t_{\text{p}}}$

\\ \midrule \\
Output & ${N_{\text{p}}}$

\\ \midrule \\
Input Constraints & \begin{displaymath}
                    {N_{\text{o}}}\gt{}0
                    \end{displaymath}
                    \begin{displaymath}
                    k\gt{}0
                    \end{displaymath}
                    \begin{displaymath}
                    {t_{\text{p}}}\gt{}0
                    \end{displaymath}
\\ \midrule \\
Output Constraints & \begin{displaymath}
                     0\lt{}{N_{\text{p}}}\lt{}{N_{\text{o}}}
                     \end{displaymath}
\\ \midrule \\
Equation & \begin{displaymath}
           {N_{\text{p}}}={N_{\text{o}}} e^{-k {t_{\text{p}}}}
           \end{displaymath}
\\ \midrule \\
Description & \begin{symbDescription}
              \item{${N_{\text{p}}}$ is the predicted viral load at time t ($\frac{\text{mol}}{\text{mL}}$)}
              \item{${N_{\text{o}}}$ is the initial viral load ($\frac{\text{mol}}{\text{mL}}$)}
              \item{$k$ is the elimination constant ($\text{d}^{-1}$)}
              \item{${t_{\text{p}}}$ is the time duration of chosen prediction period (${\text{d}}$)}
              \end{symbDescription}
\\ \midrule \\
Notes & The constraint ${N_{\text{o}}}\gt{}{N_{\text{t}}}\gt{}0$ is  applies when determining future values from the in initial infection with respect to \hyperref[initialInf]{A: initialInf} as well as  \hyperref[alwaysElim]{A: alwaysElim}. Using this instance model, the goal of the software in  \hyperref[predictVL30]{GS: predictVL30}  can be achieved. In addition, this constraint is used to achieve a functional requirement seen in  \hyperref[verifyOutput]{FR: Verify-Output}.

\\ \midrule \\
Source & --

\\ \midrule \\
RefBy &
\\ \bottomrule
\end{tabular}
\end{minipage}
\paragraph{Detailed derivation of predicted viral load at time t:}
\label{IM:calofPredictedVLDeriv}
Using the relationship for the viral load seen in \hyperref[DD:viralLoad]{DD: viralLoad} with respect to time in \hyperref[GD:vLoadt]{GD: vLoadt}, we have:

\begin{displaymath}
{N_{\text{t}}}={N_{\text{o}}} e^{-k {t_{\text{p}}}}
\end{displaymath}
Where ${N_{\text{t}}}$ denotes the viral load at user-defined time t, ${N_{\text{o}}}$ denotes the initial viral load and $k$ denotes the elimination constant. When predicting the viral load after 30 days, the elimination constant  found in \hyperref[IM:calofElimConst]{IM: calofElimConst},  is used instead of ${N_{\text{t}}}$  therefore we have:

\begin{displaymath}
{N_{\text{p}}}={N_{\text{o}}} e^{-k {t_{\text{p}}}}
\end{displaymath}
\subsubsection{Data Constraints}
\label{Sec:DataConstraints}
\hyperref[Table:InDataConstraints]{Table:InDataConstraints} shows the data constraints on the input variables. The column for physical constraints gives the physical limitations on the range of values that can be taken by the variable. The uncertainty column provides an estimate of the confidence with which the physical quantities can be measured. This information would be part of the input if one were performing an uncertainty quantification exercise. The constraints are conservative, to give the user of the model the flexibility to experiment with unusual situations. The column of typical values is intended to provide a feel for a common scenario.

\begin{longtable}{l l l l}
\toprule
\textbf{Var} & \textbf{Physical Constraints} & \textbf{Typical Value} & \textbf{Uncert.}
\\
\midrule
\endhead
${N_{\text{o}}}$ & ${N_{\text{o}}}\gt{}0$ & $10.0\cdot{}10^{6}$ $\frac{\text{mol}}{\text{mL}}$ & 10$\%$
\\
${N_{\text{t}}}$ & $0\lt{}{N_{\text{t}}}\lt{}{N_{\text{o}}}$ & $5.0\cdot{}10^{6}$ $\frac{\text{mol}}{\text{mL}}$ & 10$\%$
\\
${t_{\text{p}}}$ & ${t_{\text{p}}}\gt{}0$ & $30.0$ ${\text{d}}$ & 10$\%$
\\
${t_{\text{t}}}$ & $0\lt{}{t_{\text{t}}}\lt{}{t_{\text{p}}}$ & $1.0$ ${\text{d}}$ & 10$\%$
\\
\bottomrule
\caption{Input Data Constraints}
\label{Table:InDataConstraints}
\end{longtable}
\subsubsection{Properties of a Correct Solution}
\label{Sec:CorSolProps}
\hyperref[Table:OutDataConstraints]{Table:OutDataConstraints} shows the data constraints on the output variables. The column for physical constraints gives the physical limitations on the range of values that can be taken by the variable.

\begin{longtable}{l l}
\toprule
\textbf{Var} & \textbf{Physical Constraints}
\\
\midrule
\endhead
$k$ & $k\gt{}0$
\\
${N_{\text{p}}}$ & ${N_{\text{p}}}\gt{}0$
\\
\bottomrule
\caption{Output Data Constraints}
\label{Table:OutDataConstraints}
\end{longtable}
\section{Requirements}
\label{Sec:Requirements}
This section provides the functional requirements, the tasks and behaviours that the software is expected to complete, and the non-functional requirements, the qualities that the software is expected to exhibit.

\subsection{Functional Requirements}
\label{Sec:FRs}
This section provides the functional requirements, the tasks and behaviours that the software is expected to complete.

\begin{itemize}
\item[Input-Values:\phantomsection\label{inputValues}]{Input the values from \hyperref[Table:ReqInputs]{Table:ReqInputs}.}
\item[Verify-Input-Values:\phantomsection\label{verifyInput}]{The software will ensure that the inputs are not   out of bounds and in accordance with the data constraints especially regarding the \hyperref[initialInf]{A: initialInf} and furthermore, \hyperref[alwaysElim]{A: alwaysElim}. If any inputs are out of bounds, an error message is displayed.}
\item[Calculate-Values:\phantomsection\label{calcValues}]{Software calculates the initial elimination rate of HIV virus and the predicted viral load after the chosen prediction period.}
\item[Verify-Output:\phantomsection\label{verifyOutput}]{The output values will be cross referenced with  the result constraints. This requirement is related to the assumptions: \hyperref[initialInf]{A: initialInf} and \hyperref[alwaysElim]{A: alwaysElim}.}
\item[Output-Values:\phantomsection\label{outputValues}]{Output related requirements including the elimination rate and predicted viral load to satisfy the goals of Diagnose.}
\end{itemize}
\begin{longtabu}{l X[l] l}
\toprule
\textbf{Symbol} & \textbf{Description} & \textbf{Units}
\\
\midrule
\endhead
${N_{\text{o}}}$ & Initial viral load & $\frac{\text{mol}}{\text{mL}}$
\\
${N_{\text{t}}}$ & Viral load at user-defined time t & $\frac{\text{mol}}{\text{mL}}$
\\
${t_{\text{p}}}$ & Time duration of chosen prediction period & ${\text{d}}$
\\
${t_{\text{t}}}$ & Time duration between initial and secondary viral load test & ${\text{d}}$
\\
\bottomrule
\caption{Required Inputs following \hyperref[inputValues]{FR: Input-Values}}
\label{Table:ReqInputs}
\end{longtabu}
\subsection{Non-Functional Requirements}
\label{Sec:NFRs}
This section provides the non-functional requirements, the qualities that the software is expected to exhibit.

\begin{itemize}
\item[Verifiable:\phantomsection\label{verifiable}]{The Drasil generated python code is tested using static and dynamic code analysis, linting, unit and system testing and continuous integration methods outlined in the Verification  and Validation plan of Diagnose.}
\item[Understandable:\phantomsection\label{understandable}]{The code will be generated using the Drasil Framework into modules to address each requirement.}
\item[Reusable:\phantomsection\label{reusable}]{The code will be created using Drasil. The framework has data libraries of scientific theories, concepts, quantities and units commonly used in scientific problems. The created knowledge libraries of Diagnose can be reused as required.}
\item[Maintainable:\phantomsection\label{maintainable}]{The traceability between requirements, assumptions, theoretical models, general definitions, data definitions, instance models, likely changes, unlikely changes, and modules is completely recorded in traceability matrices throughout the documentation of Diagnose to measure maintainability. The traceability will be measured by ensuring the connections are recorded and identifiable.}
\item[Portable:\phantomsection\label{portable}]{The code is able to be run in different environments.}
\end{itemize}
\section{Likely Changes}
\label{Sec:LCs}
This section lists the likely changes to be made to the software.

\begin{itemize}
\item[More-Inputs:\phantomsection\label{moreInputs}]{The software may be expanded to include more inputs from the user  to increase the accuracy of the output. This change may alter assumptions: \hyperref[allProductive]{A: allProductive} , \hyperref[neglectSick]{A: neglectSick} and \hyperref[neglectDrugs]{A: neglectDrugs}.}
\item[More-Outputs:\phantomsection\label{moreOutputs}]{The software may be expanded to include more outputs  like assessing the progression to AIDs or a suggestion for therapy.}
\end{itemize}
\section{Unlikely Changes}
\label{Sec:UCs}
This section lists the unlikely changes to be made to the software.

\begin{itemize}
\item[Determine-elimination-rate:\phantomsection\label{detElimRate}]{The goal of determining the elimination rate of the virus will not likely change.}
\item[External-input:\phantomsection\label{externalInput}]{There will always be a source of input  data external to the software.}
\item[Unchanging-input-constraints:\phantomsection\label{inConstraints}]{The input constraints will not  likely change.}
\end{itemize}
\section{Traceability Matrices and Graphs}
\label{Sec:TraceMatrices}
The purpose of the traceability matrices is to provide easy references on what has to be additionally modified if a certain component is changed. Every time a component is changed, the items in the column of that component that are marked with an ``X'' should be modified as well. \hyperref[Table:TraceMatAvsA]{Table:TraceMatAvsA} shows the dependencies of assumptions on the assumptions. \hyperref[Table:TraceMatAvsAll]{Table:TraceMatAvsAll} shows the dependencies of data definitions, theoretical models, general definitions, instance models, requirements, likely changes, and unlikely changes on the assumptions. \hyperref[Table:TraceMatRefvsRef]{Table:TraceMatRefvsRef} shows the dependencies of data definitions, theoretical models, general definitions, and instance models with each other. \hyperref[Table:TraceMatAllvsR]{Table:TraceMatAllvsR} shows the dependencies of requirements, goal statements on the data definitions, theoretical models, general definitions, and instance models.

\begin{longtable}{l l l l l l l l l l}
\toprule
\textbf{} & \textbf{\hyperref[initialInf]{A: initialInf}} & \textbf{\hyperref[constGrowth]{A: constGrowth}} & \textbf{\hyperref[constVolume]{A: constVolume}} & \textbf{\hyperref[constConditions]{A: constConditions}} & \textbf{\hyperref[allProductive]{A: allProductive}} & \textbf{\hyperref[alwaysElim]{A: alwaysElim}} & \textbf{\hyperref[neglectDrugs]{A: neglectDrugs}} & \textbf{\hyperref[neglectSick]{A: neglectSick}} & \textbf{\hyperref[proportional]{A: proportional}}
\\
\midrule
\endhead
\hyperref[initialInf]{A: initialInf} &  &  &  &  &  &  &  &  &
\\
\hyperref[constGrowth]{A: constGrowth} &  &  &  &  &  &  &  &  &
\\
\hyperref[constVolume]{A: constVolume} &  &  &  &  &  &  &  &  &
\\
\hyperref[constConditions]{A: constConditions} &  &  &  &  &  &  &  &  &
\\
\hyperref[allProductive]{A: allProductive} &  &  &  &  &  &  &  &  &
\\
\hyperref[alwaysElim]{A: alwaysElim} & X &  &  &  &  &  &  &  &
\\
\hyperref[neglectDrugs]{A: neglectDrugs} &  &  &  &  &  &  &  &  &
\\
\hyperref[neglectSick]{A: neglectSick} &  &  &  & X &  &  &  &  &
\\
\hyperref[proportional]{A: proportional} &  &  &  &  &  &  &  &  &
\\
\bottomrule
\caption{Traceability Matrix Showing the Connections Between Assumptions dependence of each other.}
\label{Table:TraceMatAvsA}
\end{longtable}
\begin{longtable}{l l l l l l l l l l}
\toprule
\textbf{} & \textbf{\hyperref[initialInf]{A: initialInf}} & \textbf{\hyperref[constGrowth]{A: constGrowth}} & \textbf{\hyperref[constVolume]{A: constVolume}} & \textbf{\hyperref[constConditions]{A: constConditions}} & \textbf{\hyperref[allProductive]{A: allProductive}} & \textbf{\hyperref[alwaysElim]{A: alwaysElim}} & \textbf{\hyperref[neglectDrugs]{A: neglectDrugs}} & \textbf{\hyperref[neglectSick]{A: neglectSick}} & \textbf{\hyperref[proportional]{A: proportional}}
\\
\midrule
\endhead
\hyperref[DD:viralLoad]{DD: viralLoad} &  &  & X &  &  &  &  &  &
\\
\hyperref[TM:expElim]{TM: expElim} &  &  &  &  &  &  &  &  &
\\
\hyperref[GD:vLoadt]{GD: vLoadt} &  &  &  &  &  &  &  &  &
\\
\hyperref[IM:calofElimConst]{IM: calofElimConst} &  &  &  &  &  & X &  &  & X
\\
\hyperref[IM:calofPredictedVL]{IM: calofPredictedVL} & X &  &  &  &  & X &  &  &
\\
\hyperref[inputValues]{FR: Input-Values} &  &  &  &  &  &  &  &  &
\\
\hyperref[verifyInput]{FR: Verify-Input-Values} & X &  &  &  &  & X &  &  &
\\
\hyperref[calcValues]{FR: Calculate-Values} &  &  &  &  &  &  &  &  &
\\
\hyperref[verifyOutput]{FR: Verify-Output} & X &  &  &  &  & X &  &  &
\\
\hyperref[outputValues]{FR: Output-Values} &  &  &  &  &  &  &  &  &
\\
\hyperref[verifiable]{NFR: Verifiable} &  &  &  &  &  &  &  &  &
\\
\hyperref[understandable]{NFR: Understandable} &  &  &  &  &  &  &  &  &
\\
\hyperref[reusable]{NFR: Reusable} &  &  &  &  &  &  &  &  &
\\
\hyperref[maintainable]{NFR: Maintainable} &  &  &  &  &  &  &  &  &
\\
\hyperref[portable]{NFR: Portable} &  &  &  &  &  &  &  &  &
\\
\hyperref[moreInputs]{LC: More-Inputs} &  &  &  &  & X &  & X & X &
\\
\hyperref[moreOutputs]{LC: More-Outputs} &  &  &  &  &  &  &  &  &
\\
\hyperref[detElimRate]{UC: Determine-elimination-rate} &  &  &  &  &  &  &  &  &
\\
\hyperref[externalInput]{UC: External-input} &  &  &  &  &  &  &  &  &
\\
\hyperref[inConstraints]{UC: Unchanging-input-constraints} &  &  &  &  &  &  &  &  &
\\
\bottomrule
\caption{Traceability Matrix Showing the Connections Between Assumptions and Other Items}
\label{Table:TraceMatAvsAll}
\end{longtable}
\begin{longtable}{l l l l l l}
\toprule
\textbf{} & \textbf{\hyperref[DD:viralLoad]{DD: viralLoad}} & \textbf{\hyperref[TM:expElim]{TM: expElim}} & \textbf{\hyperref[GD:vLoadt]{GD: vLoadt}} & \textbf{\hyperref[IM:calofElimConst]{IM: calofElimConst}} & \textbf{\hyperref[IM:calofPredictedVL]{IM: calofPredictedVL}}
\\
\midrule
\endhead
\hyperref[DD:viralLoad]{DD: viralLoad} &  &  &  &  &
\\
\hyperref[TM:expElim]{TM: expElim} &  &  &  &  &
\\
\hyperref[GD:vLoadt]{GD: vLoadt} &  & X &  &  &
\\
\hyperref[IM:calofElimConst]{IM: calofElimConst} & X &  & X &  &
\\
\hyperref[IM:calofPredictedVL]{IM: calofPredictedVL} & X &  & X & X &
\\
\bottomrule
\caption{Traceability Matrix Showing the Connections Between Items and Other Sections}
\label{Table:TraceMatRefvsRef}
\end{longtable}
\begin{longtable}{l l l l l l l l l l l l l l l l}
\toprule
\textbf{} & \textbf{\hyperref[DD:viralLoad]{DD: viralLoad}} & \textbf{\hyperref[TM:expElim]{TM: expElim}} & \textbf{\hyperref[GD:vLoadt]{GD: vLoadt}} & \textbf{\hyperref[IM:calofElimConst]{IM: calofElimConst}} & \textbf{\hyperref[IM:calofPredictedVL]{IM: calofPredictedVL}} & \textbf{\hyperref[inputValues]{FR: Input-Values}} & \textbf{\hyperref[verifyInput]{FR: Verify-Input-Values}} & \textbf{\hyperref[calcValues]{FR: Calculate-Values}} & \textbf{\hyperref[verifyOutput]{FR: Verify-Output}} & \textbf{\hyperref[outputValues]{FR: Output-Values}} & \textbf{\hyperref[verifiable]{NFR: Verifiable}} & \textbf{\hyperref[understandable]{NFR: Understandable}} & \textbf{\hyperref[reusable]{NFR: Reusable}} & \textbf{\hyperref[maintainable]{NFR: Maintainable}} & \textbf{\hyperref[portable]{NFR: Portable}}
\\
\midrule
\endhead
\hyperref[detElimrate]{GS: detElimrate} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[predictVL30]{GS: predictVL30} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[inputValues]{FR: Input-Values} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[verifyInput]{FR: Verify-Input-Values} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[calcValues]{FR: Calculate-Values} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[verifyOutput]{FR: Verify-Output} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[outputValues]{FR: Output-Values} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[verifiable]{NFR: Verifiable} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[understandable]{NFR: Understandable} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[reusable]{NFR: Reusable} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[maintainable]{NFR: Maintainable} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\hyperref[portable]{NFR: Portable} &  &  &  &  &  &  &  &  &  &  &  &  &  &  &
\\
\bottomrule
\caption{Traceability Matrix Showing the Connections Between Requirements, Goal Statements and Other Items}
\label{Table:TraceMatAllvsR}
\end{longtable}
\section{Values of Auxiliary Constants}
\label{Sec:AuxConstants}
There are no auxiliary constants.

\section{References}
\label{Sec:References}
\begin{filecontents*}{bibfile.bib}
@misc{fischer6706,
author={Fischer, Ulrike R. and Weisz, Willy and Wieltschnig, Claudia and Kirschner, Alexander K. T. and Velimirov, Branko},
title={Benthic and Pelagic Viral Decay Experiments: a Model-Based Analysis and Its Applicability},
howpublished={\url{https://aem.asm.org/content/70/11/6706}},
month=jun,
year={2004}}
@misc{hobbie1970,
author={Hobbie, Russell K. and Roth, Bradley J.},
title={Exponential Growth and Decay},
howpublished={\url{https://link.springer.com/chapter/10.1007/978-0-387-49885-0\_2}},
month=jan,
year={1970}}
@misc{libretexts2020,
author={Libretexts Contributors},
title={14.4: The Change of Concentration with Time (Integrated Rate Laws)},
howpublished={\url{https://chem.libretexts.org/Bookshelves/General\_Chemistry/Map:\_Chemistry\_-\_The\_Central\_Science\_(Brown\_et\_al.)/14:\_Chemical\_Kinetics/14.4:\_The\_Change\_of\_Concentration\_with\_Time\_(Integrated\_Rate\_Laws)}},
month=aug,
year={2020}}
@misc{perelson1582,
author={Perelson, Alan S. and Neumann, Avidan U. and Markowitz, Martin and Leonard, John M. and Ho, David D.},
title={HIV-1 Dynamics in Vivo: Virion Clearance Rate, Infected Cell Life-Span, and Viral Generation Time},
howpublished={\url{https://science.sciencemag.org/content/271/5255/1582.full.pdf}},
month=jun,
year={1996}}
@misc{weisstein,
author={Weisstein, Eric W},
title={Exponential Decay},
howpublished={\url{https://mathworld.wolfram.com/ExponentialDecay.html}},
month=jun,
year={1996}}
@misc{william2018,
author={William C. Shiel Jr. MD},
title={Definition of T cell},
howpublished={\url{https://www.medicinenet.com/script/main/art.asp?articlekey=11300}},
month=dec,
year={2018}}
\end{filecontents*}
\nocite{*}
\bibstyle{ieeetr}
\printbibliography[heading=none]
\end{document}


\documentclass[conference]{IEEEtran}
\IEEEoverridecommandlockouts
% The preceding line is only needed to identify funding in the first footnote. If that is unneeded, please comment it out.
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{algorithmic}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08em
    T\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}
\begin{document}

\title{Principal Component Analysis (PCA) for dimension reduction.\\

}

\author{\IEEEauthorblockN{1\textsuperscript{st} Coder\_225}
\IEEEauthorblockA{\textit{dept. Computer Science} \\
13228201005@163.com}
}

\maketitle

\begin{abstract}
In recent years, the collection of huge and diverse data has opened challenges to data analysis. Most of these data contain an important amount of redundant data. The researchers aim to feed the data into the model that will then generalize patterns within the data and utilize the data in a sophisticated way to solve a variety of real-world problems. To efficiently extract valuable insight from multidimensional data with a huge number of variables, it is essential to reduce the number of variables and interpret the linear combination of the data. Principal Component Analysis (PCA), is a dimensionality-reduction method, that uses sophisticated mathematical principles to reduce the dimensionality of a large dataset, meaning reducing the number of features while maintaining the necessary information present in the original dataset. This research aims to provide a complete understanding of the PCA approach to dimensionality reduction. The paper shows the representation and visualization of the Iris dataset after applying PCA which results in the use of a smaller number of variables for the representation.
\end{abstract}

\begin{IEEEkeywords}
PCA, Iris dataset, dimension reduction
\end{IEEEkeywords}

\section{Introduction}
Data visualization represents an important step in understanding and analyzing voluminous data~\cite{Lamrini}, given n-dimensional data, the representation of the data is not always as straightforward as it may seem. One-dimensional data is a simple representation of the data on the number line. Also, the two-dimensional data is represented by xy-plane, and three-dimensional data is the space. In recent years, there has been an increase of data in various fields, the amount of multidimensional data created is increasing at an exponential rate, it is predicted to reach 44 zettabytes in 2020~\cite{Genender}. Although, for data with a dimension higher than three, representation and visualization become more complex. Moreover, the data need to be analyzed and valuable features need to be extracted therefore, obtaining significant information from the dataset becomes difficult due to high dimensionality and number of variables. In this context, to tackle these challenges, numerous data reduction methods have been developed over the last decades~\cite{Liu} nonetheless, the need for new visualization approaches remains~\cite{Onana}. The dimensionality reduction represents an originally high dimension data in a new form with a smaller dimensional space value with the inevitable loss of information. In practice, the high dimensional data must be converted one way or the other into a low dimensional geometry for display~\cite{Xu}. Also, traditional approach such as bivariate plots tends to find the relationship between variables however, the feasibility of this method becomes impractical for a large dataset as it requires $n!/2!(n-2)!$ plots.
PCA is a method of mathematical transformation that aims to classify major variables that account for variances in the given data called principal components. The detection of these variables leads to a more compressed explanation of data associations and thus to a clearer understanding of the underlying characteristics. Therefore, in a dataset, it is an effective approach to derive general patterns. Besides, since PCA offers principal components ordered by their significance, it represents an excellent basis for the reduction of the data dimension in the case of multidimensional data~\cite{Nocke}. PCA uses a transformation of vector space to decrease the dimensionality of huge datasets. In high-dimensional data, it seeks the highest variance directions that is equal to the least square line of best fit through the plotted data and projects it to a smaller dimensional subspace while maintaining most of the data. The PCA method describes the contributions of each principal component, the total variance, and the eigenvectors associated with non-zero eigenvalues~\cite{Salem}.
The remainder of this paper is organized as follows: Section II is dedicated to the related work that falls within the scope of our research. In section III, the fundamental of PCA is introduced. We propose our PCA algorithm with the implementation steps in section IV. We implement and discuss the result in Section V and we conclude this paper in Section VI.

\section{Related work}

Dimensionality reduction has gained a lot of attention in recent years. Great efforts have been expended to provide solutions methods, amongst which we can cite the work in~\cite{Houari}, the author proposed Copulas and LU-decomposition technique for dimensionality reduction, the algorithm was tested and showed satisfying result on real-world datasets such as Diabetes, Waveforms, Human Activity Recognition based on Smartphone and Thyroid Datasets. In~\cite{Menon}, the algorithm proposed by the author performs better than Gaussian-based FSVD for dimensionality reduction in hyperspectral classification. Additionally, in~\cite{Rehman} a detailed discussion of large data reduction methods, including large data compression, dimension reduction, redundancy elimination, data mining, and machine-theory-based automatic learning methods.~\cite{A} presents the basic definitions of the PCA technique along with the calculation of the covariance matrix and Singular Value Decomposition.

\section{Fundamentals of PCA}
The Principal Component Analysis is a widely used data reduction technique, PCA aims to find the directions or so-called the principal components of maximum variance in high-dimensional data and project it onto a smaller dimensional subspace while retaining most of the information. As in~\cite{D}, a dataset, with  rows representing the variables and columns denoting the observations is expressed in a matrix with row vectors.

\begin{equation}
X=\left( \begin{matrix}
   {{x}_{1,1}} & {{x}_{1,2}} & \cdots  & {{x}_{1,n}}  \\
   {{x}_{2,1}} & {{x}_{2,2}} & \cdots  & {{x}_{2,n}}  \\
   \vdots  & \vdots  & \ddots  & \vdots   \\
   {{x}_{m,1}} & {{x}_{m,2}} & \cdots  & {{x}_{m,n}}  \\
\end{matrix} \right)=\left( \begin{matrix}
   {{X}_{1}}  \\
   {{X}_{2}}  \\
   \vdots   \\
   {{X}_{m}}  \\
\end{matrix} \right)\
\end{equation}

The linear transformation of the matrix $X$ into ${{Y}_{m\times n}}$ by using a ${{P}_{m\times m}}$ matrix with row vectors ${{p}_{1}},{{p}_{2}},...,{{p}_{m}}$ and column vectors of the matrix  denoting by ${{x}_{1}},{{x}_{2}},...,{{x}_{n}}$,

\begin{equation}
{{Y}_{m\times n}}={{P}_{m\times m}}X=\left( \begin{matrix}
   {{p}_{1}}\cdot {{x}_{1}} & {{p}_{2}}\cdot {{x}_{2}} & \cdots  & {{p}_{3}}\cdot {{x}_{n}}  \\
   {{p}_{2}}\cdot {{x}_{1}} & {{p}_{2}}\cdot {{x}_{2}} & \cdots  & {{p}_{2}}\cdot {{x}_{n}}  \\
   \cdots  & \cdots  & \ddots  & \cdots   \\
   {{p}_{m}}\cdot {{x}_{1}} & {{p}_{m}}\cdot {{x}_{2}} & \ldots  & {{p}_{m}}{{x}_{n}}  \\
\end{matrix} \right)
\end{equation}

The dot product ${{p}_{i}}\cdot {{x}_{j}}$ is the projection of the original dataset $X$ on the columns of the matrix $P$. Here, the new basis represented by the rows of denotes the principal component directions. In the following part, we introduce the steps required for PCA analysis.

\subsection{Standardize the variables}
This denotes the very first step of PCA, we perform standardization to rescale the features in a way that they have the properties of a standard normal distribution with a mean of zero. Indeed, it provides a suitable normalization with equals weights. To do so, the mean value is subtracted from the dataset $S$.
\begin{equation}
{{X}_{i,j}}={{S}_{i,j}}-{{\overline{X}}_{j}}
\end{equation}

\subsection{Covariance matrix}
The covariance matrix includes all covariance pairs between  variables and along the diagonals all variances, as the covariance measures the correlation between variables. the covariance of the standardized matrix is represented as
\begin{equation}
{{C}_{x}}=\frac{1}{n-1}X{{X}^{T}}=\frac{1}{n-1}\left( \begin{matrix}
   {{x}_{1}}x_{1}^{T} & {{x}_{1}}x_{2}^{T} & \cdots  & {{x}_{1}}x_{m}^{T}  \\
   {{x}_{2}}x_{1}^{T} & {{x}_{2}}x_{2}^{T} & \cdots  & {{x}_{2}}x_{m}^{T}  \\
   \vdots  & \vdots  & \ddots  & \vdots   \\
   {{x}_{m}}x_{1}^{T} & {{x}_{m}}x_{1}^{T} & \cdots  & {{x}_{m}}x_{m}^{T}  \\
\end{matrix} \right)\
\end{equation}
An interpretation of the value of the variance could be expressed as follow, the larger the variance, the more movements and interesting features it represents while the smaller the value, it may be representing noise or unwanted data in the system. Thus, the covariance of ${{C}_{y}}$, the transformed matrix ${{Y}_{m\times n}}$ should maximize the diagonal entries in other words maximize the signal and minimize the covariance between variables by minimizing the off-diagonal entries. Based on the requirements, we choose the matrix ${{P}_{m\times n}}$ with orthogonal vectors ${{P}_{1}},{{P}_{2}},...,{{P}_{m}}$. From the result ${{(X{{X}^{T}})}^{T}}=X{{X}^{T}}$ and every square symmetric matrix to be orthogonally diagonalizable, then the matrix ${{S}_{m\times m}}$ is expressed as follow
\begin{equation}
S=ED{{E}^{T}}
\end{equation}
with ${{E}_{m\times m}}$ orthogonal matrix with its columns represented the orthogonal eigenvectors of $S$, and $D$, the diagonal matrix with eigenvalues of $S$ as its diagonal entries. The rows of the matrix $P$ are the eigenvectors of $S$ such that $P={{E}^{T}}$. Finally, the covariance of $Y$,
\begin{equation}
{{C}_{y}}=\frac{1}{n-1}PS{{P}^{T}}=\frac{1}{n-1}{{E}^{T}}\left( ED{{E}^{T}} \right)E=\frac{1}{n-1}D
\end{equation}
with $E{{E}^{T}}=I$, where $I$ is an $m \times m$ Identity matrix.

\subsection{The ${{I}^{th}}$ principal component PCAi of the transformed dataset ${{Y}_{i}}$}
Each PC is a linear combination of $x$ - variables with coefficients that meet these requirements: maximize the variance of ${{Y}_{i}}$, the sum of squared coefficients of each eigenvector equals one and the new principal component is uncorrelated with all the principal components previously defined.

\subsection{The essential Principal Components}
Considering ${{\lambda }_{1}}\ldots {{\lambda }_{l}}$ are the eigenvalues of the covariance matrix ${{C}_{y}}$ with ${{\lambda }_{1}}\ge {{\lambda }_{2}}\ge \ldots \ge {{\lambda }_{l}}$, thus ${{Y}_{i}}$ represents a proportion of the total variation, but to avoid loss of information, the proportion of variation by the first $k$ principal components should be large. Thus, we have,
\begin{equation}
\frac{{{\lambda }_{1}}+{{\lambda }_{2}}+\ldots +{{\lambda }_{k}}}{{{\lambda }_{1}}+{{\lambda }_{2}}+\ldots +{{\lambda }_{l}}}\simeq 1
\end{equation}

\section{Proposed PCA approach for data dimensional reduction}
To reduce the dimension of a $d$-dimensional dataset and project the new dimension unto a $k$-dimensional subspace where $k<d$ while preserving the structure and usefulness of the data, the steps are defined as follow:
\begin{itemize}
\item	Standardize the dataset.
\item	Calculate the eigenvalues and eigenvectors from the covariance matrix.
\item 	Sort eigenvalues in descending order and choose $k$ eigenvectors that correspond to the largest $k$ eigenvalues.
\item Obtain the projection matrix $P$ from the selected $k$ eigenvectors.
\item Transform the original dataset $X$ by the matrix $P$ to obtain a $k$-dimensional subspace $Y$.
\end{itemize}

\section{Dimensionality reduction implementation}
\subsection{Iris dataset}
The iris dataset contains $150$ Iris flowers from $3$ different species. It is a $150\times 4$ matrix where the columns are different features (sepal length, sepal width, petal length, petal width) and every row represents a separate flower sample. The three classes in the Iris dataset are Setosa (n=$50$), Versicolor (n=$50$), and Virginica (n=$50$). Within the dataset, the “Setosa” class is linearly separable from the other classes across all features combination as shown in Fig. 1.
\begin{figure}[h]
\centerline{\includegraphics[scale=0.3]{Figures/pair_plot.png}}
\caption{Iris dataset visualization across feature combination.}
\label{fig}
\end{figure}

\subsection{Implementation, result, and discussion}
As mention above, we follow the steps required to perform PCA. We first load the data into our PYTHON environment the above Fig. 1, shows the manipulation of the data.
The second step of the algorithm consists of standardizing the dataset (zero mean). The following step is to find the eigenvalues and corresponding eigenvectors from the covariance matrix, shown in Fig. 2. and Fig.3. The eigenvectors and eigenvalues of the covariance matrix is the core of PCA: The eigenvectors (principal components) determine the directions of the new feature space, and the eigenvalues determine their magnitude.
In the third step, we choose the top $k$ eigenvectors, the principal component is selected by sorting the eigenvalues in descending order and selecting shown in Fig. 4. The typical goal of a PCA is to reduce the dimensionality of the original feature space by projecting it onto a smaller subspace. To decide which eigenvector(s) can be dropped without losing too much information for the construction of a lower-dimensional subspace, the corresponding eigenvalues must be analyzed. Eigenvectors with the lowest eigenvalues bear the least information about the distribution of the data therefore they can be dropped. The common approach is to rank the eigenvalues from highest to lowest to choose the top $k$ eigenvectors. After deciding which eigenvectors to use, we also choose the number of principal components for the new feature subspace, to do so, we used the explained variance method, obtained from the eigenvalues and that tells us how much variance (extra information) that each component contribute. The plot in Fig. 5, shows that 72.77\% of the variance can be represented by the first principal component. The second principal component carries 23.0\% of information compared to the third and fourth component which can be safely dropped without affecting much the structure of the data. By combining the first two components we obtain 95.8\% of the variance, which means 95.8\% of the information is preserved.
The last step consists of the projection of the original data onto the new feature space. We use $4\times2$ dimensional eigenvectors to transform our data onto the new subspace, we reduce the dimension from the original 4 dimensions down to 2. Now our new features are represented by $150\times2$ as shown in Fig. 6.
\begin{figure}[h]
\centerline{\includegraphics[scale=0.7]{Figures/Covariance Matrix.png}}
\caption{Covariance matrix.}
\label{fig}
\end{figure}

\begin{figure}[h]
\centerline{\includegraphics[scale=0.7]{Figures/Eval and Evec.png}}
\caption{Eigenvectors and Eigenvalues.}
\label{fig}
\end{figure}

\begin{figure}[h]
\centerline{\includegraphics[scale=0.7]{Figures/Ev_sorted.png}}
\caption{Eigenvalues sorted in descending order.}
\label{fig}
\end{figure}

\begin{figure}[h]
\centerline{\includegraphics[scale=0.4]{Figures/Variance_exp.png}}
\caption{Cumulative and individual explained variance.}
\label{fig}
\end{figure}

\begin{figure}[h]
\centerline{\includegraphics[scale=0.4]{Figures/PC1_PC2_dark.png}}
\caption{Representation of Iris dataset in the new feature space.}
\label{fig}
\end{figure}

\section{Conclusion}

To identify patterns in our data, we often look for disparity across observations to differentiate them from one another. Hence it seems reasonable to be able to find a concise representation that best captures the variation in our initial data. PCA, via its maximum directions of variance, look to explain our data. By compressing a higher dimensional dataset into a lower one, while retaining most of the variance that allows us to perform visualization. Moreover, PCA summarizes our data along with the principal components (or eigenvectors), which explains most of the variance. Therefore, we can reduce the dataset to fewer dimensions and visualize our data's distribution. This can be helpful when we're performing a clustering algorithm that needs to choose the cluster number beforehand. Also, the application of PCA can speed up machine learning algorithms when dealing with Big Data, we might want to reduce the features to a lower dimension, without a significant loss of variance. By performing dimensionality reduction methods, we can reduce the number of features we have to speed up the training algorithm and save memory.

\begin{thebibliography}{00}
\bibitem{Lamrini} M. Lamrini and M. Y. Chkouri, “Decomposition and Visualization of High-Dimensional Data in a Two Dimensional Interface,” ICSSD 2019 - Int. Conf. Smart Syst. Data Sci., pp. 19–23, 2019, doi: 10.1109/ICSSD47982.2019.9002846.
\bibitem{Genender} A. Genender-Feltheimer, “Visualizing high dimensional and big data,” Procedia Comput. Sci., vol. 140, pp. 112–121, 2018, doi: 10.1016/j.procs.2018.10.308.
\bibitem{Liu} S. Liu, D. Maljovec, B. Wang, P. T. Bremer, and V. Pascucci, “Visualizing High-Dimensional Data: Advances in the Past Decade,” IEEE Trans. Vis. Comput. Graph., vol. 23, no. 3, pp. 1249–1268, 2017, doi: 10.1109/TVCG.2016.2640960.
\bibitem{Onana} F. G. G. and C. A. Onana, “High Dimensional Data Visualization: Advances and Challenges,” Int. J. Comput. Appl., vol. 162, no. March 2017, pp. 23–27, 2017, [Online]. Available: http://www.ijcaonline.org/archives/volume162/number10/27280-2017913362.
\bibitem{Xu} J. Xu, X. Li, and H. Wang, “Extracting Topological Features from Big Data Using Persistent Density Entropy,” J. Phys. Conf. Ser., vol. 1168, no. 3, 2019, doi: 10.1088/1742-6596/1168/3/032017.
\bibitem{Nocke} W. Müller, T. Nocke, and H. Schumann, “Enhancing the visualization process with principal component analysis to support the exploration of trends,” Conf. Res. Pract. Inf. Technol. Ser., vol. 60, no. June 2014, pp. 121–130, 2006, doi: 10.1145/1151903.1151922.
\bibitem{Salem} N. Salem and S. Hussein, “Data dimensional reduction and principal components analysis,” Procedia Comput. Sci., vol. 163, pp. 292–299, 2019, doi: 10.1016/j.procs.2019.12.111.
\bibitem{Houari} R. Houari, A. Bounceur, M. T. Kechadi, A. K. Tari, and R. Euler, “Dimensionality reduction in data mining: A Copula approach,” Expert Syst. Appl., vol. 64, no. October 2017, pp. 247–260, 2016, doi: 10.1016/j.eswa.2016.07.041.
\bibitem{Menon} V. Menon, Q. Du, and J. E. Fowler, “Fast SVD with Random Hadamard Projection for Hyperspectral Dimensionality Reduction,” IEEE Geosci. Remote Sens. Lett., vol. 13, no. 9, pp. 1275–1279, 2016, doi: 10.1109/LGRS.2016.2581172.
\bibitem{Rehman} M. H. ur Rehman, C. S. Liew, A. Abbas, P. P. Jayaraman, T. Y. Wah, and S. U. Khan, “Big Data Reduction Methods: A Survey,” Data Sci. Eng., vol. 1, no. 4, pp. 265–284, 2016, doi: 10.1007/s41019-016-0022-0.
\bibitem{A} A. Tharwat, “Principal component analysis - a tutorial,” Int. J. Appl. Pattern Recognit., vol. 3, no. 3, p. 197, 2016, doi: 10.1504/ijapr.2016.10000630.
\bibitem{D} D. J. Bartholomew, “Principal components analysis,” Int. Encycl. Educ., pp. 374–377, 2010, doi: 10.1016/B978-0-08-044894-7.01358-0.

\end{thebibliography}

\end{document}


\documentclass[12pt letterpaper]{article}

\usepackage{fullpage}
\usepackage{graphicx}
\usepackage{amsmath}

\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}
\usepackage{gensymb}

\usepackage{float}

\title{Chaos In the Diode-R-L Circuit}
\author{Johnny Minor \\ Partner: Kayla Mitchell}
\date{\today}

\begin{document}

\maketitle

%abstract should have a very brief overiew of the goals and main results of the experiment.
\begin{abstract}
In this experiment we used a diode, resistor, inductor circuit to study the non linear behavior of the diode. We powered the circuit at it's natural frequency with a sinusoidal voltage. We then incremented the voltage amplitude and observed the behavior of the voltage across the diode on an oscilloscope. Since the diode is non linear we were able to find experimentally the bifurcations of the diode. These three bifurcations were printed off for later viewing. Furthermore, the voltage was increased past the third bifurcation and the system clearly became chaotic as we could see jumps and non linear spikes of voltage on the oscilloscope. The Feigenbaum number was then calculated. Our experimental values confirmed the expected Feigenbaum number of 4.66.
\end{abstract}

\newpage

\section*{Description of Experiment}

When we replace a the capacitor in the familiar RLC (Resistor Inductor Capacitor) with a diode it can exhibit bifurcation and with a high enough amplitude chaos too. This is because the diode is non linear. Non linear behavior comes about all over in the natural world. From weather patterns, to ocean currents, and population growth. These can non linear behaviors can be modeled using a map.  So, the purpose of this experiment was to study period doubling in a circuit and also the determination of the Feigenbaum number.

\begin{figure}[H]
  \caption{The experimental setup as a circuit diagram.}
  \centering
    \includegraphics[width=.60\textwidth]{circuit_chaos.jpg}
    \label{fig:circuit}
\end{figure}

Mitchell Feigenbaum is a mathematical physicist who studied chaotic systems. What he discovered in 1975 was that all systems that exhibit chaos with the difference $\Delta_n = \lambda_{n+1} - \lambda_n$ of the values when bifurcation occurs rapidly converges as $n$ approaches infinity. If we take a ratio of these differences between each bifurcation interval and the next we come to Feigenbaum constants.

\begin{equation}
\label{feigenbaum}
\delta = \lim_{n\rightarrow \infty} \frac{a_{n-1} - a_{n-2}}{a_n - a_{n-1}} = 4.669\,201\,609\,\cdots
\end{equation}

where $a_n$ are values, in our case the voltage, at the $n$th period doubling. So, we would expect to find be able to confirm this value in our own experiment.

In the experiment we first used the Kenwood oscilloscope to check that our output voltage was set correctly. We set the frequency generator to a sine waveform at 70 kHz with no DC offset and the AC amplitude was set to 1 Vpp (Volt peak to peak). We then varied the voltage on the function generator by 0.01 V which was the minimum possible with the function generator. Once the period doubling was observed we noted at which amplitude and then looked at when the period doubling was able to seen to get a handle on the error.

\section*{Data and Analysis}

The raw data which we collected can be seen clearly in table \ref{table:data}. In each case our error was $\pm0.05$V.
It was difficult to get a clear view of exactly when the bifurcation occurred. Especially between the third period doubling and the chaotic region. So this seems reasonable error.

\begin{table}[H]
\centering
\caption{The data for the bifurcations we observed.}
\label{table:data}
\begin{tabular}{|l|l|}
\hline
Bifurcation & AC Amplitude (Vpp) \\ \hline
1st         & 2.6                \\ \hline
2nd         & 3.50                \\ \hline
3rd         & 3.70                \\ \hline
Chaos       & 3.80                \\ \hline
\end{tabular}
\end{table}

\begin{figure}[H]
  \caption{Oscilloscope print off with 1.0 Vpp. }
  \centering
    \includegraphics[width=.60\textwidth]{normal_diode.jpg}
    \label{fig:normal}
\end{figure}

Our plot looks like this because we are driving the circuit at it's natural frequency, and also because we don not have a period doubling taking place. This happens because the driving voltage goes negative which in turn flips the diode. So then the diode will block the voltage and we see zero voltage.

\begin{figure}[H]
  \caption{Oscilloscope print off showing the first period doubling.}
  \centering
    \includegraphics[width=.60\textwidth]{first_doubling.jpg}
    \label{fig:first}
\end{figure}

This is what we identified as the second period double. We saw this on the oscilloscope at 2.6$\pm0.05$ Vpp.

\begin{figure}[H]
  \caption{Oscilloscope print off showing the second period doubling.}
  \centering
    \includegraphics[width=.60\textwidth]{second_doubling.jpg}
    \label{fig:second}
\end{figure}

This is what we identified as the second period double. We saw this on the oscilloscope at 3.5$\pm0.05$ Vpp.

\begin{figure}[H]
  \caption{Oscilloscope print off showing the third period doubling.}
  \centering
    \includegraphics[width=.60\textwidth]{third_doubling.jpg}
    \label{fig:third}
\end{figure}

Although it can't be seen easily in figure \ref{fig:third} as we slightly increased the voltage on the frequency generator the peaks began to wiggle. This is because we were beginning to see the chaotic nature of the diode. Looking on the Kenwood oscilloscope this is very apparent because the Kenwood oscilloscope draws over the past periods. Therefore, some of the lines end up looking wiggly and thicker because of the overlap of lines being drawn on top of each other. When we switched to the Tektronix oscilloscope this wiggling wasn't apparent because

\begin{figure}[H]
  \caption{Oscilloscope print off showing the beginning of the chaotic region.}
  \centering
    \includegraphics[width=.60\textwidth]{chaos.jpg}
    \label{fig:chaos}
\end{figure}

This is what we saw on the oscilloscope at 3.8$\pm0.05$ Vpp.

\section*{Results and Conclusions}

Finally, we would like to calculate the Feigenbaum number with our data in table \ref{table:data}.
$$
\lambda_2 - \lambda_1 =  0.90\pm0.05 \mathrm{V}
$$
$$
\lambda_3 - \lambda_2 = 0.20\pm0.05 \mathrm{V}
$$

So then the Feigenbaum number we calculate is

$$
\delta = \frac{\lambda_2 - \lambda_1}{\lambda_3 - \lambda_2} = 4.60 \pm 0.10
$$

This seems to agree with our expected value we found in equation \ref{feigenbaum}.

In this experiment we found and confirmed the three period doubling points in our RLD circuit. Our calculated Feigenbaum number agrees with what we would expect which gives us confidence in our experimental data.

\end{document}


% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
\PassOptionsToPackage{dvipsnames,svgnames*,x11names*}{xcolor}
%
\documentclass[
]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provide euro and other symbols
\else % if luatex or xetex
  \usepackage{unicode-math}
  \defaultfontfeatures{Scale=MatchLowercase}
  \defaultfontfeatures[\rmfamily]{Ligatures=TeX,Scale=1}
\fi
% Use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\IfFileExists{microtype.sty}{% use microtype if available
  \usepackage[]{microtype}
  \UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\makeatletter
\@ifundefined{KOMAClassName}{% if non-KOMA class
  \IfFileExists{parskip.sty}{%
    \usepackage{parskip}
  }{% else
    \setlength{\parindent}{0pt}
    \setlength{\parskip}{6pt plus 2pt minus 1pt}}
}{% if KOMA class
  \KOMAoptions{parskip=half}}
\makeatother
\usepackage{xcolor}
\IfFileExists{xurl.sty}{\usepackage{xurl}}{} % add URL line breaks if available
\IfFileExists{bookmark.sty}{\usepackage{bookmark}}{\usepackage{hyperref}}
\hypersetup{
  colorlinks=true,
  linkcolor=blue,
  filecolor=Maroon,
  citecolor=Blue,
  urlcolor=Blue,
  pdfcreator={LaTeX via pandoc}}
\urlstyle{same} % disable monospaced font for URLs
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
% Set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother
\setlength{\emergencystretch}{3em} % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{-\maxdimen} % remove section numbering
\ifluatex
  \usepackage{selnolig}  % disable illegal ligatures
\fi

\author{}
\date{}

\begin{document}

\newcommand{\Ber}{\operatorname{Ber}}
\newcommand{\E}{\operatorname{E}}
\newcommand{\V}{\operatorname{Var}}
\newcommand{\diag}{\operatorname{diag}}

\newcommand{\bi}{\mathbf{i}}
\newcommand{\bj}{\mathbf{j}}
\newcommand{\bt}{\mathbf{t}}

\newcommand{\bh}{{\boldsymbol{h}}}
\newcommand{\bw}{{\boldsymbol{w}}}
\newcommand{\bv}{{\boldsymbol{v}}}
\newcommand{\bx}{{\boldsymbol{x}}}
\newcommand{\by}{{\boldsymbol{y}}}
\newcommand{\bb}{{\boldsymbol{b}}}
\newcommand{\bz}{{\boldsymbol{z}}}
\newcommand{\bu}{{\boldsymbol{u}}}
\newcommand{\bX}{{\boldsymbol{X}}}
\newcommand{\bY}{{\boldsymbol{Y}}}
\newcommand{\bZ}{{\boldsymbol{Z}}}

\hypertarget{multivariate-gaussian}{%
\section{Multivariate Gaussian}\label{multivariate-gaussian}}

\hypertarget{probabilistic-approach-to-linear-regression}{%
\subsection{Probabilistic Approach to Linear
Regression}\label{probabilistic-approach-to-linear-regression}}

\begin{itemize}
\item
  \(X\): random variable\\
  \(p(x)\): probability density function of \(X\)\\
  \hspace*{0.333em}\hspace*{0.333em} \(\Longleftrightarrow\) ~~
  \(p(x) \ge 0\), ~~ \(\int_{-\infty}^\infty p(x) dx =1\) ~~ and
  \[ P[ a \le X \le b ]= \int_a^b p(x) dx \]
\item
  For example, the \emph{normal} random variable with mean \(\mu\) and
  variance \(\sigma^2\) has the density function
  \[ p(x) = \frac 1 {\sqrt{2 \pi \sigma^2}} \exp \left ( -\tfrac{(x-\mu)^2}{2 \sigma^2} \right ). \]
  In this case, we write \(X \sim \mathcal N (\mu, \sigma^2)\) and
  \[ p(x) = \mathcal N(x| \mu, \sigma^2) .\]
\end{itemize}

\begin{figure}
\hypertarget{fig:normal}{%
\centering
\includegraphics[width=0.5\textwidth,height=\textheight]{normal.png}
\caption{Graph of \(\mathcal N(x|0,1)\)}\label{fig:normal}
}
\end{figure}

\begin{itemize}
\item
  \(X,Y\): two random variables\\
  \(p(x,y)\): (joint) probability density function\\
  \hspace*{0.333em}\hspace*{0.333em}\(\Longleftrightarrow\) ~~
  \(p(x,y) \ge 0\),~~
  \(\int_{-\infty}^\infty \int_{-\infty}^\infty p(x,y) dx dy =1\) ~~ and
  \[ P[ (X,Y) \in A ]= \iint \limits_A p(x,y) dx dy \]
\item
  Marginal density functions:
  \[p_X(x)= \int_{-\infty}^\infty p(x,y) \, dy  \quad\text{ and } \quad p_Y(y)= \int_{-\infty}^\infty p(x,y) \, dx\]
\item
  The \emph{covariance} of \(X\) and \(Y\) is defined by
  \[ \mathrm{Cov}(X,Y)= \operatorname{E}[ (X-\operatorname{E}(X)) (Y-\operatorname{E}(Y))]=\operatorname{E}(XY) -\operatorname{E}(X)\operatorname{E}(Y) .\]
\item
  The \emph{conditional density} of \(X\) given that \(Y=y\) is defined
  to be
  \[ p_{X|Y}(x|y)= \frac {p(x,y)}{p_Y(y)}= \frac {p(x,y)}{\int p(u,y)du} .\]
\item
  More generally, we consider
  \[ T,X_1, \dots, X_m: \text{ random variables}. \] Let
  \({\boldsymbol{x}}=(x_1, \dots , x_m)\). Then we have\\
  \(p(t,{\boldsymbol{x}})\): probability density, ~~\\
  \(p(t|{\boldsymbol{x}})\): conditional density
\item
  Given random variables \(X_1, \dots , X_m\), the \emph{covariance
  matrix} is defined to be \[ \Sigma = [ \mathrm{Cov}(X_i, X_j) ]. \]
\end{itemize}

Recall the settings of linear regression.

\begin{itemize}
\item
  Input: \(x\) ~~ Output: \(t\)\\
  Observations: \((x_1,t_1), (x_2, t_2), \dots , (x_N, t_N)\)
\item
  In many applications we expect some noise in determining the output,
  and the following assumption is reasonable.
\item
  Assume that given \(x\), the corresponding value of \(t\) has a normal
  distribution with a mean equal to the value \(y(x, {\boldsymbol{w}})\)
  of the polynomial curve
  \[ y(x,{\boldsymbol{w}}) = w_0 +w_1 x + w_2 x^2 + \cdots + w_D x^D ,\]
  where \({\boldsymbol{w}}=[w_0, w_1, \dots , w_D]^\top\).
\item
  That is to say,\\
  \[ t=y(x,{\boldsymbol{w}})+\epsilon , \] where \(\epsilon\) is a
  Gaussian noise with variance \(\sigma^2\). Then we can write
  \[ p(t|x, {\boldsymbol{w}}, \beta) = \mathcal N(t|y(x, {\boldsymbol{w}}), \beta^{-1}), \]
  where \(\beta = 1/\sigma^2\) is the inverse variance, called
  \emph{precision}.
\item
  Given \({\boldsymbol{x}}=(x_1, \dots , x_N)\) and
  \(\mathbf{t}= (t_1, \dots , t_N)\), we have
  \[ p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) = \prod_{n=1}^N \mathcal N(t_n|y(x_n, {\boldsymbol{w}}), \beta^{-1}). \]
\item
  Let \({\boldsymbol{x}}=(x_1, \dots, x_N)\) and
  \(\mathbf{t}= (t_1,\dots, t_N)\) be given.\\
  \textbf{Task}: Determine \({\boldsymbol{w}}\) and \(\beta\) by maximum
  likelihood.\\
  This is a probabilistic approach to the regression problem.
\item
  We have
\end{itemize}

\[ p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) = \prod_{n=1}^N \mathcal N(t_n|y(x_n, {\boldsymbol{w}}), \beta^{-1}). \]

To maximize this function, we take logarithm:
\[ \ln p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) = -\frac \beta 2 \sum_{n=1}^N \{ y(x_n, {\boldsymbol{w}})-t_n \}^2 + \frac N 2 \ln \beta - \frac N 2 \ln (2 \pi) .\]\{\#eq:log\}

\textbf{\emph{Exercise}}: Verify equality +@eq:log.

\begin{itemize}
\tightlist
\item
  Thus maximizing likelihood with respect to \({\boldsymbol{w}}\) is
  equivalent to minimizing the error function \(E({\boldsymbol{w}})\):
  \begin{align*} E({\boldsymbol{w}})&=\tfrac 1 2 \sum_{n=1}^N \{ y(x_n, {\boldsymbol{w}})-t_n \}^2 . \end{align*}
\end{itemize}

Thus this probabilistic approach leads to the same computation as the
usual linear regression to determine \({\boldsymbol{w}}\). Nevertheless,
we can also determine the parameter \(\beta\) to get maximum likelihood
as follow.

\begin{itemize}
\item
  After finding out \({\boldsymbol{w}}_{\mathrm{ML}}\), take the
  derivative with respect to \(\beta\) to obtain
  \[ \frac 1 {\beta_{\mathrm{ML}}} = \frac 1 N \sum_{n=1}^N \{ y(x_n, {\boldsymbol{w}}_{\mathrm{ML}})-t_n \}^2 .\]
\item
  Finally, the \emph{predictive distribution} is given by
  \[ \boxed{ p(t|x, {\boldsymbol{w}}_{\mathrm{ML}}, \beta_{\mathrm{ML}}) = \mathcal N(t|y(x, {\boldsymbol{w}}_{\mathrm{ML}}), \beta_{\mathrm{ML}}^{-1})} .\]
\end{itemize}

!!Example or code??

\hypertarget{bayesian-linear-regression}{%
\subsection{Bayesian Linear
Regression}\label{bayesian-linear-regression}}

\begin{itemize}
\item
  Bayesian linear regression avoids the over-fitting problem of maximum
  likelihood.
\item
  We need multi-dimensional normal distributions.
\end{itemize}

Recall one-dimensional normal distribution:
\[ p(x) =  \mathcal N(x| \mu, \sigma^2)= \frac 1 {\sqrt{2 \pi \sigma^2}} \exp \left ( -\tfrac{(x-\mu)^2}{2 \sigma^2} \right ). \]

\begin{itemize}
\item
  \(D\)-dimensional Gaussian distribution:
  \[ \mathcal N({\boldsymbol{x}}|\pmb \mu,  \Sigma) = \frac 1 {(2\pi)^{D/2}}\frac 1 {| \Sigma|^{1/2}} \exp \left \{ -\frac 1 2 ({\boldsymbol{x}}-\pmb \mu)^\top  \Sigma^{-1} ({\boldsymbol{x}}-\pmb\mu) \right \} \]
  where the \(D\)-dimensional vector \(\pmb \mu\) is the mean, the
  \(D\times D\) matrix \(\Sigma\) is the covariance, and \(|\Sigma|\) is
  the determinant of \(\Sigma\).
\item
  Assume \begin{align*}
  p({\boldsymbol{x}}) & = \mathcal N ({\boldsymbol{x}}| \pmb \mu, \Lambda^{-1}), \\
  p({\boldsymbol{y}}|{\boldsymbol{x}}) & = \mathcal N ({\boldsymbol{y}}| A{\boldsymbol{x}}+ \pmb b, L^{-1}) .
  \end{align*}
\item
  Then we have \begin{align*}
  p({\boldsymbol{y}}) & = \mathcal N ({\boldsymbol{y}}| A \, \pmb \mu+\pmb b,  L^{-1}+ A \,  \Lambda^{-1} A^\top), \\
  p({\boldsymbol{x}}|{\boldsymbol{y}}) & = \mathcal N( {\boldsymbol{x}}|  \Sigma \, \{ A^\top  L({\boldsymbol{y}}-\pmb b) +  \Lambda \, \pmb \mu \},  \Sigma),
  \end{align*} where \(\Sigma=(\Lambda+A^\top L A)^{-1}\).
\end{itemize}

!! Do we need to verify this??

Recall the settings of linear regression.

\begin{itemize}
\item
  Input: \(x\); ~~ Output: \(t\)\\
  Observations: \((x_1,t_1), (x_2, t_2), \dots , (x_N, t_N)\)
\item
  Assume that given \(x\), the corresponding value of \(t\) has a normal
  distribution with a mean equal to the value \(y(x, {\boldsymbol{w}})\)
  of the polynomial curve
  \[ y(x,{\boldsymbol{w}}) = w_0 +w_1 x + w_2 x^2 + \cdots + w_D x^D ,\]
  where \({\boldsymbol{w}}=[w_0, w_1, \dots , w_D]^\top\).
\item
  Consider a prior distribution for \({\boldsymbol{w}}\):
  \[ p({\boldsymbol{w}}|\alpha) = \mathcal N({\boldsymbol{w}}| \pmb{0}, \alpha^{-1} I) . \]
  Note that we are taking the initial vector for \({\boldsymbol{w}}\) to
  be the zero vector \(\pmb{0}\).
\item
  Recall that we have
  \[ p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) = \prod_{n=1}^N \mathcal N(t_n|y(x_n, {\boldsymbol{w}}), \beta^{-1}). \]
\item
  Bayes' Theorem says
  \[ \text{(posterior)} \propto \text{(likelihood)} \times \text{(prior)} .\]
  In our situation, it becomes
  \[ p({\boldsymbol{w}}| {\boldsymbol{x}}, \mathbf{t}, \alpha, \beta) \propto p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) p({\boldsymbol{w}}| \alpha) .\]
  \textbf{Task}: Given the data, determine \({\boldsymbol{w}}\) so that
  the posterior is maximized. This process is called \emph{maximum
  posterior} (MAP).
\item
  Take the negative logarithm of the posterior
  \begin{align*} & - \ln p({\boldsymbol{w}}| {\boldsymbol{x}}, \mathbf{t}, \alpha, \beta)  \\ & \hskip 1 cm  = - \ln \left [  p(\mathbf{t}|{\boldsymbol{x}}, {\boldsymbol{w}}, \beta) p({\boldsymbol{w}}| \alpha) \right ]  + \text{constant} \\ &\hskip 1 cm =
  \frac \beta 2 \sum_{n=1}^N \{ y(x_n, {\boldsymbol{w}})-t_n \}^2 + \frac \alpha 2 {\boldsymbol{w}}^\top {\boldsymbol{w}}+ \text{constants}
  \end{align*}
\item
  The maximum of the posterior is given by the minimum of
  \[ \tilde E({\boldsymbol{w}}) = \frac \beta 2 \sum_{n=1}^N \{ y(x_n, {\boldsymbol{w}})-t_n \}^2 + \frac \alpha 2 {\boldsymbol{w}}^\top {\boldsymbol{w}}.  \]
  Thus maximizing the posterior distribution is equivalent to minimizing
  the \emph{regularized} sum-of-square error function.
\item
  Let \(\phi_i(x)=x^i\) and
  \[ X=\begin{bmatrix} 1 &1 & \cdots &1 \\ \phi_1(x_1) & \phi_1(x_2) & \cdots &\phi_1(x_N) \\ \phi_2(x_1) & \phi_2(x_2) & \cdots &\phi_2(x_N) \\ \vdots & \vdots & & \vdots \\ \phi_{M-1}(x_1) & \phi_{M-1}(x_2) & \cdots & \phi_{M-1}(x_N) \end{bmatrix} .\]
  Then
  \[ \tilde E({\boldsymbol{w}}) = \frac \beta 2 \lVert X^\top {\boldsymbol{w}}- \mathbf{t}\rVert^2 + \frac \alpha 2 {\boldsymbol{w}}^\top {\boldsymbol{w}},\]
  and
  \[ \nabla \tilde E({\boldsymbol{w}})= \beta X(X^\top {\boldsymbol{w}}- \mathbf{t}) +\alpha {\boldsymbol{w}}=0 . \]
  Thus
  \[ {\boldsymbol{w}}= \beta S X \mathbf{t}\quad \text{ with } \quad S^{-1}= \beta X X^\top + \alpha I . \]
\end{itemize}

We can choose values of the parameters \(\alpha\) and \(\beta\).

\begin{figure}
\hypertarget{fig:bcf}{%
\centering
\includegraphics[width=0.5\textwidth,height=\textheight]{bayesian-curve-fitting.png}
\caption{\(N=9\), \(\alpha=0.01\), \(\beta=1000\)}\label{fig:bcf}
}
\end{figure}

Recall the maximum likelihood gave us

\begin{figure}
\hypertarget{fig:f9}{%
\centering
\includegraphics[width=0.5\textwidth,height=\textheight]{f-9.png}
\caption{Over-fitting}\label{fig:f9}
}
\end{figure}

\hypertarget{predictive-distribution}{%
\subsection{Predictive distribution}\label{predictive-distribution}}

\begin{itemize}
\item
  The posterior can be computed explicitly, since the prior and the
  likelihood are all Gaussian. Indeed, we obtain
  \[ p({\boldsymbol{w}}|\mathbf{t}) = \mathcal N({\boldsymbol{w}}| m_N, S_N),\]
  where
  \[ m_N = \beta S_N X \mathbf{t}\quad \text{ and } \quad S_N^{-1}  = \alpha I +\beta X X^\top .\]
\item
  Furthermore, we can compute the predictive distribution
  \(p(t|x, {\boldsymbol{x}}, \mathbf{t})\). Assume that \(\alpha\) and
  \(\beta\) are fixed. Then the predictive distribution is given by
  \[ p(t|x, {\boldsymbol{x}}, \mathbf{t}) = \int p(t|x, {\boldsymbol{w}}) p({\boldsymbol{w}}| {\boldsymbol{x}}, \mathbf{t}) d{\boldsymbol{w}},  \]
  where
  \[p(t|x, {\boldsymbol{w}}) = \mathcal N(t|y(x, {\boldsymbol{w}}), \beta^{-1}).\]
\item
  One can compute the integral to obtain
  \[p(t|x, {\boldsymbol{x}}, \mathbf{t}) = \mathcal N(t| m(x), s^2(x) ),\]
  where \begin{align*}
  m(x)&= \beta \boldsymbol\phi(x)^\top S \sum_{n=1}^N \boldsymbol\phi(x_n) t_n, \\
  s^2(x) &= \beta^{-1} + \boldsymbol\phi(x)^\top S \boldsymbol\phi(x), \\
  S^{-1} &= \alpha I + \beta \sum_{n=1}^N \boldsymbol \phi(x_n) \boldsymbol\phi(x)^\top, \\
  \boldsymbol \phi(x)&=[1, \phi_1(x), \phi_2(x),  \dots , \phi_M(x)]^\top ,  \quad \phi_i(x)=x^i .
  \end{align*}
\end{itemize}

\end{document}