\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage{amsmath}
\usepackage{hyperref}
\usepackage{amsthm}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{fancyhdr}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{multicol}
\theoremstyle{definition}
\newtheorem{exmp}{Example}[section]
\newtheorem{theorem}{Theorem}
\newtheorem{problem}{Problem}

\begin{document}
\author{ \textbf{Fractals}}
\title{\textbf{Basic Equation Solving}}
\maketitle
\tableofcontents
\noindent
\section{Basic Equation Solving}
\subsection{Algebraic Manipulation}
To introduce the topic of \textbf{algebraic manipulation},
let us start with a little known example: \textbf{egyptian fractions}

\begin{theorem}[\textbf{Egyptian Fractions}]
    For all \(a, b \) where \(ab \ne 1 \)
    \[
        \dfrac{a}{ab - 1 } = \dfrac{1}{b( ab - 1)} + \dfrac{1}{b}.
    \]
    From here, we can see that putting things together (factoring) is just as important as taking them
    apart (distributing). Now, let us turn the power of products:
\end{theorem}
\begin{exmp}
    For positive real numbers \(a, b \),
    \[
        a + \dfrac{1}{b} = 4,
    \]
    \[
        b + \dfrac{1}{a} = 5,
    \]
    Find \(ab + \dfrac{1}{ab} \). \\

    \noindent
    \(Solution\). It is very easy to get lost in the problem if we directly try to solve for a and b. Instead,
    let us multiply the equations:
    \[
        (a+\dfrac{1}{b})(b+\dfrac{1}{a}) = 4(5) = 20.
    \]
    \[
        ab + \dfrac{a}{a} + \dfrac{b}{b} + \dfrac{1}{ab} = ab + \dfrac{1}{ab} + 2 = 20,
    \]
    \begin{center}
        \framebox[1\width]{ \( ab + \dfrac{1}{ab} = 18\). }
    \end{center}
\end{exmp}
\begin{theorem}
    Let \(x, y \) be nonzero real numbers such that \(x + y = a\) and \(xy = b\) Then,
    \[
        x^2 + y^2 = a^2 -2b,
    \]
    \[
        (x+1)(y+1) = a + b + 1,
    \]
    \[
        x^2 + xy^2 = ab,
    \]
    \[
        | x - y | = \sqrt{a^2 - 4b},
    \]
    \[
        x^3 + y^3 = a^3 - 3ab,
    \]
    \[
        \dfrac{1}{x} + \dfrac{1}{y} = \dfrac{a}{b},
    \]
\end{theorem}
\subsection{Quadratic Equations}
A polynomial is an equation of the following form:
\[
    a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0 ,
\]
where
\[
    a_0, a_1, \dots, a_n
\]
are constants. A quadratic equation is a polynoimal with \(n = 2\):
\[
    ax^2 + bx + c = 0,
\]
A common way to solve a quadratic equation is to use the quadratic formula:
\begin{theorem}[\textbf{Quadratic Formula}]
    For the equation \(ax^2 + bx + c = 0\), the roots \(x_1, x_2 \) must be equal to
    \[
        x_1 = \dfrac{-b + \sqrt{b^2 - 4ac}}{2a},
    \]
    \[
        x_2 = \dfrac{-b - \sqrt{b^2 - 4ac}}{2a},
    \]
\end{theorem}
\begin{theorem}
    For the equation \(ax^2 + bx + c = 0\), we have the following cases:
    \begin{itemize}
        \item If \(b^2 - 4ac > 0\), we have \textbf{two real roots.}
        \item If \(b^2 - 4ac = 0\), we have \textbf{one real root.}
        \item If \(b^2 - 4ac < 0\), we have \textbf{no real roots.}
    \end{itemize}
    Using the Quadratic Formula, we can calculate the sum of roots and product of roots:
\end{theorem}
\begin{theorem}
    For the equation \(ax^2 + bx + c = 0\), the sum of roots is:
    \begin{displaymath}
        x_1 + x_2 = \dfrac{-b + \sqrt{b^2 - 4ac}}{2a} + \dfrac{-b + \sqrt{b^2 - 4ac}}{2a}
        = \dfrac{-2b}{2a} = - \dfrac{b}{a}
    \end{displaymath}
    \begin{displaymath}
        x_1x_2 = \dfrac{-b^2 + 4ac}{2a} \times \dfrac{-b^2 + 4ac}{2a} =
        \dfrac{-(-b)^2 - (b^2 - 4ac)}{4a^2} = \dfrac{c}{a}
    \end{displaymath}
\end{theorem}
\begin{theorem}
    For any polynoimal
    \[
        a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0 ,
    \]

    \textbf{The sum of roots is}: \( - \dfrac{\text{seconed coeffeicent}}{\text{first coeffeicent}}
    = - \dfrac{a_{n-1}}{a_n}\)
    and \textbf{the product of roots is:} \(\dfrac{\text{last coeffeicent}}{\text{first coeffeicent}}
    = \dfrac{a_0}{a_n} \) \\

    \noindent
    For those who are looking for a more advanced and more powerful theorem, we can generalize
    this formula:
\end{theorem}

\begin{theorem}[\textbf{Vieta’s Formulas}]
    for any polynoimal
    \[
        a_n x^n + a_{n-1} x^{n-1} + \cdots + a_1 x + a_0 ,
    \]
    let \(r_1, r_2, \dots r_n\) (an \(n\)-degree equation has n different roots).
    Vieta’s formulas state that
    \[
        a_n = a_n
    \]
    \[
        a_{n-1} = -a_n(r_1 + r_2 + \cdots + r_n)
    \]
    \[
        a_{n-2} = a_n(r_1r_2+r_1r_3+\cdots + r_{n-1}r_n)
    \]
    \[
        \vdots
    \]
    \[
        a_0 = (-1)^n a_n(r_1r_2\cdots r_n)
    \]
\end{theorem}

\section{Problems}

\begin{problem}
Let \(x\) be a real number such that \(x+\dfrac{1}{x} = \sqrt{2020}\).
What is \(x^2 + \dfrac{1}{x^2}\)?
\end{problem}

\begin{problem}
Two non-zero real numbers, a and b, satisfy \(ab = a - b\).
Which of the following is a possible value of \(\dfrac{a}{b}
+ \dfrac{b}{a} -ab \)?
\end{problem}

\begin{problem}
Let \(x, y\) be nonnegative real numbers such that \(x + y = 5\) and \(xy = 7\). Find
\(\dfrac{x}{y-1} +\dfrac{y}{p-1}\)
\end{problem}

\begin{problem}
Let \(a, b\) are real numbers such that
\[
    \dfrac{1}{a(b+1)} + \dfrac{1}{b(a+1)} = \dfrac{1}{(a+1)(b+1)}.
\]
\end{problem}

\begin{problem}
Find the sum of roots to the equation \(x^{2020} = 2020x^{2019} + 1\)
\end{problem}

\begin{problem}
Find the product of the roots of the equation \(x^3 = 9\pi x + x^2 + 1. \)
\end{problem}

\begin{problem}
What is the average value of the three roots of the equation \(x^3 -12x^2 - 4x + 48 = 0\)?
\end{problem}

\end{document}


\section{Introduction}
\label{sec:introduction}

  The multigroup neutron diffusion equation has proven to be a useful tool for
  modeling the neutron distribution in a typical nuclear reactor. With the
  development of the \gls{nem}, the model was made more accurate and
  computational time was significantly decreased. The typical quantity of
  interest in these reactor simulations is the fundamental mode of the
  eigenvalue problem; that is, the largest eigenvalue and associated eigenvector
  which represent the effective neutron multiplication factor and scalar neutron
  flux distribution respectively.

  Traditionally, the multigroup neutron diffusion equation and \gls{nem}
  equations have been solved using the \gls{pi} method. The \gls{pi} method is a
  fixed-point method useful for solving eigenvalue problems. It is a linear
  iteration method and converges to the fundamental eigenmode at a linear rate.
  Recently, the use of \gls{jfnk} methods has been investigated in an attempt to
  reduce the computing time required to solve the \gls{nem} equations.
  \gls{jfnk} methods are attractive because when the iteration terminates, the
  method converges $q$-quadratically. However, \gls{jfnk} methods require the
  computation of quantities not required by the \gls{pi} method including the
  finite difference Jacobian-vector product. Due to the challenges of computing
  these quantities, the implementation of \gls{jfnk} methods for computing the
  fundamental mode to the multigroup neutron diffusion equation and \gls{nem}
  equations remains an active area of research.

  In \citetitle{qe2paper}, \citeauthor{qe2paper} explore an implementation of
  the \gls{jfnk} method that seeks to efficiently solve the \gls{nem} equations
  for the fundamental eigenmode. \sref{sec:summary} briefly summarizes this work
  and a few considerations for solving the \gls{nem} equations using the
  \gls{jfnk} method are provided. Then, \sref{sec:critique} critiques the
  authors' implementation with a focus on the applicability of the proposed
  method to realistic nuclear reactor simulations. Finally,
  \sref{sec:conclusion} provides a few conclusions based on the work by
  \citeauthor{qe2paper} and some considerations for future implementations of
  the \gls{jfnk} method to solve the \gls{nem} equations in nuclear reactor
  simulations.


%===================================Used packages======================%
%----------------------------------------------------------------------%
\documentclass[12pt]{report}
\usepackage{sagetex}
\pagenumbering{gobble}
\oddsidemargin=0pt

%----------------------------------------------------------------------%
%=======================Title page=====================================%
%----------------------------------------------------------------------%
\title{Dynamic of Structure: Mode and Time Period}
\author{Amarjeet Singh }
\begin{document}
\setcounter{chapter}{1}
\thispagestyle{plain}
	\begin{titlepage}
\maketitle
	\end{titlepage}

\begin{sagesilent}
	load('main.sage.py')

\end{sagesilent}

Number Of Storeys
\begin{equation}
	N = \sage{Number_of_storeys}
\end{equation}

\begin{sagesilent}
latex.matrix_delimiters("\{","\}")
\end{sagesilent}

Mass
\begin{equation}
	 [M]=\sage{mass}
\end{equation}

Time Period
\begin{equation}
	[T]=\sage{Time_period}
\end{equation}

Omega Square
\begin{equation}
	[\omega^2] =\sage{Omega_square.transpose()}
\end{equation}

Frequency
\begin{equation}
	[\omega]=\sage{Omega}
\end{equation}

\newpage
\begin{figure}
	\sageplot[scale=0.75]{Graph}
	\caption{Mass Model}
\end{figure}

\begin{equation}Number of modes considered=\sage{Modes_considered}
\end{equation}
\newpage

Level Floor
\begin{equation}
	[L]=\sage{Level_floor}
\end{equation}

Modal Participation Factor
\begin{equation}
	 [p]=\sage{Modal_participation_factor}
\end{equation}

Modal Mass
\begin{equation}
	 [M_{{m}}]=\sage{Modal_mass}
\end{equation}

Modal Contribution
\begin{equation}
	[M_{{c}}]=\sage{Modal_contribution}
\end{equation}

Sa By G
\begin{equation}
	 [S_{{a}}]=\sage{Sa_by_g}
\end{equation}

A H
\begin{equation}
	[A_{{H}}]=\sage{A_h[:,1]}
\end{equation}

\begin{sagesilent}
latex.matrix_delimiters("[","]")

\end{sagesilent}
Design Lateral Force
\begin{equation}
	[F]=\sage{Design_lateral_force}
\end{equation}

Peak Shear Force
\begin{equation}
	[V]=\sage{Peak_shear_force}
\end{equation}

\begin{sagesilent}
latex.matrix_delimiters("\{","\}")
\end{sagesilent}

\section{Storey Shear Force}
ABS-:
\begin{equation}
	\sage{storey_shear_force3}
\end{equation}
SRSS -:
\begin{equation}
	\sage{Storey_shear_force2}
\end{equation}
Complete Quadratic combination -:
\begin{equation}
	\sage{Lateral_force}
\end{equation}
Maximum Absolute Response -:
\begin{equation}
	\sage{Force}
\end{equation}
\end{document}


%! Author = tstreule

\section{Action Potential \& Hodgkin-Huxley Model}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{minipage}[t]{.5\columnwidth-.5\columnsep}
    \subsection{Current Clamp}
    %
    \textbf{Fix current} $I_m$ and\\
    measure membrane potential
    \begin{itemize}
        \item[$\to\!\!$] Good for observing AP\\
        (since voltage can change)
    \end{itemize}
\end{minipage}%
\hspace{\columnsep}%
\begin{minipage}[t]{.5\columnwidth-.5\columnsep}
    \subsection{Voltage Clamp}
    %
    \textbf{Fix voltage} $V_m$ and\\
    measure the current
    \begin{itemize}
        \item[$\to\!\!$] Good for studying membrane channel proteins (ion transp.)
    \end{itemize}
\end{minipage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{2-state ion channel model}
%
\formula{two states}{\ce{close <=>[\alpha][\beta] open}}
\quad with gate charge $Q$
\formula{\#open states}{\deriv{n(t)}{t} = \alpha (\mathcal{N} - n(t)) - \beta n(t)}
\formbox{Prob. being open}{x(t) \simeq \frac{n(t)}{\mathcal{N}} = x_\infty\! + (x_0-x_\infty\!) \;\eu^{-t/\tau_x}}
\formbox{~}{x_\infty\! = \frac{\alpha}{\alpha+\beta}, \quad \tau_x = \frac{1}{\alpha+\beta}}

\begin{minipage}{\linewidth}
    \begin{minipage}{\linewidth}
        \formula{Boltzmann law}{\alpha = A\;\eu^{(E_c-E_B)/kT}}
        \formula{~}{\beta = A\;\eu^{(E_o-E_B)/kT}}
        \formula{~}{x_\infty\! = \frac{1}{1+\beta/\alpha} = \frac{1}{1+\eu^{-QV_m/kT}}}
        \formula{~}{\tau_x = \frac{1}{A\;\eu^{-\frac{1}{2}QV_B/kT}} \cdots}
        \formula{~}{\phantom{\tau_x =} \cdots \frac{1}{\eu^{\frac{1}{2}QV_m/kT} + \eu^{-\frac{1}{2}QV_m/kT}}}
    \end{minipage}
    \begin{minipage}{\linewidth}
        \vspace{-30mm}\hfill
        \includegraphics[width=.35\columnwidth]{AP_Boltzmann}
    \end{minipage}
\end{minipage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Circuit Model \textnormal{(Conductance) \hfill\small$V\ped{K} \simeq \unit[-75]{mV}, \quad V\ped{Na} \simeq \unit[+55]{mV}$}}
%
\formtex{~}{\scalebox{.9}{%
    \highlight{$J\ped{C} = C_m \deriv{V_m(t)}{t}$} \enskip \fbox{$J_m = C_m \deriv{V_m}{t} + G_m(V_m-V_m\ap{rest})$}}}
\formtex{~}{\scalebox{.9}{%
    \highlight{$J\ped{K} = G\ped{K}\;(V_m-V\ped{K})$} \scriptsize always $>0$, we don't fall below ($V_m>V\ped{K}$)}}
\formtex{~}{\scalebox{.9}{%
    \highlight{$J\ped{Na} = G\ped{Na}\;(V_m-V\ped{Na})$} \scriptsize $\begin{cases}>0 & \text{if } V_m-V\ped{Na}>0 \\ <0 & \text{otw.} \end{cases}$}}

\vspace{-18mm}%
\begin{minipage}{\linewidth}
    \includegraphics[width=.3\columnwidth]{AP_Conductance_Model}
\end{minipage}

\begin{minipage}{.25\columnwidth}
    \includegraphics[width=.8\columnwidth]{AP_Conductance}
\end{minipage}
\begin{minipage}{.75\columnwidth}
    \begin{itemize}
        \item slow onset; decays slow
        \item \ce{K+} inactivates \ce{Na+} channels
    \end{itemize}
    $\to$ \textbf{Refractoriness} {\scriptsize(kurzzeitige AP Resistenz)}\\
    \phantom{$\to$} (\ce{Na+} channels are still inactivate, $h\sim0$)
\end{minipage}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Multiple states gate}
%
\formtex{open $n_Q(V_m,t)$}{big/small $Q$ $\to$ fast/slow dynamics}

\formtex{Let's write}{%
    \fbox{$h$} $= n_{-Q}$ ``slow''\!, \;\;
    \fbox{$m$} $= n_{2Q}$ ``fast''\!, \;\;
    \fbox{$n$} $= n_Q$ %``normal''
}
\formtex{~}{The \textit{lower} $T$, the \textit{bigger} the diff. between them.}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Hodkin-Huxley \textnormal{(HH)} model}
%
Experimentally you may fit the \ce{K+} and \ce{Na+} current into
\formula{Conductance}{G\ped{K}(V_m,t) = \overline{G}\ped{K} \; n^4}
\formula{~}{{G\ped{Na}(V_m,t) = \overline{G}\ped{Na} \; m^3 h}}

\begin{minipage}{.35\columnwidth}
    \includegraphics[width=.9\columnwidth]{AP_Actionpotential}
\end{minipage}%
\hspace{\boxmargin}%
\begin{minipage}{.65\columnwidth}
    \textbf{Four regimes during AP}:
    \begin{enumerate}
        \item[II] \textit{De}polarization:
        \ce{Na+} gate opens $\to$ \ce{Na+} in
        \item[III] \textit{Re}polarization:
        \ce{K+} gate opens $\to$ \ce{K+} out
        \item[IV] \textit{Hyper}polarization:\\
        Active \ce{Na+-K+-ion} pump (\ce{Na+}$\leftrightarrow$ \ce{K+})
    \end{enumerate}
\end{minipage}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Decrement-free conduction}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Core -- Conductor Model}
%
\begin{minipage}{.3\columnwidth}
    \vspace{6mm}$V_m \big\downarrow$
    \begin{minipage}{.5\columnwidth}
        \vspace{-6mm}\includegraphics[width=\columnwidth]{AP_Core_Conductor_Model}
    \end{minipage}
\end{minipage}%
\hspace{1.5\boxmargin}%
\begin{minipage}{.6\columnwidth}
    $R_i = r_i \diff z$\quad $\leftarrow$ $\diff z$: per unit length\\
    $R_o = r_o \diff z$\\
    $I_m = k_m \diff z$\quad $\leftarrow$ may use HH-model
\end{minipage}%

\vspace{-3mm}
\formula{Core--Conductor eq.}{\pderiv[2]{V_m(z,t)}{z} = (r_o+r_i)K_m(z,t) - \overbrace{r_oK_e(z,t)}^{\overset{\textrm{if}}{=}\; 0 \;\to\; I_o = -I_i}}
\formula{\hfill wave eq.}{\phantom{\pderiv[2]{V_m(z,t)}{z}} = \frac{1}{v^2} \pderiv[2]{V_m(z,t)}{t} }
\enskip with $v = \frac{W}{\Delta t}$
\formbox{\hfill$\overset{K_e=0}{\implies}$}{v \simeq \frac{K_ma}{2\rho_i}}
\enskip for $r_i \gg r_o$
\enskip i.e. $v\propto\sqrt{a}$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Cable model \textnormal{-- Core--Conductor with HH-model inside}}
%
\formtex{Linearize \small(1st order)}{\small timescale for membrane voltage changes {$\tau_m {=} \frac{C_m}{G_m}$}}
\formtex{Cable equation}{Let $v_m = V_m + V_m\ap{rest}$}
~\qquad $v_m {+} \hspace{-1mm}\underbrace{\tau_m\pderiv{v_m}{t}\vspace{-1mm}}_{\vspace{-2mm} = 0 \text{ time indep.}}\hspace{-1mm} - \lambda_C^2 \pderiv[2]{v_m}{z} {=} r_o\lambda_C^2K_e$
\enskip \highlight{$\lambda_C {=} \frac{1}{\sqrt{g_m(r_o+r_i)}}$}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsubsection{Saltatory Conduction Hypothesis}
%
$\to$ explain discrete manner in steps

\formula{velocity $\sim$ axon}{\textrm{total delay} \sim N (\#\textrm{nodes}) \sim (\textrm{axon length})/L}
\formula{diameter $D$}{\ce{->[$L\sim D$]} \textrm{velocity} \sim \frac{\textrm{total delay}}{\textrm{axon length}} \sim D}

\begin{minipage}{\columnwidth/3}
    \includegraphics[width=.85\columnwidth]{AP_Saltatory}
\end{minipage}%
\begin{minipage}{\columnwidth/3}
    \centering
    \includegraphics[width=.8\columnwidth]{AP_Saltatory_2}
\end{minipage}%
\begin{minipage}{\columnwidth/3}
    \hfill
    \includegraphics[width=.75\columnwidth]{AP_Ranvier_Node}
\end{minipage}


\documentclass[../main.tex]{subfiles}

\begin{document}

This section covers selection and replacement techniques in the context of a crossover-based evolutionary algorithms. Their purpose is to introduce selection after reproduction in a way that checks whether or not crossover and mutation were able to produce a new solution candidate that outperforms its parents.

\begin{itemize}
    \item \textbf{OS:} A certain ratio of the next generation has to consist of children that can outperform their parents.
    \item \textbf{RAPGA:} new child solutions are added to the population as long as it is possible to generate unique and successful offspring from the gene pool of the last generation.
\end{itemize}

An upper limit for the selection pressure provides a good termination criterion.

\section{Offspring Selection (OS)}
\sectionmark{OS}

The progression of genetic search is the assured by means of successful offspring. The goal of OS is to create a sufficient number of children that surpass their parents' fitness.

\subsection{Success Ratio}
The success ration is defined as the relation between the next population members that need to be generated by successful mating, in relation to the total population.

\begin{equation}
    \text{SuccRation} \in [0,1]
\end{equation}

Having filled up the the claimed ratio, the rest of the generation is filled with randomly generated individuals that were also created by crossover but did not reach the criteria.

\subsection{Comparison Factor}
In oder to classify a child as \emph{better} than it's parent, the comparison factor is introduced. A comparison factor of 0 means that the child is considered better when it outperforms its weakest parent while it has to outperform its best parent for a comparison factor of 1.

\begin{equation}
    \text{CompFactor} \in [0,1]
\end{equation}

The comparison factor is scaled from 0 to 1 during the run of the algorithm. This causes a broader search at the beginning and a more directed search in the end.

\subsection{Actual Selection Pressure}
The actual selection pressure is the quotient of individuals that had to be considered until the success ration was reached, and the number of individuals in the population in the following way:

\begin{equation}
    \text{ActSelPress} = \frac{ | \text{POP}_{i+1} | + | \text{POOL} | }{ | \text{POP}_i | }
\end{equation}

An upper limit defines the maximum numbers of offspring considered. When this limit is sufficiently high, the model can be used for detecting premature convergence.

\textit{If it is no longer possible to find a sufficient number $(\text{SuccRatio} \dot | \text{POP} |)$ of offspring, outperforming their own parents even if $(\text{MaxSelPress} \dot | \text{POP} |)$ candidates have been generated, premature convergence has occurred.}

Higher success ratios cause higher selection pressure. This does not necessary cause premature convergence because the new selection step does not accepts clones. The latter are a major reason for premature convergence in regular GAs.

\section{Relevant Alleles Preserving GA (RAPGA)}
\sectionmark{RAPGA}

The goal of this enhanced algorithm variant is trying to bring out as much progress from the actual generation as possible and losing as little genetic diversity as possible at the same time. This is achieved by adjusting the population size. Potential offspring are accepted as members of the next generation $\Leftrightarrow $ they are able to outperform the fitness of their parents and they are new in the sense that their chromosome consists of a concrete allele alignment that is not represented yet in the  an individual of the current generation.

\subsection{Considerations}

The following practical aspects of the RAPGA need to be considered:

\begin{itemize}
    \item The algorithm should offer different parent selection mechanisms, even for different parents (male and female) or allow for it to be disabled completely (random).
    \item It is reasonable to have more than one crossover and mutation operator. This works even for operators only generating a good result sporadically, because only successful chromosomes are considered in the evolutionary progress.
    \item The population size requires a lower and upper bound. The upper limit is required to prevent snowballing in the first rounds. The lower limit is needed to have a sufficient amount of chromosomes present to outperform parents. Additionally, it can act as a detector for convergence.
    \item Checking genotipical identity prevents structurally identical individuals to be included in the next generation.
    \item The maximum effort per generation is the maximum number of newly generated chromosomes per generation, no matter whether they are accepted or not. This can be used to terminate generation rounds.
\end{itemize}

\end{document}


\documentclass[./Thesis.tex]{subfiles}
\begin{document}

\chapter*{Conclusion}
\addcontentsline{toc}{chapter}{Conclusion}
\chaptermark{Conclusion}
\markboth{Conclusion}{Conclusion}

This thesis described a selection of number theoretic concepts required for the
formalization and implementation of the AKS primality decision algorithm in the
\Agda{} proof assistant. We began with a high level overview of the AKS
algorithm. This overview outlined the necessary mathematical concepts that would
be required to implement AKS in a proof assistant. Since the \Agda{} proof
assistant does not have the mathematical lexicon of the average human number
theorist this list of theorems was quite large. As this is an undergraduate time
limited thesis, we choose to explicate a select few from this list. \\

In Chapter \ref{chap:exponentiation} we iteratively developed an exponentiation
algorithm that runs in logarithmic time relative to the exponent. This algorithm
can exponentiate any base as long as the base forms a commutative monoid under
its multiplication operation. Following this we proved that our exponentiation
algorithm was equal to the standard grade school method of computing
exponentials. This algorithm appears in the AKS algorithm multiple times and
importantly the type of the base changes in each location necessitating the
ability to exponentiate arbitrary commutative monoids. \\

Next in Chapter \ref{chap:termination} we investigated how \Agda{} is able to
ensure non-looping behavior, or in other words reject circular definitions. We
remarked on the strength of Agda's termination checker, the code that rejects
potentially looping programs. We discovered that \Agda{} can tell if a program
is soundly defined if it can infer a well-founded relation for its inputs. As
\Agda{} does not always succeed in this inference we then built machinery to
provide \Agda{} with our own well-founded relation. This allows us to express
complex recursive algorithms without the fear of non-termination. \\

Lastly, in Chapter \ref{chap:primality} we codified the correct representation of a
decision procedure in a proof relevant setting. As AKS is a decision procedure
getting this correct is paramount. We then developed a decision procedure for
the divisibility relation common in number theory. The ability to test if one
number divides another was immediately useful. As we ended the chapter with a
brute force primality decision procedure. This is a critical sub-component of the
AKS algorithm as AKS requires a list of ``small'' primes to test the input
against. \\

We were not able to develop every required component to prove the
correctness of AKS but we estimate at least 75\% of the required components are
completed. Some of the developed, but not described components are as follows; a
GCD function that works over an arbitrary Euclidean Domain, a polynomial
datatype that forms a Euclidean Domain, a modular ring datatype, and many more.
All of these formulations are available publicly in the github repo
\url{https://github.com/mckeankylej/thesis}. With more work we believe the
correctness of AKS can be fully formalized.

\end{document}


\chapter{Normal forms}\setcounter{ProbPart}{0}

\problempart
\label{pr.DNF}
Consider the following sentences:
	\begin{earg}
		\item $(A \eif \enot B)$
		\item $\enot (A \eiff B)$
		\item $(\enot A \eor \enot (A \eand B))$
		\item $(\enot (A \eif B ) \eand (A \eif C))$
		\item $(\enot (A \eor B) \eiff ((\enot C \eand \enot A) \eif \enot B))$
		\item $((\enot (A \eand \enot B) \eif C) \eand \enot (A \eand D))$
	\end{earg}
        For each sentence, find a tautologically equivalent sentence in DNF and one in CNF.

\stepcounter{chapter} % Functional completeness
\stepcounter{chapter} % Soundness


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[utf8, left=2.5cm, right=2.5cm, top=2.5cm, bottom=2.5cm]{geometry}
\usepackage[english]{babel}
\setlength{\parindent}{2em}
\setlength{\parskip}{1em}
\renewcommand{\baselinestretch}{1}
\usepackage{graphicx}
\usepackage{gensymb}
\usepackage{natbib}
\usepackage{amssymb}
\usepackage{xcolor}
\usepackage{wasysym}

\title{Tidal Evolution of the Earth-Moon System}
\author{Patricia Golaszewska}
\date{May $14^{th}$ 2021}
\begin{document}

\maketitle

\newpage

\begin{center}
    \section*{Introduction}
\end{center}

This project sets out to model the tidal evolution of the Earth-Moon system. The evolution of this system can be modelled using a set of ordinary differential equations:

\begin{equation}
   \frac{dL_{\oplus}}{dt} = T_{\odot}
\end{equation}

\begin{equation}
   \frac{dS_{\oplus}}{dt} = -T_{\odot} - T_{\leftmoon}
\end{equation}

\begin{equation}
   \frac{dL_{\leftmoon}}{dt} = T_{\leftmoon}
\end{equation}

The ultimate goal is to integrate these ODEs numerically using python. This allows us to model the tidal evolution of the Earth-Moon system; from initial impact to the present day. As discussed in the project outline, tidal forces have an effect on the tides. Our understanding of this phenomenon is a combination of the effects of the spin angular momentum of Earth, and the orbital angular momentum of the Sun and the moon. This then motivates the choice of the set of ODEs used in this project.

\begin{center}
    \section*{Methods}
\end{center}

We are first tasked with establishing various quantities which are used throughout the project. Due to the majority of quantities being provided in cgs units, this was the chosen unit system. Other values were converted in order to conform to this unit system.

Calculations could then be made by using the mathematical abilities of python. This allowed us to then calculate the values we'll need to feed into our integrator later on. Thus, we could calculate the numerical values of timescales associated with our three ODEs, their initial conditions, and their RHS.

Using the scipy.integrate package and the dopri5 integrator, we could then combine our initial conditions with our ODEs following the format discussed in CTA200H lectures. Because we need to integrate into the past, a negative set of time values was chosen, ranging from the present day (0) to billions of years in the past. According to the model, the moon formed roughly 1.5 billion years ago, however, there is scientific evidence that the moon is much older than that.

Using the result of this integration, we could then analyze the evolution of the moons formation. The giant impact hypothesis is generally regarded as the leading theory in the formation of our moon. Our model allows for us to integrate into the past when the Earth and the object that would become our moon collided. At this point, their separation distance was 0 and grew over time to its present value. Thus, indexing our arrays allows us to find the time which the model predicts that the moon formed. As time moved forward, the semimajor axis expanded, and that expansion is depicted visually in Figure 1.

\begin{figure}[htp]
    \centering
    \includegraphics[width=12cm]{Q6.pdf}
    \caption{Change in the semimajor axis of the moon over time.}
    \label{fig:Q6}
\end{figure}

If the moon formed at the Roche radius (at approximatley 9496 km), then the length of day would be approximately 4 hours long. As the system stabilized over time, the length of day became longer. This is depicted visually in Figure 2.

\begin{figure}[htp]
    \centering
    \includegraphics[width=12cm]{Q7.pdf}
    \caption{Change in the length of day on Earth over time.}
    \label{fig:Q7}
\end{figure}

Issues surrounding this model arise from the incorrect age we get for our system. I suspect that there may be issues with how our model predicts the evolution of this system, and possibly doesn't account for the conditions at impact.

Firstly, I do not believe that this model allows for the moon to go through the process of mass accretion. This process would change the dynamics of the system over time as the gravitational effects change.

Second, I believe that this model assumes that the Earth-Moon system has been tidally locked from impact. This is an extension of the point made above; the dynamics of this system age the Earth-Moon system based on the tidal evolution. However, if the moon spent a period of time in asynchronous rotation, this model doesn't capture this.

I believe that this model interprets the collision as formation, which isn't necessarily true. The moon would have began it's formation at some distance away (i.e possibly the Roche radius) versus at impact.

Additional inconsistencies may be caused by changes in the eccentricity and alignment of the moons orbit, as well as external gravitational influences. Stabilization and tidal-locking may also result in changes in the energy in this system, which could have influenced the evolution of our system.

These reasons are listed in the order of what I assume to be the most reasonable assumption. My primary concern is that the initial dynamics of the system differ than those observed today, and they are not accounted for in the scope of this project.

\end{document}


\documentclass[12pt]{article}
\usepackage[english]{babel}
\usepackage{graphicx, amsmath, mathtools, listings, color, caption, rotating, subfigure, fullpage, textcomp, enumerate, float, alltt, hyperref}

\lstset{
	language=R,
	keywordstyle=\bfseries\ttfamily\color[rgb]{0,0,1},
	identifierstyle=\ttfamily,
	commentstyle=\color[rgb]{0.133,0.545,0.133},
	stringstyle=\ttfamily\color[rgb]{0.627,0.126,0.941},
	showstringspaces=false,
	numberstyle=\tiny,
	numbers=left,
	stepnumber=1,
	numbersep=10pt,
	tabsize=2,
	breaklines=true,
	breakatwhitespace=false,
	aboveskip={1.5\baselineskip},
  columns=fixed,
  upquote=true,
  extendedchars=true,
}

\begin{document}
\begin{center}
\bf{A Primer on Calculating the Mann-Whitney Statistic}
\end{center}
Hello everyone,
The Mann-Whitney test is pretty useful. I told my discussion section it's one of the “bread-and-butter techniques” in nonparametric statistics, because if the data is actually normal, it's almost as efficient (i.e.: almost the same power) as the t-test (which relies on normality), and if the data isn't normal, it's often far more efficient. I wrote this walkthrough a few years ago to explain to a biostatistics class how to calculate the MW U-Statistic the way you discussed in lecture. I hope this helps some of you understand how to compute the statistic.

I will use the dataset from page 284 (example 7.10.2) of “Statistics for the Life Sciences”, Fourth Edition, by Samuels, Witmer, and Schaffner, and test the hypothesis that the distribution of population 1 is equal to population 2,
%%%%
against the alternative that between the two at $\alpha = 0.05$:
%%%%
\begin{table}[H] \center
\begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline
$X$ & 64 & 315 & 17 & 170 & 20 & 22 & 190 & \\ \hline
$Y$ & 13 & 14 & 15 & 6 & 29 & 16 & 18 & 22 \\ \hline
\end{tabular}
\end{table}

\section{Order the Data}
Order the data so that the smallest values are first and the largest values are last. This makes it easier to do the later steps. Reproduced below are the two, ordered, samples.
\begin{table}[H] \center
\begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline
$X$ & 17 & 20 & 22 & 64 & 170 & 190 & 315 & \\ \hline
$Y$ & 6 & 13 & 14 & 15 & 16 & 18 & 22 & 29 \\ \hline
\end{tabular}
\end{table}

\section{Count Number of X Smaller Than Y}
Starting with the first sample, $X$, count how many values in $Y$ are smaller than each value of $X$. For example, the first value of $X$ is 17. The $Y$ values 6, 13, 14, 15, and 16 are all smaller than 17, so the first number of observations in $Y$ smaller than the first observation of $X$ is 5. The second value of $X$ is 20, and in $Y$, values 6, 13, 14, 15, 16, and 18 are smaller. This means the number of observations smaller than the second observation is 6.

For the third number, 22, you'll notice there are ties with $Y$. Instead of giving the usual point value of 1 to a greater number, if you encounter a tie, add .5. Thus, the third observation of $X$ (22) is bigger than 6, 13, 14, 15, 16, 18, and ties with 22, for a score of 6.5. Repeat this process for all remaining values of $X$. You will get the following numbers of $X$'s greater than $Y$'s: 5, 6, 6.5, 8, 8, 8, 8. Note that the last four observations of $X$ (64, 170, 190, 315) are all greater than the largest number in $Y$, so the number of observations of $Y$ that are smaller than $X$ will be the same for the last four observations. The $K_1$ statistic is the sum of all those numbers. $5 + 6 + 6.5 + 8 + 8 + 8 + 8 = 49.5$.

Now, there's a nifty property that shows that if you repeated the procedure but with $X$ and $Y$ flipped, their sum would be the product of the two sample sizes. We will leverage this fact to avoid having to do this procedure again. If $U_{lower} + U_{upper} = nm$, then $U_{lower} = nm - U_{upper}$. So the lower statistic will be $(7 \cdot 8) - 49.5 = 6.5$.

\section{Look Up the Statistic in the Book}
The book is going to give you a range of probable lower and upper statistics for a few levels of significance. $X$ has 7 observations and $Y$ has 8, so $n=7$ and $m=8$ (if you confuse $n$ and $m$, it's okay, because it's symmetric--the table gives the same values as $n=8$ and $m=7$). The region to we need to hit is $(13,43)$. If our lower statistic is less than $13$ or our upper statistic is bigger than $43$, we would have evidence to reject our null hypothesis.

As a note, you only need to check either the upper \emph{or} the lower value, because once you know the sample sizes and just one of the statistics (lower or upper), you can calculate the other one.

Our statistic is 49.5. Since we said we would reject if the upper statistic was bigger than 46, we reject $H_0$, and conclude that there are differences in the distributions of $X$ and $Y$.
\section{How to do This in R}
Get the data into R. Then use the function \verb+wilcox.test+.
\begin{center}
\begin{lstlisting}
X = c(64, 315, 17, 170, 20, 22, 190)
Y = c(13, 14, 15, 6, 29, 16, 18, 22)
wilcox.test(X, Y)
\end{lstlisting}

\begin{alltt}
Wilcoxon rank sum test with continuity correction
data:  X and Y
W = 49.5, p-value = 0.015
alternative hypothesis: true location shift is not equal to 0

Warning message:
In wilcox.test.default(X, Y) : cannot compute exact p-value with ties
\end{alltt}
\end{center}
For more information about the Wilcoxon-Mann-Whitney function in R, check out the help page: \\\ \url{http://stat.ethz.ch/R-manual/R-patched/library/stats/html/wilcox.test.html}. \\
The page also gives you information about how to specify alternative hypotheses, and whether to use a normal approximation.
\end{document}

Primers and Walkthroughs/A Primer on Mann-Whitney.tex