%!TEX root = ../thesis.tex
%*******************************************************************************
%****************************** Third Chapter **********************************
%*******************************************************************************
\chapter{Discussion}

% **************************** Define Graphics Path **************************

\graphicspath{{Chapter5/Figs/Vector/}{Chapter5/Figs/}}

\section{Non-Parametric}
The three non-parametric algorithms produced several noticeable results. Firstly, Monte Carlo sampling outperformed both Greedy and RoD sampling. This is demonstrated convincingly through Figure~\ref{fig:nPComp}, where results from the greedy results suggest the worst accuracy.

Despite the greedy algorithm demonstrating the worst accuracy, interesting results were shown with RoD sampling. Poor selection is evidently present with the first sample set, although rapid improvement quickly follows. Indeed, after the first iteration, the learning rate is superior to the other two algorithms, boasting a $\dot{\mathrm{score}}=41$. An extra iteration may indeed have seen RoD surpassing Monte Carlo. This behaviour is expected as the RoD algorithm specifically attempts to target regions of the model which cause the largest changes towards optimal fitting.

Both RoD and greedy sampling are suspected to suffer from clusterisation whereby data points similar to each other in the feature space are sampled within the same batch, thus reducing the total information conveyed per batch operation. This is believed to be particularly costly with the first iteration as the model will heavily overfit to the new cluster it has sampled. The random nature of Monte Carlo reduces this prospect, hence the apparent promising performance of a random sampling methodology. Evidence to this is shown in Figure~\ref{fig:MCTestSet}, Figure~\ref{fig:GreedyTestSet}, and Figure~\ref{fig:RODTestSet}.

\begin{figure}[H]
    \begin{center}
        \includegraphics{nonParamComp1.pdf}
        \caption[Non-Parametric Comparison]{Comparison of different non-parametric algorithms with interpolation lines to guide the eye.}
        \label{fig:nPComp}
    \end{center}
\end{figure}

This demonstrates a danger with Batch Active Learning. It is very easy to produce a learning algorithm which actually performs worse than random screening.

\section{Parametric}
The first of these is a first order composite algorithm, RoDG, which uses different active learning algorithms as a base. The second is a clustering algorithm with the number of clusters left as a parameter. The third is a second order composite active learning algorithm which combines the other two parametric functions, named RoDGer. An improvement is seen throughout these algorithms, with RoDGer performing the best.

\begin{figure}[H]
    \begin{center}
        \includegraphics{paramComp1.pdf}
        \caption[Parametric Comparison]{Comparison of different parametric algorithms with interpolation lines to guide the eye.}
        \label{fig:pComp}
    \end{center}
\end{figure}

Several points of interest are highlighted with these results. Firstly, despite improving upon RoD, RoDG is still beaten by Monte Carlo sampling. Again, the methodology suffers from clustering of points.

The sampling process of the Cluster III algorithm demonstrates its ability at outperforming the random sampling methodology of Monte Carlo even within the first iteration. The RoDGer algorithm demonstrates a long term strategy, falling within error of Cluster III in the first iteration before steadily improving beyond the capabilities of Cluster III.

Upon investigation of the parameters settled upon within these several points arise. Firstly with RoD with Greed, at low $\alpha$, the score appears uncorrelated with $\alpha$, only experiencing a significant rise with $\alpha{}>0.3$. Thus, it can be surmised that RoD is the driving force, with evidence given by the final scores for RoD and RoD with Greed algorithms arising within error of each other.

On the other hand, the sensitivity of Cluster III is low to cluster size, demonstrated by Figure~\ref{fig:clusterTest}. Here, no significant change is observed within the significant parameter range. It is believed this is due to the highest ranking points remaining within the top clusters as large clusters are likely to remain the largest, even with an increased number of clusters. Thus, the top candidates are likely to remain in the same region of the feature space.

Most surprising are the parameters found for the RoDGer, shown in Figure~\ref{fig:paramHg}. Here, it appears the highest sensitivity is based on $\alpha_2$, the exponent to the RoD with Greed score. This indeed shows a difference from Rod with Greed, where the Greed aspect appeared to be borderline irrelevant, with final results within error of RoD. Comparatively, $\alpha_0$ and $\alpha_1$ appear to have a linear fit.

\begin{figure}[H]
    \begin{center}
        \includegraphics{hgParams.pdf}
        \caption[Non-parametric comparison]{Training results for determining parameters for the RoDGer algorithm. A) shows the deviation of $\alpha_0$, B) shows the deviation of $\alpha_1$, and C) shows the deviation of $\alpha_2$. Curves have been added to demonstrate the trends observed.}
        \label{fig:paramHg}
    \end{center}
\end{figure}

Due to the empirical nature of the curves, linear interpolation has been used to guide the eye of the reader to the trend. Take Figure~\ref{fig:RODTestSet} where the first iteration produces no significant change. By fitting a curve, the results here could be misrepresented, so interpolation has been used in most cases to guide the eye. In Figure~\ref{fig:paramHg}, it was considered essential to present the different in form between ${\alpha_0}$, ${\alpha_1}$, and ${\alpha_2}$ so a curve has been added to guide the reader to the differences in form. Polynomial fits were used for each subfigure, with A and B using 1st order and C using 4th order.

\section{Problem Sensitivity}
The problem set up provides an estimation of a fixed number of iteration and sample size. What if these change? Are the parameters overfitted to this specific problem? If deviations from this are taken, are the intelligent methods worse than Monte Carlo? This is important to determine, as there is a significant potential cost to such an inefficiency.

Monte Carlo is tested compared to RoDGer and RoD, using the already fitted parameters where required. Monte Carlo is included to demonstrate the baseline case, while RoDGer is included due to producing the best results in previous testing. RoD has been included to assess if the learning rate maintains significantly higher than Monte Carlo in an extended testing range. Results have been presented in Figure~\ref{fig:sensi1}. Convergence of RoD to Monte Carlo is observed, with RoDGer consistently outperforming the other two algorithms.

\begin{figure}[H]
    \begin{center}
        \includegraphics{Sensi1.pdf}
        \caption[Results of Prolonged Sampling]{Comparison of Monte Carlo, RoD, and RoDGer over 8 iterations.}
        \label{fig:sensi1}
    \end{center}
\end{figure}

Using sample sizes of 50 and 150 on Monte Carlo and RoDGer supports the power of RoDGer over simply using Monte Carlo.

\begin{figure}[H]
    \begin{center}
        \includegraphics{Sensi2.pdf}
        \caption[Results of Different Sample Sizes]{Comparison of Monte Carlo and RoDGer with different sample size. A) shows batches of 50 and B) shows results for batches of 150.}
        \label{fig:sensi2}
    \end{center}
\end{figure}

Finally, an investigation into using a reduced set of models is undertaken, using Bayesian ridge, k-nearest neighbours, and a multi-layer perceptron regressor (MLPR). This last model is a neural network, chosen since it represents a different class of machine learning model. The other two were used within other trial in order to allow a sample standard deviation to be returned, as required by algorithms relying on the predict\_error method of the Model class. Results are shown in Figure~\ref{fig:modelSensi}, demonstrating the robustness of RoDGer against model changes.

\begin{figure}[H]
    \begin{center}
        \includegraphics{Models.pdf}
        \caption[Sensitivity to Model Selection]{Comparison of Monte Carlo and RoDGer using different machine learning models.}
        \label{fig:modelSensi}
    \end{center}
\end{figure}

\section{Refinement}
There are several points for progression that are worth discussing. Firstly, the training system requires improvement. Despite the observations of parallelisation leading to a situation of $\mathcal{O}(c)$ given an infinite number of processing units, an infinite number of processing units unfortunately do not exist. In the event of three parameters, the current methodology requires $N_\mathrm{train}\prod(n_{\alpha_i})$ executions of the learning algorithm, where $n_{\alpha_i}$ is the number of different values tested for $\alpha_i$. Even with simply 3 different values tested for each parameter in the RoDGer algorithm, this equates to $\sim{}4500$ executions of the algorithm. Thus, as the maximum number of CPUs available was 380, the training process became $\mathcal{O}\left(N_\mathrm{train}\prod{n_{\alpha_i}}\right)$. A potential solution would be segmentation, where the datasets are split into smaller groups with which are tested on a sample of the parameter space, with results from these smaller groups amalgamated at the end. Additionally, active learning could be used in the determination of the minima. Here, the goal would be to find the minima using as few parameter values as possible.

The current implementation of the scoring system is simple. Although this would please Occam's barber, it is believed that this is not satisfactory for the aggressive pursuit of effective drugs. One possibility is only scoring samples which show a pChEMBL greater than seven. This puts a greater weight on these samples, although a multidisciplinary discussion is required here. This could potentially be aided by categorising the data set instead, instead separating results into $\mathrm{pChEMBL}>7$ and $\mathrm{pChEMBL}\leq{}7$.

\section{SARS-CoV-2}
Given the need for current need for treatments against COVID-19, there is not a better and more suitable time to trial the algorithm within this context. \textcite{prot20} suggest 3-chymotrypsin-like protease as a target for antiviral treatments. Several amendments to the current code base will be required to ensure successful operation within a robot scientist. Fortunately, the code base was written with this in mind, featuring several custom functions which may be rewritten to create an application interface (API).


\documentclass[12pt]{article}
\usepackage{fullpage}
\usepackage{amsthm}
\usepackage{amsfonts,amsmath, amssymb,latexsym,mathrsfs}
\usepackage[margin=1.15in]{geometry}
\usepackage{enumitem}
\setlength{\parindent}{0pt}
\usepackage{tikz-cd}
\usepackage{fancyhdr}

\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]

\newtheorem{prop}{Proposition}[section]

\theoremstyle{definition}
\newtheorem{definition}{Definition}[section]

\theoremstyle{remark}
\newtheorem*{remark}{Remark}

\theoremstyle{definition}
\newtheorem{example}{Example}[section]

\theoremstyle{definition}
\newtheorem{lem}{Lemma}[section]

\theoremstyle{definition}
\newtheorem{cor}{Corollary}[section]

\date{}
\title{Exam 2 Summary}

\begin{document}
\maketitle
\section{L'Hopital's rule}

L’Hopital’s rule: If $f$ and $g$ are differentiable and (below $a$ can be $\pm \infty$)\\
i)$f(a) = g(a) = 0$ for finite $a$, \\
Or ii)$\lim_{x\to a} f(x)=\lim_{x\to a} g(x)= \pm \infty$,\\
Or iii)$\lim_{x\to \infty} f(x)= \lim_{x\to \infty} g(x) = 0$
then
\[\lim_{x\to a}\frac{f(x)}{g(x)} = \lim_{x\to a} \frac{f'(x)}{g'(x)} \]

\subsection{Dominance}
We say that $g$ dominates $f$ as $x \to \infty$ if $\lim_{x\to \infty}f(x)/g(x) = 0$.
\subsection{How to determine some bad limit?}

There are several types of the limits that is ''bad'' which requires L'Hopital's rule to calculate:
$0/0, \infty/\infty, \infty\cdot0$. Although the first two cases we can use L'Hopital's rule to calculate, the others we cannot use it directly.

Read the book, and there are several things that we can consider.
\begin{itemize}
	\item Consider taking log.
	\item Consider $1/f(x)$ so that we can transform $\infty$ to '$1/0$' or $0$ to '$1/\infty$'.
\end{itemize}

\section{Improper integral}
Formal definition of the improper integral I will let you read the book carefully, they are in the box.
However, informally, there are two types of improper integral which we just interpret them as a limit.

\begin{itemize}
	\item The first case is where we have the limit of the integration goes to infinity, i.e. $\lim_{b \to \infty} \int^b_a f(x) dx$.
	\item The integrand goes to infinity as $x \to a$.
\end{itemize}

\subsection{Converges or diverges?}
The basic question that one want to know about the improper integral is basically is it well defined?

This turns to ask if an improper integral converges or not.

There are four ways people ususally use to check this fact.
\begin{enumerate}
	\item Check by definition, this means check the limit directly.
	\item $p$-test.\\
	\includegraphics*[width=0.9\textwidth]{1.png}
	\item Exponential decay test.
	\[\int^\infty_0 e^{-ax} dx\] converges for $a>0$.
	\item Comparison test.\\
	If $f(x)\geq g(x) \geq 0$ on the interval $[a,\infty]$ then,\begin{itemize}
	\item If $\int^\infty_a f(x) dx$ converges then so does $\int^\infty_a g(x) dx$.
	\item If $\int^\infty_a g(x) dx$ diverges then so does $\int^\infty_a f(x) dx$.
	\end{itemize}
	\item Limit Comparison theorem.\\
	Limit Comparison Test. If $f(x)$ and $g(x)$ are both positive  on the interval $[a,b)$ where $b$ could be a real number or infinity.
	and
	\[\lim_{x\to b}\frac{f(x)}{g(x)} = C\] such that $0 < C < \infty$
	then the improper integrals $\int^b_a f(x) dx$ and $\int^b_a g(x) dx$ are either both convergent or both divergent.

\end{enumerate}

\section{Probability}
\subsection{PDF and CDF}
\begin{definition}
A function $p(x)$ is a \textbf{probability density function} or PDF if it satisfies the following conditions
\begin{itemize}
\item $p(x) \geq 0$ for all $x$.
\item $\int_{-\infty}^\infty p(x) = 1.$
\end{itemize}
\end{definition}

\begin{definition}
A function $P(t)$ is a \textbf{Cumulative Distribution Function} or cdf, of a density function $p(t)$, is defined by
\[P(t) =\int_{-\infty}^t p(x) dx \]
Which means that $P(t)$ is the antiderivative of $p(t)$ with the following properties:
\begin{itemize}
\item $P(t)$ is increasing and $0\leq P(t)\leq 1$ for all $t$.
\item $\lim_{t \to \infty}P(t)=1.$
\item $\lim_{t \to -\infty}P(t)=0.$
\end{itemize}
\end{definition}

Moreover, we have $\int_a^b p(x)dx=P(b)-P(a)$.

\subsection{Probability, mean and median}

\subsubsection*{Probability}
Let us denote $X$ to be the quantity of outcome that we care ($X$ is in fact, called the random variable).
\[\mathbb{P}\{a\leq X\leq b\}=\int_a^b p(x)dx=P(b)-P(a)\]
\[\mathbb{P}\{X\leq t\}=\int_{-\infty}^t p(x)dx=P(t)\]
\[\mathbb{P}\{X\geq s\}=\int_{s}^\infty p(x)dx=1-P(s)\]

\subsubsection*{The mean and median}
\begin{definition}
A \textbf{median} of a quantity $X$ is a value $T$ such that the probability of $X\leq T$ is $1/2$. Thus we have  $T$ is defined by the value such that
\[ \int_{-\infty}^T p(x) dx=1/2 \] or \[P(T)=1/2\].
\end{definition}
\begin{definition} A \textbf{mean} of a quantity $X$ is the value given by
	\[ Mean= \frac{\text{Probability of all possible quantity}}{\text{Total probability}}= \frac{\int_{-\infty}^{\infty}xp(x)dx}{\int_{-\infty}^{\infty}p(x)dx}=\frac{\int_{-\infty}^{\infty}xp(x)dx}{1}=\int_{-\infty}^{\infty}xp(x)dx. \]
\end{definition}

\subsubsection*{Normal Distribution}
\begin{definition}
A normal distribution has a density function of the form
\[p(x)=\frac{1}{\sigma \sqrt{2 \pi}}e^{-\frac{(x-\mu)^2}{2\sigma^2}}\] where $\mu$ is the mean of the distribution and $\sigma$ is the standard deviation, with $\sigma > 0$.
The case $\mu = 0$, $\sigma = 1$ is called the standard normal distribution.

\end{definition}

\section{Sequences and Series}
\subsection{Sequence}
\begin{definition}
	A sequence is an enumerated collection of objects in which repetitions are allowed. We denote the sequence $a_1, a_2, \ldots, a_n \ldots $ as $(a_n)$.

\end{definition}

Note that for sequence, there are two things that we will usually concern. The first one is the convergence of the sequence itself, which is defined as

\begin{definition}
The sequence $s_1, s_2, s_3, \ldots , s_n, \ldots$ has a limit $L$, written $\lim_{n \to \infty}s_n = L$, if $s_n$ is as close to
$L$ as we please whenever $n$ is sufficiently large. If a limit, $L$, exists, we say the sequence
converges to its limit $L$. If no limit exists, we say the sequence diverges.
\end{definition}

If we think about the situation more clearly, we will see that, in the definition it actually encodes an information: A convergent sequence is bounded. Is the converse true here? Unfortunately, it is not true that a bounded sequence is convergent. However, by the following theorem, we knows when will the bounded sequence becomes convergent.

\begin{thm}
\textbf{Bounded Monotone sequence converges}: If a sequence $s_n$ is bounded and monotone, it converges.
\end{thm}

\newpage
\subsection{Series}
There is another thing that we will usually concern.

Consider the partial sum of sequence $s_n$, i.e., $S_n=\sum_{i=1}^{n}s_i$, then we will see that the partial sum forms a sequence as well. Therefore there is a natural question to ask here, when will the sequence $S_n$ of partial sums converges?

\begin{definition}
The associated series for a sequence $(a_n)$ is defined as the ordered sum $\sum_{n=1}^{\infty}a_n$.
\end{definition}

\begin{definition}
If the sequence $S_n$ of partial sums converges to $S$, so $\lim_{n \to \infty}S_n = S$, then we say the series
$\sum_{n=1}^{\infty} a_n$ converges and that its sum is $S$. We write
$\sum_{n=1}^{\infty} a_n = S$. If $\lim_{n \to \infty}S_n$ does not exist, we
say that the series diverges.
\end{definition}

There are several properties for convergent series, which is super useful, summarized as below.
\begin{thm}
Convergence Properties of Series
\begin{enumerate}
\item If $\sum_{n=1}^{\infty} a_n$ and $\sum_{n=1}^{\infty} b_n$ converge and if $k$ is a constant, then

$\sum_{n=1}^{\infty} (a_n+b_n)$ converges to$\sum_{n=1}^{\infty} a_n + \sum_{n=1}^{\infty} b_n$.\\
$\sum_{n=1}^{\infty} ka_n$ converges to $k\sum_{n=1}^{\infty} a_n$

\item Changing a finite number of terms in a series does not change whether or not it converges,
\item  If $\lim_{n \to \infty}a_n\neq 0$ or $\lim_{n \to \infty}a_n$ does not exist, then
$\sum_{n=1}^{\infty} a_n$ diverges. (\textbf{Remember this!})
\item If $\sum_{n=1}^{\infty} a_n$ diverges, then $\sum_{n=1}^{\infty} a_n$ diverges if $k\neq 0$.
\end{enumerate}
\end{thm}
\pagebreak
Moreover, there are several test to determine if a series is convergent, detailed discussion about those is in class.
\begin{enumerate}
\item \textbf{The Integral Test}\\
Suppose $a_n = f(n)$, where $f(x)$ is decreasing and positive.
\\a. If $\int_1^\infty f(x) dx$ converges, then $\sum_{n=1}^{\infty} a_n$ an converges.
\\b. If $\int_1^\infty f(x) dx$ diverges, then $\sum_{n=1}^{\infty} a_n$ an diverges.

\item \textbf{p-test}\\
The $p$-series $\sum_{n=1}^{\infty} 1/n^p$ converges if $p > 1$ and diverges if $p \leq 1$.

\item \textbf{Comparison Test}\\
Suppose $0 \leq a_n \leq b_n$ for all $n$ beyond a certain value.
\\ a. If $\sum_{n=1}^{\infty} b_n$ converges, then $\sum_{n=1}^{\infty} a_n$ converges.
\\ b. If $\sum_{n=1}^{\infty} a_n$ diverges, then $\sum_{n=1}^{\infty} b_n$ diverges.

\item \textbf{Limit Comparison Test}\\
Suppose $a_n > 0$ and $b_n > 0$ for all $n$. If
$\lim_{n\to \infty}a_n/b_n= c$ where $c > 0$,
then the two series $\sum_{n=1}^{\infty} a_n$ and $\sum_{n=1}^{\infty} b_n$ either both converge or both diverge.

\item \textbf{Convergence of Absolute Values Implies Convergence}\\
If $\sum_{n=1}^{\infty}|a_n|$ converges, then so does $\sum_{n=1}^{\infty} a_n$.

\item \textbf{The Ratio Test}
For a series $\sum_{n=1}^{\infty} a_n$, suppose the sequence of ratios $|a_{n+1}|/|a_n|$ has a limit:
$\lim_{n\to \infty}|a_{n+1}|/|a_n| = L$, then
\begin{itemize}
\item If $L < 1$, then $\sum_{n=1}^{\infty} a_n$ converges.
\item If $L > 1$, or if $L$ is infinite, then $\sum_{n=1}^{\infty} a_n$ diverges.
\item If $L = 1$, the test does not tell us anything about the convergence of $\sum_{n=1}^{\infty} a_n$ (\textbf{Important!}).
\end{itemize}

\item \textbf{Alternating Series Test}
A series of the form $\sum_{n=1}^{\infty} (-1)^{n-1}a_n = a_1 - a_2 + a_3 - a_4 + \ldots + (-1)^{n-1}a_n + \ldots$
converges if
$0 < a_{n+1} < a_n$ for all $n$ and $lim_{n \to \infty}a_n = 0$.

Error of alternating test: Moreover,  let $S = \lim_{n\to \infty}S_n$, then we will have $|S - S_n| < a_{n+1}$.
\end{enumerate}

Notably, We say that the series $\sum_{n=1}^{\infty} a_n$ is
\begin{itemize}
\item absolutely convergent if $\sum_{n=1}^{\infty} a_n$ and $\sum_{n=1}^{\infty}|a_n|$ both converge.
\item conditionally convergent if $\sum_{n=1}^{\infty} a_n$ converges but $\sum_{n=1}^{\infty}|a_n|$ diverges.
\end{itemize}
\includegraphics[width=1\textwidth]{program2.png}

Test we consider for proving convergence:
\begin{enumerate}
	\item The integral test
	\item p-test
	\item Comparison test
	\item Limit comparison test
	\item Check the absolute convergence of the series
	\item Ratio Test
	\item Alternating Series Test
\end{enumerate}

Test we consider for proving divergence:
\begin{enumerate}
	\item The integral test
	\item p-test
	\item Comparison test
	\item Limit comparison test
	\item Ratio Test
	\item Check $\lim_{n \to \infty} \neq 0$ or $\lim_{n \to \infty}$ does not exist.
\end{enumerate}

\includegraphics[width=1\textwidth]{program.png}

\subsection{Geometric Series}
There is a special series that we learn about, which is the Geometric Series, notice that the formula on the right hand side is what we called closed form.
A finite geometric series has the form
\[a + ax + ax^2 + \cdots + ax^{n−2} + ax^{n−1}=\frac{a(1-x^n)}{1-x}\text{ For } x \neq 1\]
An infinite geometric series has the form
\[a + ax + ax^2 + \cdots + ax^{n−2} + ax^{n−1}+ax^n +\cdots=\frac{a}{1-x}\text{ For } |x| < 1\]

\newpage

\subsection{Power Series}
\begin{definition}
	A power series about $x = a$ is a sum of constants times powers of $(x - a)$: \\
	$C_0 + C_1(x - a) + C_2(x - a)^2 + \ldots + C_n(x - a)^n + \ldots =	\sum_{n
	=0}^{\infty}	C_n(x - a)^n$.
\end{definition}

If we fix a specific value of $x$, we can just consider plugging x with the value we have, and convergence here makes sense.

\begin{definition}
For a fixed value of $x$, if this sequence of partial sums converges to a limit $L$, that is, if
$\lim_{n \to \infty}S_n(x) = L$, then we say that the power series converges to $L$ for this value of $x$.
\end{definition}

Based on the discussion we will see that, The interval of convergence for a power series is usually centered at a point $x=a$, and extends the same length to both side, thus we denote this length as radius of convergence.\\

Moreover, each power series falls into one of the three following cases, characterized by its radius of convergence, $R$.
\begin{itemize}
\item The series converges only for $x = a$; the radius of convergence is defined to be $R = 0$.
\item The series converges for all values of $x$; the radius of convergence is defined to be
$R = \infty$.
\item There is a positive number $R$, called the radius of convergence, such that the series
converges for $|x - a| < R$ and diverges for $|x - a| > R$.
\end{itemize}
The interval of convergence is the interval between $a - R$ and $a + R$, including any
endpoint where the series converges.

\end{document}


% Created 2020-02-20 jue 12:47
\documentclass[a4paper]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{marvosym}
\usepackage{wasysym}
\usepackage{amssymb}
\usepackage{hyperref}
\tolerance=1000
\usepackage{khpreamble}
\usepackage{pgfplots}
\usepackage{pdfpages}
\usepackage{circuitikz}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{positioning}
\renewcommand*{\not}[1]{\ensuremath{\bar{#1}}}
\renewcommand*{\not}[1]{\ensuremath{\overline{#1}}}
\author{Kjartan Halvorsen}
\date{2020-02-19}
\title{Capacitors, RC-circuit, first-order response}
\hypersetup{
  pdfkeywords={},
  pdfsubject={},
  pdfcreator={Emacs 25.3.50.2 (Org mode 8.2.10)}}
\begin{document}

\maketitle

\section{Repetition}
\label{sec-1}
\subsection{Transforming signals}
\label{sec-1-1}
We looked last week at circuits like the one below
\begin{center}
\includegraphics[width=0.4\linewidth]{../../figures/voltage-divider-circuit}
\end{center}
and we were interested in the voltage across the second resistor. A simple circuit like this may be interesting the first time you see it and measure the current and voltages, but will quickly look at bit dull. But redrawing the circuit slightly, and you may see that this is actually a very useful simple circuit for transforming signals:
\begin{center}
\includegraphics[width=0.4\linewidth]{../../figures/voltage-divider-input-output}
\end{center}
We can think of the input voltage $u(t)$ as an \textbf{input signal} to the circuit, and the signal $u_2(t)$ as the \textbf{output signal}. We learned from last week that
\[ u_2(t) = \frac{R_2}{R_1+R_2}u(t),\]
so the circuit can be seen as a static gain less than 1
   \begin{center}
  \begin{tikzpicture}[node distance=22mm, block/.style={rectangle, draw, minimum width=15mm}, sumnode/.style={circle, draw, inner sep=2pt}]

    \node[coordinate] (input) {};
    \node[block, right of=input, node distance=20mm] (plant)  {$\frac{R_2}{R_1+R_2}$};
    \node[coordinate, right of=plant, node distance=20mm] (output) {};

    \draw[->] (input) -- node[above, pos=0.3] {$u(t)$} (plant);
    \draw[->] (plant) -- node[above, near end] {$u_2(t)$} (output);
  \end{tikzpicture}
\end{center}
\subsubsection{Exercise}
\label{sec-1-1-1}
\begin{center}
\begin{tikzpicture}
  \begin{axis}[
    width=8cm,
    height=3cm,
    ylabel={$u(t)$, $u_2(t)$},
    xlabel={Time},
    ]
    \addplot coordinates {(0,0) (1, 0) (1,1) (2,1) (2,0) (3,0) (3,1) (4,1) (4,0) (5,0)};
  \end{axis}
\end{tikzpicture}
\end{center}
\textbf{Draw the
No you see that the simple voltage-divider can be very useful in an analog filter circuit. Just to mention this, to get a gain higher than 1 you cannot use a voltage divider of course. For this one uses a very useful circuit element called an *operational amplifier}. The use of these fall outside the scope of this course.

\subsection{Current and water flow analogy}
\label{sec-1-2}
We also talked last week about the water flow, or hydraulic analogy to electric circuits. This is useful, because we may use our intuition for how such a system works to understand the electric circuit.
With this analogy, the circuit is like a closed hydraulic system. Voltage is then equivalent to pressure, so the voltage source is a pump that provides an increase in the pressure. The ideal pump (voltage source) is able to produce this increase in pressure no-matter how much water is flowing through the pump (and circuit). The resistors are like pieces of tubing with significant resistance to flow (narrow tubes). Over such pieces of tubes there will be a drop in pressure.

When trying to understand what is going on in electrical circuits it can be very helpful to use theintuition we have about the flow of water. All of us have a much stronger intuition for things like water pressure and flows, than we have about voltage and current. This comes from the simple fact that we observe, perceive and interact with water every single day since we were born. But we hardly ever sense or perceive voltage and electrical current (when we do it can be rather painful and something we remember for along time, though).

   All the concepts of electricity and circuit elements we will see in this course have direct analogies in realm of fluids. Last week we worked with voltages, resistance and current. Voltage is the difference in electric potential between two points, and corresponds to the different in pressure between two bodies of water (high and low reservoirs, for instance). In fact, voltage is sometimes called \textbf{electric pressure}. Voltage is measured in Volt.
   Electric current is a flow of charged particles. Most often these particles are electrons that can move in a conducting metal. But it can also be charged ions in an electrolytic fluid. Current is measured in Amperes. Electrical charge is a fundamental property of materia, and is measured in the unit Coulomb (C). The size of one Coulomb is related to current A. One C is the amount of charge that flows through a conductor if the current is 1A.
A resistor is a resistance to electric current. It corresponds to a tube in a hydraulic ssystem.   There will be a pressure drop across a tube when water is flowing through it, and in the same way there is a drop in voltage across a resistor. Resistance is measured in Ohms. This units are related so that a circuit with a 1V voltage source and a 1 Ohm resistance will have a current of 1 A.

\begin{center}
\begin{tabular}{ll}
Electricity & Fluids\\
\hline
Current is flow of charged particles (electrons) & Current is flow of molecules\\
Voltage a potential difference that can move electrons & Fluids at  heights (pressure)\\
Current flows from high potential to low & Flow from higher to lower height\\
(although the electrons flow from low to high pot) & \\
A resistor connecting two potentials gives restricted flow & Tube connecting two reservoirs\\
Current must flow in loops & Not so? (to ambient)\\
Electric potential means potential to do work (run motor) & Same\\
Capacitor & Membrane in tube\\
Charge stored in capacitor & Volume of displaced membrane\\
Voltage across capacitor & Force (pressure) of membrane\\
 & In equilbrium the difference in\\
 & pressure at both sides\\
Capacitans charge/voltage & Compliance of membrane\\
\end{tabular}
\end{center}

\subsection{Testing the intuition}
\label{sec-1-3}
Consider braking the voltage divider circuit at A. What is the voltage at the two different open ends?

\section{Capacitors}
\label{sec-2}
\subsection{Working principle of capacitors}
\label{sec-2-1}
\begin{itemize}
\item Two plates (metal sheets) with non-conducting medium between.
\item Charge is accumulated on either side
\item Characterized by the potential difference (voltage across) for a given amount of charge Q.
\begin{itemize}
\item C = charge/voltage <=> C*voltage = charge <=> voltage = charge/C
\item Note that current is flow of charge, so dQ/dt = i, or Q = Q(0) + $\int$$_{\text{0}}^{\text{t}}$ i(s) ds
\item C*voltage = Q(0) + $\int$$_{\text{0}}^{\text{t}}$ i(s)ds
\end{itemize}
\end{itemize}

A capacitor is a device that stores electrical potential energy. Recall from what you know about energy: Energy existst primarily in two forms: Potential and kinetic. Potential energy has to do with position, and kinetic with movement. Think of a hydro power plant. Potential energy exists in the form of a body of water in a reservoir at an height above the turbine. The water is led in large tubes down to the turbine. When the water hits the turbine blades, they hit it at high velocity. This means that the potential energy of water at a height has been transformed into kinetic energy in the form of moving water molecules.
Continuing with the hydro-power plant analogy: Can you think of some way that kinetic energy is stored in the system?
The water molecules hit the turbine blades at high speed, and then they flow slowly out of the power plant. They make the turbine spin, so their kinetic energy is transferred to energy in the spinning turbine, where it can be expresss as E$_{\text{k}}$ = 1/2 J\dot{\theta}$^{\text{2}}$, where J is the moment of inertia of the turbine, and \dot{\theta} is the angular velocity. In steady-state the turbine rotates with a velocity corresponding to the velocity of the water. And importantly, it will oppose a change in the velocity of the water, since it cannot change velocity instantly. In fact, it follows Newton's second law J d/dt (\dot{\theta}) = $\sum$ torques.
In electricity their exists a circuit element which has similar characteristics. It is called an \textbf{inductor}, and consists basically of a coil of wire. More on this next week.

Back to capacitors. We are all very familiar with devices that store electrical, potential, energy. We call them batteries. A capacitor is in fact like a battery, but it is typically charged and discharged much faster. A capactior is characterized by the amount of charge that is accumulated in it for each voltage difference over it (between its two legs or terminals). This value is called the \textbf{capacitans}
\[ C = \frac{\text{charge}}{\text{voltage}}. \]

Electrical energy conists in the form of
\subsection{Electrolytic capacitors}
\label{sec-2-2}
\begin{itemize}
\item Polarity. Careful!
\item Because of how they are produced cannot take potential in wrong direction (break down).
\item Think of a membrane that is strong in one direction but breaks easily in the other
\item Symbol
\end{itemize}

\section{Impedance}
\label{sec-3}

\subsection{Ohm's law (\(u=Ri\)) is static}
\label{sec-3-1}

\subsection{Capacitor equation}
\label{sec-3-2}
\[ Cu(t) = Q(0) + \int_0^t i(s) ds, \qquad \text{differentiate}\]
\[ C \dot{u}(t) = i(t) \quad \Leftrightarrow \quad \dot{u}(t) = \frac{1}{C} i(t). \]
Dynamic relationship between current and voltage! Apply Laplace trf
\[ sU(s) - u(0) = \frac{1}{C} I(s) \quad \Leftrightarrow \quad U(s) = \frac{u(0)}{s} + \frac{1}{sC} I(s). \]

\section{The RC circuit}
\label{sec-4}

\section{Simulate}
\label{sec-5}

\subsection{From "scratch"}
\label{sec-5-1}
   Start with integration:  d/dt u$_{\text{c}}$ = \frac{1}{C} i
                  volt
volt in -----> o -----
\section{Experiment}
\label{sec-6}
See instructions on Canvas
% Emacs 25.3.50.2 (Org mode 8.2.10)
\end{document}


\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{hyperref}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{subcaption}
\usepackage{amsmath, amsfonts}

\DeclareMathOperator{\Tr}{Tr}
\DeclareMathOperator{\diag}{\mathbf{diag}}
\DeclareMathOperator*{\argmin}{arg\,min}
\DeclareMathOperator*{\argmax}{arg\,max}

\newcommand{\E}{\mathbb{E}}
\newcommand{\bs}{\boldsymbol}

\newtheorem{theorem}{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newenvironment{proof}{{\bf Proof:}}{\hfill\rule{2mm}{2mm}}

\title{On Farka's Lemma}
\author{
	Ruilin Li  \\
	\href{mailto:ruilin.li@gatech.edu}{ruilin.li@gatech.edu} \\
	Georgia Institute of Technology
	}
\date{\today}

\begin{document}

\maketitle

\section{Farka's Lemma}
Farka's lemma (Farks's Alternative Theorem) is a useful tool and can be used to prove strong duality of linear programming and derive KKT condition with linear independence constraint qualification (LICQ).

\begin{lemma}[Farka's Lemma]
Given a vector $\bs{b} \in \mathbb{R}^m$  and $A \in \mathbb{R}^{m \times n}$, it must be one of the following two cases,
\begin{itemize}
	\item There exists a non-negative vector $\bs{x} \ge \bs{0}$ such that
		\[ A\bs{x} = \bs{b} \]
	\item There exists a non-negativevector $\bs{y} \ge \bs{0}$ such that
		\[ A^T\bs{y} \le \bs{0} \mbox{ and } \bs{b}^T\bs{y} > 0 \]
\end{itemize}
See figure \ref{fig:farka} for visual illustration.
\end{lemma}

\begin{figure}[h]
\begin{subfigure}{.5\linewidth}
\centering
\begin{tikzpicture}
	\draw [fill=orange, opacity=0.2] (0,0) -- (4,4) -- (5,0);
	\draw [dotted] (0,0) -- (4,4);
	\draw [dotted] (0,0) -- (5,0);
	\draw [->, thick, purple] (0,0) -- (3,3);
	\node [right, purple] at (3,3) {$\bs{a}_1$};
	\draw [->, thick, purple] (0,0) -- (4,0);
	\node [below, purple] at (4,0) {$\bs{a}_2$};
	\draw [->, thick, cyan] (0,0) -- (3.5,2);
	\node [right, cyan] at (3.5,2) {$\bs{b}$};
\end{tikzpicture}
\caption{$A\bs{y} = \bs{b}$}\label{fig:case1}
\end{subfigure}
~
\begin{subfigure}{.5\linewidth}
\centering
\begin{tikzpicture}
	\draw [fill=orange, opacity=0.2] (0,0) -- (4,4) -- (5,0);
	\draw [dotted] (0,0) -- (4,4);
	\draw [dotted] (0,0) -- (5,0);
	\draw [->, thick, purple] (0,0) -- (3,3);
	\node [right, purple] at (3,3) {$\bs{a}_1$};
	\draw [->, thick, purple] (0,0) -- (4,0);
	\node [below, purple] at (4,0) {$\bs{a}_2$};
	\draw [->, thick, cyan] (0,0) -- (1,3);
	\node [above, cyan] at (1,3) {$\bs{b}$};
	\draw [dotted] (1,3) -- (2,2);
	\draw [->, thick, cyan] (0,0) -- (2,2);
	\node [below right, cyan] at (2,2) {$\bs{b}^\star$};
\end{tikzpicture}
\caption{$A^T\bs{y} \le \bs{0} \mbox{ and } \bs{b}^T\bs{y} > 0$}\label{fig:case2}
\end{subfigure}
\caption{Visualization of Farka's Alternatives}\label{fig:farka}
\end{figure}

\begin{proof}
\begin{itemize}
	\item If there exists $\bs{x} \ge \bs{0}$ such that $A\bs{x}=\bs{b}$, then for any vector $\bs{y}$, we have
	\[ \bs{y}^T\bs{b} = \bs{y}^T A\bs{x}=(A^T \bs{y})^T\bs{x} \]
	and it is impossible to find $\bs{y} \ge \bs{0}$ to satisfy $A^T \bs{y} \ge \bs{0}$ and $\bs{b}^T\bs{y} < 0$ at the same time.
	\item If there does not exist $\bs{x} \ge \bs{0}$ such that $A\bs{x} =\bs{b}$, denote the cone of formed by column vectors of $A$ by $C(A)$,
	\[ C(A) = \{ \sum_{i=1}^m x_i \bs{a}_i| x_i \ge 0, i=1,2,\cdots, m\}\]
	Consider vector \[\bs{y} = \bs{b} - \bs{b}^\star\] where $\displaystyle \bs{b}^\star = \argmin_{\bs{x} \in C(A)} ||\bs{x} - \bs{b}||^2$.

	From the property of projection onto convex sets (POC), we have that for any vector $\bs{z} \in C(A)$,
	\[  \langle \bs{z} - \bs{b}^\star, \bs{b} - \bs{b}^\star \rangle \le 0, \quad \langle \bs{b} - \bs{b}^\star, \bs{b} - \bs{z}\rangle \ge 0\]
	and the second equality holds if and only if $\bs{b} =\bs{b}^\star$. By our assumption, $\bs{b} \notin C(A)$ so $\bs{b} \neq \bs{b}^\star$ hence $\langle \bs{b} - \bs{b}^\star, \bs{b} - \bs{z}\rangle > 0$. Let $\bs{z} =\bs{0}$, we immediate conclude that $\bs{b}^T\bs{y} > 0$.

	Next we would like to show $\langle \bs{z}, \bs{b} - \bs{b}^\star \rangle \le 0$ and it suffices to show $\langle \bs{b}^\star, \bs{b} - \bs{b}^\star\rangle =0$. This is due to the fact
	\[ f(\alpha) = ||\alpha \bs{b}^\star - \bs{b}||^2 \]
	is minimized when $\alpha = 1$ and
	\[f^\prime(1) = \langle \bs{b}^\star-\bs{b}, \bs{b}^\star \rangle = 0\]

	Therefore, we find a non-negative vector $\bs{y} \ge \bs{0}$ such that $A^T\bs{y} \ge \bs{0}$ and $\bs{y}^T\bs{b} > 0$.
\end{itemize}
\end{proof}

\end{document}


\documentclass{article}\usepackage[]{graphicx}\usepackage[]{color}
% maxwidth is the original width if it is less than linewidth
% otherwise use linewidth (to make sure the graphics do not exceed the margin)
\makeatletter
\def\maxwidth{ %
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother

\definecolor{fgcolor}{rgb}{0.345, 0.345, 0.345}
\newcommand{\hlnum}[1]{\textcolor[rgb]{0.686,0.059,0.569}{#1}}%
\newcommand{\hlstr}[1]{\textcolor[rgb]{0.192,0.494,0.8}{#1}}%
\newcommand{\hlcom}[1]{\textcolor[rgb]{0.678,0.584,0.686}{\textit{#1}}}%
\newcommand{\hlopt}[1]{\textcolor[rgb]{0,0,0}{#1}}%
\newcommand{\hlstd}[1]{\textcolor[rgb]{0.345,0.345,0.345}{#1}}%
\newcommand{\hlkwa}[1]{\textcolor[rgb]{0.161,0.373,0.58}{\textbf{#1}}}%
\newcommand{\hlkwb}[1]{\textcolor[rgb]{0.69,0.353,0.396}{#1}}%
\newcommand{\hlkwc}[1]{\textcolor[rgb]{0.333,0.667,0.333}{#1}}%
\newcommand{\hlkwd}[1]{\textcolor[rgb]{0.737,0.353,0.396}{\textbf{#1}}}%
\let\hlipl\hlkwb

\usepackage{framed}
\makeatletter
\newenvironment{kframe}{%
 \def\at@end@of@kframe{}%
 \ifinner\ifhmode%
  \def\at@end@of@kframe{\end{minipage}}%
  \begin{minipage}{\columnwidth}%
 \fi\fi%
 \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep
 \colorbox{shadecolor}{##1}\hskip-\fboxsep
     % There is no \\@totalrightmargin, so:
     \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
 \MakeFramed {\advance\hsize-\width
   \@totalleftmargin\z@ \linewidth\hsize
   \@setminipage}}%
 {\par\unskip\endMakeFramed%
 \at@end@of@kframe}
\makeatother

\definecolor{shadecolor}{rgb}{.97, .97, .97}
\definecolor{messagecolor}{rgb}{0, 0, 0}
\definecolor{warningcolor}{rgb}{1, 0, 1}
\definecolor{errorcolor}{rgb}{1, 0, 0}
\newenvironment{knitrout}{}{} % an empty environment to be redefined in TeX

\usepackage{alltt}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Preamble
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%
%%% Load packages
%%%

\usepackage{float}
\usepackage{mathtools}
\usepackage{geometry}
\geometry{legalpaper, margin=2in}
\usepackage{graphicx}

%%%
%%% Create new command to change color to blue
%%%

\newcommand{\blue}[1]{\textcolor{blue}{#1}}

%%%
%%% Set the graphics path to search for figures
%%%

\graphicspath{{../../Analysis/ResultsFigures/}}

%%%
%%% Title page
%%%

\title{Avian Species Richness in the United States}
\author{Your Name}
\date{Today's Date}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Begin document
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}

%%%
%%% Set global R options
%%%

\maketitle

%%%
%%% Introduction
%%%

\section{Introduction}
We want to know whether avian species richness (the number of birds per state) is correlated with the size of the state, the average annual temperature, or the mean annual precipitation.

%%%
%%% Methods
%%%

\section{Methods}
To examine the relationship between avian species richness and the covariates area, temperature, and precipitation, we used the following multiple linear regression model:

%%
%% General Model Statement
%%

\begin{align}
y_i&=\beta_0+\beta_1x_{i,1}+\beta_2x_{i,2}+\beta_3x_{i,3}+\epsilon_i, \notag \\
\epsilon_i &\sim \text{Normal}(0,\sigma^2), \notag
\end{align}

where $y_i$ represents the number of species for the $i=1,\ldots,n$ state, $x_{i,1}$ represents the area of the  $i^{th}$ state, $x_{i,2}$ represents the mean annual temperature of the $i^{th}$ state, and $x_{i,3}$ represents the mean annual precipitation of the $i^{th}$ state. To estimate model parameters, we used \texttt{R} statistical software. The \texttt{R} script is shown, below.

%%%
%%% Analysis in R
%%%

%%%
%%% Results
%%%

\section{Results}
\subsection{Parameter Estimates}
The estimated intercept of our model, $\beta_0$, was 184. Thus, the expected number of species for a state with area equal to zero, temperature equal to zero, and precipitation equal to zero was 184. The estimated regression parameter for area, $\beta_1$,  was 0.0000385. Thus, as area increased by one km$^2$, the expected number of speciesincresed by 0.0000385. The estimated regression parameter for temperature, $\beta_2$,  was 4.10. As temperature increased by one degree Farenheit, the expected number of species incresed by 4.10. The estimated regression parameter for precipitation, $\beta_3$,  was -2.45. As temperature increased by one degree Farenheit, the expected number of species decresed by 2.45.

%%
%% Fitted Model Statement
%%

Our fitted model is:
\begin{align}
y_i&=184+0.0000385x_{i,1}+410x_{i,2}-2.45x_{i,3}+\epsilon_i, \notag \\
\epsilon_i &\sim \text{Normal}(0,46^2), \notag
\end{align}

%%%
%%% Figures
%%%

\subsection{Figures}
To see the marginal relationship between $y_i$ and: $x_{i,1}$, $x_{i,2}$, and $x_{i,3}$, see Fig. 1

\begin{figure}
\begin{center}
\includegraphics[width=10cm]{Figure1.pdf}
\caption{Marginal plot of the relationship between response variable and predictor variables.}
\end{center}
\end{figure}

%%%
%%% Tables
%%%

\subsection{Tables}
To see the parameter estimates and associated standard errors see Table 1.

\begin{table}[H]
\centering
\caption{Parameter estimates and SE of parameters from our fitted model.}
\begin{tabular}[t]{ c c c }
\hline
Parameter & Estimate & SE \\
\hline
 $\beta_0$ & 184 & 43.6 \\
 $\beta_1$ & 0.0000385 & 0.0000289 \\
 $\beta_2$ & 410 & 0.889 \\
 $\beta_3$ & -2.45 & 0.552 \\
 $\sigma^2$ & 46 & - \\
 \hline
 \end{tabular}
\label{tab:estimates}
\end{table}

%%%
%%% Discussion
%%%

\section{Discussion}
After reconsidering, Alaska seems like an outlier. Re-fit the model by removing Alaska from the data (for an example of how to do this, see the commented code on line 34 of the "MainAnalysis.R" file. Update your manuscript accordingly.

\end{document}


\documentclass[../mit-general-chemistry.tex]{subfiles}
\begin{document}

\chapter{Periodic table}

\section{Photoelectron spectroscopy}

In X-ray photoelectron spectroscopy (PES) we revisit the photoelectric
effect. PES is a technique to measure the energy levels of the
orbitals of atoms.

If we hit an atom with a photon with enough incident energy, $E_i$,
we'll get a free electron with a kinetic energy $E_k = E_i -
\text{IE}$. This gives us the ionization energies (work functions) of
the atom (remember that $E_{\Psi} = -\text{IE}$ from earlier).

\begin{align*}
  \overbrace{E}^{\text{X-ray photon}} + \ce{Ne} &\rightarrow\ce{Ne+} + \overbrace{e^-}^{\text{+ kinetic energy}} \\
  1s^22s^22p^6 &\rightarrow 1s^22s^22p^5 + e^-\\
\end{align*}

In this case we say that it is one of the outermost electrons that are
ejected, but this is only because of the energy of the photon. Had we
put in enough energy, we could have ejected any of the electrons of
the atom. This would also have had an impact on the resulting kinetic
energy of the ejected electron which is the difference between the
energy of the photon and the ionization energy of that orbital.

We use X-rays for PES as they have higher frequency, and thus higher
energy, than UV-light, so as to make sure we eject all the electrons
of the atom we study.

As we know that the kinetic energy of the ejected electron is equal to
the difference between the incident energy of the photon and the
ionization/binding energy of the electron/orbital.

\begin{example}
  Suppose we hit some neon gas atom with a photon with $E_i =
  1254\si{\eV}$ and we detect an ejected electron with $E_k = 1232
  \si{\eV}$. What is the ionization energy of the orbital that
  electron came out of?

  It is an easy subtraction. We calculate
  \begin{equation*}
    \text{IE} = E_i - E_k = 1254 - 1232 = 22 \si{\eV}
  \end{equation*}
\end{example}

Continuing to hit the neon atom we get the energy levels for all the
orbitals of the atom.

\begin{center}
  \begin{tabular}{lll}
    \toprule
    shell ($n$)& IE (\si{\eV})& $E_k (\si{\eV})$ \\
    \midrule
    $2p$ & 22 & 1232 \\
    $2s$ & 48 & 1206 \\
    $1s$ & 780 & 384 \\
    \bottomrule
  \end{tabular}
\end{center}
\begin{marginfigure}
  \begin{center}
    \begin{tikzpicture}[
        font={\footnotesize}
      ]
      \begin{axis}[
          width=4cm,
          height=4cm,
          xmin=0,
          xmax=4,
          ymin=0,
          ymax=1000,
          axis lines = left,
          domain = 0:3,
          xlabel = orbitals,
          ylabel = IE (\si{\eV}),
          xtick = {1, 2, 3},
          xticklabels = {$2p$, $2s$, $1s$},
          %ytick = {0, 5000, 10000},
          yticklabels = \empty,
          clip = false,
        ]
        \addplot[color=red,mark=x] coordinates {
          (1, 22)
          (2, 48)
          (3, 780)
	};
      \end{axis}
    \end{tikzpicture}
  \end{center}
  \captionof{figure}{Energy levels of the atomic orbitals of neon. \label{fig:neo:IE}}
\end{marginfigure}

There is a significant difference between the energy levels of the
{\em valence electron} orbitals ($s2$ and $p2$) and the energy lavel
of the orbital of the {\em core electrons}.

The orbital energy levels in multi-electron atoms depend on the two
quantum numbers $n$ and $l$. That is why we assume that $p_x$, $p_z$
and $p_y$ all have the same energy level.

\begin{example}
  If a certain element was studied under x-ray PES displays an
  emission spectrum with five distinct kinetic energies, what are all
  of the possible elements that this could be?

  First, we know that this is an element that have five energy levels
  and corresponding orbitals. The first five orbitals are $1s, 2s, 2p,
  3s, 3p$ so the elements are in the first three periods of the
  periodic system.

  Second, ``our element'' is an element that have electrons in the
  $3p$-orbital. The elements that fits that description are
  \ce{Al, Si, P, S, Cl, Ar}. So that is our answer.

  Had we known the exact wavelengths of the emission lines or the
  incident and kinetic energies we would have been able to say exactly
  what element it is that emits those lines.
\end{example}

\section{Periodic trends of the periodic table}

The periodic table was compiled in 1869 by Dmitri Mendeleev. In 1869,
only 60-70\% of the elements we know today were discovered. In the
periodic table, elements were grouped by their properties that he saw
(e.g. Group 1: \ce{Li, Na, K}: soft, reactive metals; Group 18:
\ce{He, Ne, Ar}: inert gases, they do not react).

Today, we look at the electron configuration and see that \ce{Li, Na,
  K} have {\em one valence electron in a $s$ state} whereas \ce{He,
  Ne, Ar} have filled shells.

The lonely valence of the Group 1 elements is the explanation to why
they are so reactive: they are so willing to give up that electron.

\subsection{Ionization energy}

Ionization energy (IE) is the minimum energy required to remove an
electron form an atom.

It is assumed that we mean the {\em first ionization energy} unless
otherwise specified.

\begin{equation}
  \text{IE} = E_{nl}
\end{equation}

Consider the ionization of boron, \ce{{}_5B}.

\begin{align*}
  \ce{B}(1s^22s^22p^1) &\rightarrow \ce{B+}(1s^22s^2) + e^-
  & \deltaE = E_p - E_r = \text{IE} = -E_{2p}
\end{align*}

This was the first ionization energy, yaking an electron from the
atomic orbital of the highest energy level.

Lets consider the second ionization energy

\begin{align*}
  \ce{B+}(1s^22s^2) &\rightarrow \ce{B^2+}(1s^22s^1) + e^-
  & \deltaE = \text{IE}_2 = -E_{2s} ~\text{in}~\ce{B+}
\end{align*}

Now, consider the energy required to remove an electron from \ce{B}
compared to \ce{B+}.

\begin{align*}
  \ce{B+ &-> B^2+ + e_{2s}^- } & \deltaE = \text{IE}_2 = -E_{2s} ~\text{in}~\ce{B+}\\
  \ce{B &-> B+ + e_{2s}^- } & \deltaE = \text{IE}_{2s} = -E_{2s} ~\text{in}~\ce{B}\\
\end{align*}

These two ionization energies are not going to be of the same
size. The electron in the ion is less shielded from it's nucleus and
therefore feel a stronger attractive force and hence it is going to
require more force to remove the electron from the atom.

\subsubsection{Periodic trends in ionization energy}

As we go across a row, ionization energy increases. As we go across
a row $Z$ increases while $n$ remains the same. This increases \Zeff.

As we go down a column, or group, ionization energy decreases. As we go down a
column $Z$ increases but so does $n$. We need to consider three things
\begin{itemize}
\item $Z$ is increasing
\item the distance between the outermost electron and the nucleus is
  increasing
\item there are even more shielding from an increasing amount of other
  electrons
\end{itemize}

It turns out that the ionization energy decreases down a column or
down a group.

These trends are generally true but not one hundred percent. We can
see some deviation. Looking at the second period, we see ``glitches''
to the general trend between beryllium and boron as well as between
nitrogen and oxygen.

\begin{center}
  \begin{tikzpicture}[
      font={\footnotesize}
    ]
    \begin{axis}[
        full,
        title={Ionization energy for the second period},
        width=.9\textwidth,
        height=4cm,
        xmin=0,
        xmax=9,
        ymin=400,
        ymax=2100,
        axis lines = left,
        domain = 0:3,
        xlabel = elements,
        ylabel = IE (\si{\kilo\joule\per\mol}),
        xtick = {1, 2, 3, 4, 5, 6, 7, 8},
        xticklabels = {\ce{Li}, \ce{Be}, \ce{B}, \ce{C}, \ce{N}, \ce{O}, \ce{F}, \ce{Ne}},
        %ytick = {0, 5000, 10000},
        %yticklabels = \empty,
        clip = false,
      ]
      \addplot[color=red,mark=x] coordinates {
        (1, 520)
        (2, 900)
        (3, 800)
        (4, 1090)
        (5, 1400)
        (6, 1310)
        (7, 1680)
        (8, 2080)
      };
    \end{axis}
  \end{tikzpicture}
\end{center}

The ``glitch'' between nitrogen and oxygen show us that
\begin{equation*}
  \text{IE}_{\ce{B}} < \text{IE}_{\ce{Be}}
\end{equation*}

We also show the electron configuration of the two elements.

\begin{center}
  \begin{MOdiagram}[names,labels,labels-fs=\footnotesize]
    \atom[Be]{left}{
      1s = {0.5; pair},
      2s = {2; pair},
      2p = {3; },
    }
    \atom[B]{right}{
      1s = {0.5; pair},
      2s = {2; pair},
      2p = {3; up},
    }
    \EnergyAxis[title=$E$]
  \end{MOdiagram}
\end{center}

Looking at the electron configurations for beryllium and boron below,
we can see that the outermost electron of boron is that lonely
$2p$-orbital electron n entire energy level away which outweighs the
extra proton on the nucleus. That is on the next energy level which makes it
that easier to remove than one of the more negative $2s$-electrons.

Looking at nitrogen and oxygen in the chart above we see that
\begin{equation*}
  \text{IE}_{\ce{O}} < \text{IE}_{\ce{N}}
\end{equation*}
which also deviates from our general trend.

Looking at these energy level diagrams, we see that from nitrogen to
oxygen we start double up in the $2p$-subshells. This causes some
electron repulsion between the $2p_x$-electrons of oxygen and this is
the explanation of the trend glitch.

\begin{center}
  \begin{MOdiagram}[names,labels,labels-fs=\footnotesize]
    \atom[N]{left}{
      1s = {0.5; pair},
      2s = {1.5; pair},
      2p = {3; up, up, up},
    }
    \atom[O]{right}{
      1s = {0.5; pair},
      2s = {1.5; pair},
      2p = {3; pair, up, up},
    }
    \EnergyAxis[title=$E$]
  \end{MOdiagram}
\end{center}

Both of these phenomenon reoccurs in other periods as well.

\subsection{Electron affinity}

Electron affinity, \Eea, is the ability of an atom, or ion, to gain an
electron.

\ceeqstar{X + e^- -> X-}

Looking on this reaction with chlorine
\begin{align*}
  \ce{Cl + e^- &-> Cl-} & \deltaE = -349~\si{\kilo\joule\per\mol}
\end{align*}
we see that energy is released which means that \ce{Cl-} is actually
lower in energy than chlorine and this means that the ion is more
stable than the neutral atom is.

We measure electron affinity as
\begin{equation*}
  \Eea = - \deltaE\quad\text{from the reaction}
\end{equation*}

\Eea = \SI{349}{\kilo\joule\per\mol} is a very large electron affinity
and this tells us that chlorine very easily gains an electron to form
\ce{Cl-}. Chlorine actually has one one of the largest electron
affinities.

Electron affinity can be either positive or negative (unlike
ionization energy which can only be positive).

We look at a reaction where the electron affinity is negative:
\begin{align*}
  \ce{N + e^- &-> N-} &\deltaE = +7~\si{\kilo\joule\per\mol} \\
  &&\Eea = -7~\si{\kilo\joule\per\mol} \\
\end{align*}

We see that $\Eea < 0$ and this means we need to put that amount of
energy into the reaction to make it happen, this is not a favorable
reaction. Thos means that nitrogen has low electron affinity, it will
not easily gain an electron. This also tells us that the \ce{N-}-ion
is less stable than the neutral atom.

\subsubsection{Trends in electron affinity}

We see a similar trend in electron affinity as we did in ionization
energy. Electron affinity increases as we go along a row (period) in
the periodic system.

Electron affinity decreases as we go down a column (group) in the
periodic system. The noble gases have a negative electron affinity
which makes sense since they have full outer shells and are considered
inert. Halogens have the highest electron affinity.

\subsection{Electronegativity}

Electronegativity ($\chi$) is the ability of an atom to attract an electron
density from another atom.

It turns at that
\begin{equation*}
  \chi \propto \frac{1}{2}(\Eea + \text{IE})
\end{equation*}

\subsubsection{Trends in the periodic system}

Since $\chi \propto \frac{1}{2}(\Eea + \text{IE})$, if we take the
periodic system and divide it up in quadrants. In the upper, right
quadrant we have high electron affinity and high ionization energy so
we will also have high electronegativity.

In the lower, left corner we have the opposite conditions and
therefore also a low electronegativity.

Elements with a high electronegativity are electron
acceptors. Elements with a low electronegativity are electron donors.

The common measurment of electronegativity is not the one above but
the Pauling numbers. They do however share the same trends as the
definition above.

\subsection{Atomic radius}

When we talk about atomic radius we essentially talk about atomic
size. One way to think of the atomic radius is a radius $r$ within
which 90\% of the electron density is contained.

Another way is to measure the distance between two adjacent nuclei of
the same element, $d$, and divide that with 2
\begin{equation*}
  r = \frac{1}{2}d
\end{equation*}

The two model of thinking do however come up with similar numbers for
atom size.

Atomic radius for the elements decrease as we go across a period as
\Zeff increases.

Atomic radius increases as we go down columns (groups) of the periodic
system since we are adding electrons further and further away from the
nucleus.

\section{Isoelectronic atoms and ions}

Isoelectronic atoms and ions are species with the same electron
configuration.

Consider neon with electron configuration $1s^22s^2p^6$ other atoms
can not have this configuration but ions can. Consider

\begin{equation*}
  \underbrace{\ce{N^3-} \ce{O^2-} \ce{F-}}_{\text{larger radius than neutral parent}}
  \ce{Ne}
  \underbrace{\ce{Na+} \ce{Mg^2+} \ce{Al^3+} \ce{S^4+}}_{\text{smaller atomic radius than neutral parent}}
\end{equation*}

The atomic radii of anions increases as the put on new electrons. The
atomic radii of cations decreases as they lose electrons but also as
remaining electrons fell a stronger \Zeff due to loss of shielding.

\addsec{Summary}
\end{document}


% A (minimal) template for problem sets and solutions using the exam document class

% Organization:
%% Define new commands, macros, etc. in macros.tex
%% Anything that you would put before \begin{document} should go in prelude.tex

%% For multiple psets, each should get its own file to \input into main with a \section{}
\input{prelude}
\begin{document}

\title{Partial Differential Equations\\TA Homework 10}
\author{Francisco Jose Castillo Carrasco}
\date{\today}
\maketitle

\input{macros}

%% Content goes here

\section*{Problem 5.3.5}
\input{problem1}
\section*{Problem 5.4.3}
\input{problem2}
\section*{Problem 5.4.4}
\input{problem3}
\section*{Problem 5.4.14}
\input{problem4}

\end{document}