\section{Conclusion}
In this report we presented a way to parallelize Myers' longest common subsequence algorithm and applied various optimizations. Our results showed that that our simple row-wise algorithm scales well to many processes. Our algorithms hold up against diffutils when run sequentially. Against our expectations, our dynamic priority algorithm does not scale well.

\mypar{Future work}
In our work on this algorithm we considered various ideas to increase performance or reduce memory consumption, which we unfortunately did not have the time to experiment with for our report.

As such, we currently do not read out the edit script due to the quadratic memory consumption that it requires with this algorithm. If our algorithm is adapted to use Myers' recursive approach for linear space refinement \cite{myers_anond_1986} (which calls the non-recursive algorithm), it could output the edit script with only a minor performance cost.

It is possible that using SIMD to calculate multiple cells in parallel would improve the performance further.

% Here you need to summarize what you did and why this is
% important. {\em Do not take the abstract} and put it in the past
% tense. Remember, now the reader has (hopefully) read the report, so it
% is a very different situation from the abstract. Try to highlight
% important results and say the things you really want to get across
% such as high-level statements (e.g., we believe that .... is the right
% approach to .... Even though we only considered x, the
% .... technique should be applicable ....) You can also formulate next
% steps if you want. Be brief. After the conclusions there are only the references.


\chapter*{Introduction and Review}
	\subimport*{\mybuildpath}{0-intro}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Review}\label{chap:Review}
	\subimport*{\mybuildpath}{1-review/1-1-0-algebra}
	\subimport*{\mybuildpath}{1-review/1-2-0-analytic-geometry}
	\subimport*{\mybuildpath}{1-review/1-3-0-trigonometry}
	\subimport*{\mybuildpath}{1-review/1-4-additional-exercises}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Functions}\label{chap:Functions}
	\subimport*{\mybuildpath}{2-functions/2-1-functions}
	\subimport*{\mybuildpath}{2-functions/2-2-FnArthmetic}
	\subimport*{\mybuildpath}{2-functions/2-3-Composite}
	\subimport*{\mybuildpath}{2-functions/2-4-GraphingFunctions}
	\subimport*{\mybuildpath}{2-functions/2-5-Transformations}
	\subimport*{\mybuildpath}{2-functions/2-6-Linear-Quad-Functions}
	\subimport*{\mybuildpath}{2-functions/2-3-exp-functions}
	\subimport*{\mybuildpath}{2-functions/2-4-inverse-functions}
	\subimport*{\mybuildpath}{2-functions/2-5-logarithms}
	\subimport*{\mybuildpath}{2-functions/2-6-inverse-trig}
	\subimport*{\mybuildpath}{2-functions/2-7-hyperbolic-functions}
	\subimport*{\mybuildpath}{2-functions/2-8-additional-exercises}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\addtocontents{toc}{\protect\newpage}	% starts new page in TOC before listing this chapter	% used in printed version of the text
\chapter{Limits}\label{chap:Limits}
    \subimport*{\mybuildpath}{3-limits/3-1-limits-Tangent-Problem}
	\subimport*{\mybuildpath}{3-limits/3-1-limits-working-definition}
	\subimport*{\mybuildpath}{3-limits/3-2-limits-formal}
	\subimport*{\mybuildpath}{3-limits/3-3-limits-graphically}
	\subimport*{\mybuildpath}{3-limits/3-4-limits-props}
	\subimport*{\mybuildpath}{3-limits/3-6-trig-limit}
	\subimport*{\mybuildpath}{3-limits/3-7-continuity}
	\subimport*{\mybuildpath}{3-limits/3-5-0-inf-limits}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Derivatives}\label{chap:Derivatives}
	\subimport*{\mybuildpath}{4-derivatives/4-1-limits-slope}
	\subimport*{\mybuildpath}{4-derivatives/4-2-limits-velocity}
	\subimport*{\mybuildpath}{4-derivatives/4-3-0-der-function}
	\subimport*{\mybuildpath}{4-derivatives/4-4-der-rules}
	\subimport*{\mybuildpath}{4-derivatives/4-5-der-rules-trig}
	\subimport*{\mybuildpath}{4-derivatives/4-6-chain-rule}
	\subimport*{\mybuildpath}{4-derivatives/4-7-der-exp-log}
	\subimport*{\mybuildpath}{4-derivatives/4-8-imp-diff}
	\subimport*{\mybuildpath}{4-derivatives/4-9-0-inv-der}
	\subimport*{\mybuildpath}{4-derivatives/4-10-der-hyp-fns.tex}
	\subimport*{\mybuildpath}{4-derivatives/4-10-additional-exercises}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Applications of Derivatives}\label{chap:ApplicationsOfDerivatives}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-0-intro}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-1-related-rates}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-2-0-extrema}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-3-mean-value-theorem}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-4-0-approximations}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-5-Lhospitals-rule}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-6-0-curve-sketching}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-7-optimization}
	\subimport*{\mybuildpath}{5-applications-of-derivatives/5-8-antiderivatives}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Integration}\label{chap:Integration}
    \subimport*{\mybuildpath}{5-applications-of-derivatives/5-8-antiderivatives}
	\subimport*{\mybuildpath}{6-integration/6-1-area-prob}
	\subimport*{\mybuildpath}{6-integration/6-2-ftc}
	\subimport*{\mybuildpath}{6-integration/6-3-indefinite-integrals}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Techniques of Integration}\label{chap:TechniquesOfIntegration}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-0-intro}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-1-sub-rule}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-2-powers-of-trig}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-3-trig-sub}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-4-int-by-parts}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-5-rational-functions}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-6-numerical-int}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-7-improper-integrals}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-9-Inverse-Hyperbolic.tex}
	\subimport*{\mybuildpath}{7-techniques-of-integration/7-8-more-problems}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Applications of Integration}\label{chap:ApplicationsOfIntegration}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-1-dist-vel-acc}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-2-area-between-two-curves}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-3-volume}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-4-average-value}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-5-work}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-6-center-of-mass}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-7-arclength}
	\subimport*{\mybuildpath}{8-applications-of-integration/8-8-surface-area}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Sequences and Series}\label{chap:SequencesSeries}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-0-intro}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-1-sequences}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-2-series}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-3-integral-test}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-4-alt-series}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-5-comparison-test}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-6-abs-convergence}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-7-ratio-root-test}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-8-power-series}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-9-power-series-calculus}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-10a-taylor-polynomials}
	\subimport*{\mybuildpath}{9-sequences-and-series/9-10-taylor-series}
%	\subimport*{\mybuildpath}{9-sequences-and-series/9-11-taylors-theorem} %subsumed by previous two chapters

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Differential Equations}\label{chap:DifferentialEquations}
	\subimport*{\mybuildpath}{10-differential-equations/10-0-intro}
	\subimport*{\mybuildpath}{10-differential-equations/10-1-first-order-de}
	\subimport*{\mybuildpath}{10-differential-equations/10-2-first-order-homo-linear}
	\subimport*{\mybuildpath}{10-differential-equations/10-3-first-order-linear}
	\subimport*{\mybuildpath}{10-differential-equations/10-4-approximation-de}
	\subimport*{\mybuildpath}{10-differential-equations/10-5-second-order-homo}
	\subimport*{\mybuildpath}{10-differential-equations/10-6-second-order-linear-undetermined-coefficients}
	\subimport*{\mybuildpath}{10-differential-equations/10-7-second-order-linear-variation-parameters}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Polar Coordinates, Parametric Equations}\label{chap:PolarParametricEquations}
	\input 11-polar-coord-parametric-eq/11-1-polar-coordinates
	\input 11-polar-coord-parametric-eq/11-2-slopes
	\input 11-polar-coord-parametric-eq/11-3-areas
	\input 11-polar-coord-parametric-eq/11-4-parametric-equations
	\input 11-polar-coord-parametric-eq/11-5-calc-with-parametric-equations
	\input 11-polar-coord-parametric-eq/11-6-conics-in-polar-coord

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Three Dimensions}\label{chap:ThreeDimensions}
	\input 12-three-dimensions/12-1-coordinate-system
	\input 12-three-dimensions/12-2-vectors
	\input 12-three-dimensions/12-3-dot-product
	\input 12-three-dimensions/12-4-cross-product
	\input 12-three-dimensions/12-5-lines-planes
	\input 12-three-dimensions/12-6-other-coord-system

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\addtocontents{toc}{\protect\newpage}
\chapter{Partial Differentiation}\label{chap:PartialDifferentiation}
	\input 14-partial-differentiation/14-1-functions-of-several-variables
	\input 14-partial-differentiation/14-2-limits-continuity
	\input 14-partial-differentiation/14-3-partial-differentiation
	\input 14-partial-differentiation/14-4-partial-diff-chain-rule
	\input 14-partial-differentiation/14-5-directional-derivatives
	\input 14-partial-differentiation/14-6-multivariate-higher-order-derivatives
	\input 14-partial-differentiation/14-7-multivariate-max-min
	\input 14-partial-differentiation/14-8-lagrange-multipliers

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Multiple Integration}\label{chap:MultipleIntegration}
	\input 15-multiple-integration/15-1-volume-avg-height
	\input 15-multiple-integration/15-2-double-integral-polar-coord
	\input 15-multiple-integration/15-3-moment-center-mass
	\input 15-multiple-integration/15-4-surface-area
	\input 15-multiple-integration/15-5-triple-integrals
	\input 15-multiple-integration/15-6-cyl-sph-coords
	\input 15-multiple-integration/15-7-change-variable

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Vector Functions}\label{chap:VectorFunctions}
	\input 13-vector-functions/13-1-curves-vector-functions
	\input 13-vector-functions/13-2-calculus-with-vector-functions
	\input 13-vector-functions/13-3-arc-length
        \input 13-vector-functions/13-4-curvature
	\input 13-vector-functions/13-5-acceleration-vectors

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Vector Calculus}\label{chap:VectorCalculus}
	\input 16-vector-calculus/16-1-vector-fields
	\input 16-vector-calculus/16-5-divergence-curl
        \input 16-vector-calculus/16-2-line-integrals
        \input 16-vector-calculus/16-4-green-theorem
	\input 16-vector-calculus/16-9-divergence-theorem
	\input 16-vector-calculus/16-6-vector-function-surfaces
	\input 16-vector-calculus/16-7-surface-integrals
	\input 16-vector-calculus/16-8-stokes-theorem

\begin{enumialphparenastyle}
\Closesolutionfile{solutions}
\chapter*{Selected Exercise Answers}
\begin{multicols}{2}
	\input{ex1}
	%\include{ex}
\end{multicols}
\end{enumialphparenastyle}

\chapter*{Inside Cover Material}
\input{Inside_Cover_Of_The_Text_Material_Complete.tex}

\chapter*{Index}
\printindex


% ----------------------------------------------------------------------
\lecture{Computational aspects}{computation}
% ----------------------------------------------------------------------
\part{Computational aspects}
% ----------------------------------------------------------------------
\section{Consequence operator}
% ------------------------------
\input{computation/tp}
% ------------------------------
\section{Solving from first principles}
% ------------------------------
\input{computation/smodels}
% ----------------------------------------------------------------------
\section{Complexity}
% ------------------------------
\input{computation/complexity}
% ----------------------------------------------------------------------
\section{Summary}
% ------------------------------
\input{computation/summary}
% ----------------------------------------------------------------------
%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "main"
%%% End:


\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{geometry}
\usepackage{enumerate}
\usepackage{natbib}
\usepackage{float}%稳定图片位置
\usepackage{graphicx}%画图
\usepackage[english]{babel}
\usepackage{a4wide}
\usepackage{indentfirst}%缩进
\usepackage{enumerate}%加序号
\usepackage{multirow}%合并行
\title{\large UM-SJTU JOINT INSTITUTE\\Intro to Circuits\\(VE215)\\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\ \\\
LABORATORY REPORT\\\ \\\ EXERCISE 2\\\ OP Amp Lab \\\ \\\ \\\ \\\ \\\ }
\author{Name: Pan Chongdan\\ID: 516370910121\\Group: 16}
\date{Date: \today}
\begin{document}
\maketitle
\newpage
\section{Introduction and Theoretical Background}
\subsection{Objectives}
\begin{enumerate}
\item Learn how to build and test a variety of circuits based on LM 741 Op Amp chip: non-inverting and inverting amplifiers with fixed gain.
\item Measure the gain of the amplifier and compare it with theoretical calculations.
\item Determine the saturated output voltage of the amplifier.
\end{enumerate}
\subsection{Introduction}
Operational amplifiers are integrated circuits used in many applications and I built and studied LM741.
\subsubsection{Op Amp Terminals}
\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{P1.jpg}
\caption{Circuit symbol of a typical op amp}
\end{figure}
In Figure 1, there are :
\begin{enumerate}
\item Two terminals for input signals: inverting (labeled -) and non-inverting (labeled +)
\item A terminal for the output signal
\item Two terminals for the power supply voltages: positive +Vcc and negative –Vcc.
\end{enumerate}
Figure 2 shows the pin numbers of LM741
\begin{figure}[H]
\centering
\includegraphics[scale=0.5]{P2.jpg}
\caption{Pin numbers for LM 741 op amp Note:}
\end{figure}
\begin{enumerate}
\item Pin 8 is not connected; pins 1 and 5 are not used in this lab.
\item Do not mistake the connections of input signals 2 labeled – and 3 labeled +) for the connections to the power supply (4 for -Vcc and 7 for +Vcc).
\item Make sure you connect the grounds of oscilloscope, function generator and DC source together.
\end{enumerate}
\subsubsection{The Gain of Amplifier Circuits}
The amplifier circuits are characterized by their gain values. The voltage gain
is the ratio of output voltage to the input voltage in the circuit:
$$Voltage Gain=\frac{OutputVoltage}{InputVoltage}$$
In the lab, you can use oscilloscope to measure the input and output
peak-to-peak amplitudes of the signals through two channels at the same
time.
\subsubsection{Inverting amplifier}
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P3.jpg}
\caption{Inverting Amplifier}
\end{figure}
For inverting amplifier, the theoretical gain should be:
$$Gain=\frac{V_{out}}{V_s}=-\frac{R_F}{R_A}$$
\subsubsection{Non-inverting Amplifier}
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P4.jpg}
\caption{Inverting Amplifier}
\end{figure}
For non-inverting amplifier, the theoretical gain should be:
$$Gain=\frac{V_{output}}{V_S}=1+\frac{R_F}{R_A}$$
\section{Apparatus}
I used function generator and oscilloscope in exercise 2.
\subsection{Function Generator}
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P5.jpg}
\caption{Function Generator}
\end{figure}
\begin{enumerate}
\item "Parameter": to change the amplitude, frequency of wave to generate. The amplitude here equals to half of the pp value.
\item “1”/ 2”: to switch on the channel.
\end{enumerate}
\subsection{Oscilloscope}
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P6.jpg}
\caption{Oscilloscope}
\end{figure}
\begin{enumerate}
\item “Auto scale”: to automatically achieve an output on the screen with proper scale.
\item "Means": to turn on the measurement of the wave.
\item "1"$\setminus$"2": to show or hide the wave you detecting through channel 1 or 2.
\end{enumerate}
\section{Results}
\subsection{Non-inverting Amplifier}
\subsubsection{The resistances of the two resistors we used to build the circuit.}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
$R_1[\Omega]$        &51.3      \\ \hline
$R_f[\Omega]$        &99.5    \\ \hline
\end{tabular}
\end{table}
\subsubsection{The voltage supplied to the op amp.}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
$+V_{cc}[V]$       &+5      \\ \hline
$-V_{cc}[V]$        &-5    \\ \hline
\end{tabular}
\end{table}
\subsection{The input/output relationship}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|}
\hline
$V_{PP(in)}$[V]    &$V_{PP(out)}$[V] &Gain   \\ \hline
0.2 &$33.4\times 10^{-3}$&0.167  \\ \hline
0.4 &$62.3\times 10^{-3}$&0.156  \\ \hline
0.6 &$90.5\times 10^{-3}$&0.151  \\ \hline
0.8 &$121\times 10^{-3}$&0.152  \\ \hline
1.0 &$0.15$&0.150  \\ \hline
1.2 &$0.179$&0.149  \\ \hline
1.4 &$0.211$&0.151  \\ \hline
1.6 &$0.243$&0.152  \\ \hline
1.8 &$0.271$&0.151  \\ \hline
2.0 &$0.300$&0.150 \\ \hline
2.2 &$0.332$&0.151  \\ \hline
2.4 &$0.352$&0.147  \\ \hline
2.6 &$0.368$&0.142  \\ \hline
2.8 &$0.382$&0.137  \\ \hline
3.0 &$0.396$&0.132  \\ \hline
3.2 &$0.402$&0.126  \\ \hline
3.4 &$0.402$&0.118	  \\ \hline
\end{tabular}
\end{table}
\subsection{Inverting Amplifier}
\subsubsection{The resistances of the two resistors we used to build the circuit.}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
$R_1[\Omega]$        &51.3      \\ \hline
$R_f[\Omega]$        &99.5    \\ \hline
\end{tabular}
\end{table}
\subsubsection{The voltage supplied to the op amp.}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|}
\hline
$+V_{cc}[V]$       &+5      \\ \hline
$-V_{cc}[V]$        &-5    \\ \hline
\end{tabular}
\end{table}
\subsection{The input/output relationship}
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|}
\hline
$V_{PP(in)}$[V]    &$V_{PP(out)}$[V] &Gain   \\ \hline
0.2 &$22.1\times 10^{-3}$&0.111  \\ \hline
0.4 &$41.8\times 10^{-3}$&0.105  \\ \hline
0.6 &$60.3\times 10^{-3}$&0.101  \\ \hline
0.8 &$78.4\times 10^{-3}$&0.098  \\ \hline
1.0 &$96.5\times 10^{-3}$&0.097  \\ \hline
1.2 &$0.112$&0.094  \\ \hline
1.4 &$0.129$&0.092  \\ \hline
1.6 &$0.147$&0.092  \\ \hline
1.8 &$0.166$&0.092  \\ \hline
2.0 &$0.183$&0.092 \\ \hline
2.2 &$0.203$&0.093  \\ \hline
2.4 &$0.221$&0.092 \\ \hline
2.6 &$0.241$&0.093  \\ \hline
2.8 &$0.259$&0.093  \\ \hline
3.0 &$0.271$&0.091  \\ \hline
3.2 &$0.283$&0.086  \\ \hline
3.4 &$0.289$&0.085	  \\ \hline
3.6 &$0.297$&0.083  \\ \hline
3.8&$0.304$&0.080 \\ \hline
4.0 &$0.304$&0.076	  \\ \hline
\end{tabular}
\end{table}
\section{Discussion}
\subsection{Relation between $V_{pp(out)}$ vs. $V_{pp(in)}$}
\subsubsection{Non-inverting Amplifier}
$$V_1=V_{pp(in)}$$
$$\frac{0-V_1}{R_A}=\frac{V_1-V_{pp(out)}}{R_f}$$
$$Gain=\frac{V_{pp(out)}}{V_{pp(in)}}=1+\frac{R_f}{R_A}$$
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P7.jpg}
\caption{Relation between $V_{pp(out)}$ the $V_{pp(in)}$ for non-inverting amplifier}
\end{figure}
\subsubsection{Inverting Amplifier}
$$\frac{V_{pp(in)}}{R_A}=\frac{0-V_{pp(out)}}{R_f}$$
$$Gain=\frac{V_{pp(out)}}{V_{pp(in)}}=-\frac{R_f}{R_A}$$
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P8.jpg}
\caption{Relation between $V_{pp(out)}$ the $V_{pp(in)}$ for inverting amplifier}
\end{figure}
\subsection{Calculation, Uncertainty Analysis, and Plot}
\subsubsection{Non-inverting Amplifier}
$$\bar{Gain}=\frac{1}{17}\sum^{17}_{i=1}Gain_i=0.146$$
$$s_X=0.012$$
$$u=0.012/0.5=0.024$$
$$u_r=16.44\%$$
$$Gain=0.146\pm0.024$$
\begin{figure}[H]
\centering
\includegraphics[scale=0.3]{P9.jpg}
\caption{Relation between gain the $V_{pp(in)}$ for non-inverting amplifier}
\end{figure}
\subsubsection{Inverting Amplifier}
$$\bar{Gain}=\frac{1}{20}\sum^{20}_{i=1}Gain_i=0.092$$
$$s_X=8.09\times10^{-3}$$
$$u=8.09\times10^{-3}/0.467=0.017$$
$$u_r=18.47\%$$
$$Gain=0.092\pm0.017$$
\begin{figure}[H]
\centering
\includegraphics[scale=0.4]{P10.jpg}
\caption{Relation between gain the $V_{pp(in)}$ for non-inverting amplifier}
\end{figure}
\subsection{Error Analysis}
For non-inverting amplifier,the theoretical gain =$1+\frac{99.5}{51.3}=2.93$,but my data is 0.146. For inverting amplifier, theoretical gain =-1.94 while my data is 0.092. All my data is about 5\% of the theoretical gain, I think it's because my function generator's output voltage reading is wrong. Because if there exists a resistor of big resistance, the ration of the theoretical gain of measured gain shouldn't be same.
\par I find two potential reasons causing the error in the output voltage reading. The first reason is the oscilloscope's vertical scale and the probe is set wrong. The second reason is the oscilloscope may present the $V_{pp}$ higher than the function generator. The root cause is the generator doesn't generates a function that the oscilloscope is expecting. In addition, I might make some mistake in reading the voltage such as choosing the wrong unit, etc.
\par The relative uncertainty is pretty high, I think there also two reasons. First, the amplifiers used are not ideal, they have their own resistance, which will cause the error. Second, the points in my figure make up a line approaching lever when $V_{in}$ is becoming bigger, it's because the amplifier is saturated and $V_{out}$ wont' be bigger after that. For an ideal amplifier, the line should be straight.
\par In later lab work, I should be more carefully about the unit of all physical quantities as well as pay more attention to the amplification factor of the oscilloscope to make sure the oscilloscope match the function generator.
\section{Reference}
\begin{enumerate}[-]
\item \emph{VE215FA2017 OP AMP LabManual}
\item \emph{Circuits Make Sense}, Alexander Ganago, Department of Electrical Engineering and Computer Science, University of Michigan, Ann Arbor.
\end{enumerate}
\end{document}


%*******************************************************
% Introducción
%*******************************************************

% \manualmark
% \markboth{\textsc{Introducción}}{\textsc{Introducción}}
\chapter{Introduction}

The great revolution in mathematics, already started in the middle of the 19th century with the epsilon-delt formalism, is the formalization of mathematics. During this period, brilliant mathematicians like Weierstrass, Hilbert and most notably the group  Bourbaki put formalism at the core of mathematics. \\

Of all the areas that benefited from formalization, computation was probably the one that came out best. After the work of Church and Turing it became the mathematical element that would most seriously transform the world, like a steam engine of the contemporary era. This transformation was so radical that a person 50 years ago would not understand how to use the tools with which the population spends more than half of its waking hours nowadays.\\

The aim of this work is thus to strain the world-transforming idea of computation into an algebraic theory. This work  adopts a slow but steady pace, for before being able to strain one must first know how to use the straining tools, and then know in depth what one intends to strain.  \\

After the work of previous mathematicians such as Galois and Poincaré, and in sight of the new formalization and organization of mathematics, mathematicians such as MacLane, Elineberg, Cartan or Grothendiek began to form and expand what we know today as category theory. This theory effectively strained mathematical ideas in their purest form, and generate theories seemingly ubiquitous. After all, we study category as a knowledge condenser.\\

In the first part of this work we will talk about the theory of categories, explaining and introducing it. In the second part of the work, we will navigate in the concept of lambda calculus, as the first formalizing idea of computation. Both theories will be introduced with the point of view of a person who is interested in only one of them.\\

It is in the third part when the pairing happens. In particular the fourth chapter we raise all the bridges between closed Cartesian categories and computation with types. Finally, in chapter 5, we use ideas with the same flavor to prove a similar equivalence with Martin-L\"of's dependent typing. \\

Thus, this paper will deal with the intuition behind the formalism. We encourage the reader to try to gain in his reading an idea, not only formal but also intuitive, of what computation is, and what lies at the heart of this idea.  After all, in the immortal words of Karl Weierstrass \cite{duporcq1902compte}

\begin{quote}
... it is true that a mathematician who is not somewhat of a poet, will never be a perfect mathematician.\\
\end{quote}

\section*{Main goals and results achieved}
The initials goals of this master's thesis were:
\begin{enumerate}
\item Accomplishing a theoretical study of the foundations of category theory.
\item Accomplishing a theoretical study of the foundations of $\lambda$-calculus and typing theory.
\item Unifying both point of view after the works of Lambek \cite{lambek1988introduction} and Seely \cite{seely1984locally}.
\end{enumerate}

We consider that these three objectives have been accomplish successfully.\\

We also consider this work of a particular interest, because instead of introducing the concepts of category and typing in more focused on the later proof of equality, we prefer to work with the concepts in the form where their intuitive notion is clearer, in the preferred formulation that mathematicians whose objective is the study of each area and not its pairing with each other.

\endinput


\makeatletter
\def\input@path{{macros/}}
\makeatother

%\documentclass[final,leqno]{siamltex}
\documentclass[preprint,3p]{elsarticle}
\makeatletter
\def\ps@pprintTitle{}
\makeatother

\usepackage{url,etex,numprint,listings,spverbatim}
\usepackage[utf8x]{inputenc}
%\usepackage{epstopdf}

\npthousandsep{\,}
\npdecimalsign{.}
\npproductsign{\cdot}
\npunitseparator{\,}

\usepackage{graphics,graphicx}
\graphicspath{{./figure/}}

\usepackage[usenames]{xcolor}
\usepackage{amsfonts,float}
\usepackage[boxruled,longend,linesnumbered]{algorithm2e}

\newtheorem{problem}{Problem}
\usepackage[english]{babel}

\usepackage{graphics,graphicx}
\usepackage{makeidx}
\usepackage{bm,bbm,cases}

\usepackage[math]{easyeqn}
\usepackage{easyvector}

\eqrowsep{8pt plus 2pt minus 2pt}
\eqspacing{12pt plus 4pt minus 2pt}

\usepackage{tikz}
\usepackage{pgfplots}
%\usepackage[lined,boxed,commentsnumbered]{algorithm2e}
%     funzioni varie   %
\newcommand{\I}{{\color{red}\imag}}
\newcommand{\SCAL}[2]{\left<#1,#2\right>}
\newcommand{\KSCAL}[2]{\left[#1,#2\right]}
\newcommand{\REC}[1]{{\frac{1}{#1}}}
\newcommand{\DS}[1]{\displaystyle{#1}}
\newcommand{\DET}[1]{\left| #1 \right| }
\newcommand{\EXP}[1]{e^{#1}}

\newcommand{\ROT}[1]{\DS{\left( #1 \right)}}
\newcommand{\QUAD}[1]{\DS{\left[ #1 \right]}}
\newcommand{\FRAC}[2]{\DS{\frac{\DS{#1}}{\DS{#2}}}}
\newcommand{\cbin}[2]{\ROT{ {#1} \atop {#2}} }
\newcommand{\normb}[1]{\left|\left|\left| #1 \right|\right|\right| }
\newcommand{\ITER}[1]{{(#1)}}

\newcommand{\dtau}{\,\mathrm{d}\tau}

% manipolazione delle formule %
%\newcommand{\CL}{\mbox{$\cal L$}}
%\newcommand{\CH}{\mbox{$\cal H$}}
%\newcommand{\CU}{\mbox{$\cal U$}}
%\newcommand{\CV}{\mbox{$\cal V$}}
%\newcommand{\CS}{\mbox{$\cal S$}}
%\newcommand{\CT}{\mbox{$\cal T$}}

\newcommand{\SSE}{\Longleftrightarrow}
\newcommand{\IMP}{\Longrightarrow}

\newcommand{\DEF}{\mathrel{\mathop:}=}
\newcommand{\assign}{\leftarrow}
\newcommand{\swap}{\rightleftharpoons}
\newcommand{\ASSIGNl}[1]{\rlap{$#1$}\qquad\assign\,}
\newcommand{\ASSIGNm}[1]{\rlap{$#1$}\quad\;\assign\,}
\newcommand{\ASSIGNs}[1]{\rlap{$#1$}\quad\assign\,}
\newcommand{\vv}{``}
\newtheorem{theorem}{Theorem}[section]

\newtheorem{conjecture}[theorem]{Conjecture}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{corollary}[theorem]{Corollary}

\newtheorem{assumption}[theorem]{Assumption}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{example}[theorem]{Example}
\newtheorem{definition}[theorem]{Definition}
%\newtheorem{problem}[theorem]{Problem}
\newenvironment{proof}
{\par{\it Proof}. \ignorespaces}
{\qed\bigskip\newline}

\newcommand{\imag}{{\color{red}\bm{i}}}

\begin{document}

\begin{frontmatter}

\markboth{E.Bertolazzi, M.Frego}{$G^1$ Fitting with Clothoids - Readme}

\title{$G^1$ Fitting with Clothoids - Usage}

\author[EB]{Enrico Bertolazzi}
\ead{enrico.bertolazzi@unitn.it}

\author[EB]{Marco Frego}
\ead{m.fregox@gmail.com}

\address[EB]{Department of Industrial Engineering -- University of Trento, Italy}

\begin{abstract}
This file is part of the Matlab Central File Exchange release \vv G1 fitting with clothoids'' and is meant to help the final user in the usage of the software. The distribution is available at the address:\\
 \url{http://www.mathworks.com/matlabcentral/fileexchange/42113-g1-fitting-with-clothoids}
\end{abstract}

\end{frontmatter}

%\pagestyle{myheadings}
%\thispagestyle{plain}

\section{Introduction}
The aim of the release is to compute a single clothoid curve that interpolates (in the $G^1$ sense) two given points with assigned directions. For a theoretical background on clothoid interpolation, details on the implementation and example of application the reference article is \cite{Bertolazzi:2014}, available at:\\
 \url{http://onlinelibrary.wiley.com/doi/10.1002/mma.3114/abstract}. \\
In the paper there is a comparison of the state of the art algorithms for clothoid fitting and  discussion of the computation of the Generalized Fresnel Integrals, i.e. the moments. There are also proofs of accuracy and convergence with interesting counterexamples where other methods fail.

\section{Usage}
Here it is showed how to use the software by means of some easy examples. The problem and the notation are described briefly in the next section. To better follow the description refer to Figure \ref{fig:interpolation}.

\subsection{Problem statement}
Consider the curve which satisfies the following system of
ordinary differential equations (ODEs):
%%%
\begin{EQ}[rclrcl]\label{eq:ODE:clot}
  x'(s)         &=& \cos \vartheta(s),     \qquad & x(0)&=&x_0,\\
  y'(s)         &=& \sin \vartheta(s),     \qquad & y(0)&=&y_0, \\
  \vartheta'(s) &=& \mathcal{K}(s), \qquad & \vartheta(0)&=&\vartheta_0, \\
\end{EQ}
%%%
where $s$ is the arc parameter of the curve, $\vartheta(s)$ is the direction of
the tangent $(x'(s),y'(s))$ and $\mathcal{K}(s)$ is the
curvature at the point $(x(s),y(s))$.
When $\mathcal{K}(s)\DEF\kappa' s + \kappa$, i.e. when the curvature changes linearly,
the curve is called  Clothoid.
As a special case, when $\kappa'=0$ the curve has constant curvature, i.e. is a circle
and when both $\kappa=\kappa'=0$ the curve is a straight line.
%%%
The solution of ODEs~\eqref{eq:ODE:clot} is given by:
%%%
%%%
\begin{EQ}[rclcl]\label{clot}
  x(s) &=& x_0 + \int_0^s \cos \Big(\frac{1}{2}\kappa'\tau^2+\kappa\tau+\vartheta_0\Big) \dtau
  &=&  x_0 + sX_0(\kappa's^2,\kappa s,\vartheta_0),
  \\
  y(s) &=& y_0 + \int_0^s \sin \Big(\frac{1}{2}\kappa'\tau^2+\kappa\tau+\vartheta_0\Big) \dtau
  &=&  y_0 + sY_0(\kappa' s^2,\kappa' s,\vartheta_0).
\end{EQ}
%%%
Notice that $\frac{1}{2}\kappa's^2+\kappa s+\vartheta_0$ and
$\kappa's+\kappa$ are, respectively, the angle and the curvature
at the  abscissa $s$.
%%%
%%%
Thus, the problem considered and solved with this release is stated next.
%%%
\begin{problem}[$G^1$ Hermite interpolation]\label{prob:1}
  Given two points $(x_0,y_0)$ and $(x_1,y_1)$
  and two angles $\vartheta_0$ and $\vartheta_1$,
  find a curve segment of the form~\eqref{clot} which
  satisfies:
  %%%
  \begin{EQ}[rclrclrcl]\label{eq:prob:1}
    x(0) &=& x_0, \qquad &
    y(0) &=& y_0, \qquad &
    (x'(0)\,,\,y'(0)) &=& (\cos\vartheta_0,\,\sin\vartheta_0), \\[\jot]
    x(L) &=& x_1, \qquad &
    y(L) &=& y_1, \qquad &
    (x'(L),y'(L)) &=& (\cos\vartheta_1,\,\sin\vartheta_1),
  \end{EQ}
  %%%
  where $L>0$ is the length of the curve segment.\\
\end{problem}
%%%
\begin{figure}[!tb]
  \begin{center}
    \includegraphics[scale=0.8]{Art_Figure_1}
  \end{center}
  \caption{$G^1$ Hermite interpolation scheme and  notation.}
  \label{fig:interpolation}
\end{figure}
%%%
\subsection{Solution with Matlab}
Suppose to interpolate the two points as suggested in the file \texttt{testN0.m},
%%%
\begin{lstlisting}[breaklines, backgroundcolor=\color{gray!10},basicstyle=\small\ttfamily]
% initial point with angle direction
x0     = 0.5 ;
y0     = 0   ;
theta0 = 1   ;

% final point with angle direction
x1     = 0.5 ;
y1     = 0.5 ;
theta1 = 1   ;
\end{lstlisting}
%%%
The call to the function \texttt{buildClothoid} computes the three parameters needed in the computation of \eqref{eq:prob:1}, namely the two components of the curvature $\kappa$, $\kappa'$ and the length of the curve $L$:
%%%
\begin{lstlisting}[breaklines, backgroundcolor=\color{gray!10},basicstyle=\small\ttfamily]
% compute clothoid parameters
[k,dk,L] = buildClothoid( x0, y0, theta0, x1, y1, theta1 ) ;
\end{lstlisting}
%%%
The input parameter are respectively: $x,y$ component of the starting point, the initial angle, $x,y$ component of the final point, the final angle.
To use in practice the computed curve, it is useful to have a sampling of the curve in terms of $x,y$ components, this is obtained by the function \texttt{pointsOnClothoid} where \texttt{npts} is the number of sampling points.
 %%%
\begin{lstlisting}[breaklines, backgroundcolor=\color{gray!10},basicstyle=\small\ttfamily]
% compute points on clothoid
XY = pointsOnClothoid( x0, y0, theta0, k, dk, L, npts ) ;
\end{lstlisting}
%%%
The result can be plotted to check the solution with
 %%%
\begin{lstlisting}[breaklines, backgroundcolor=\color{gray!10},basicstyle=\small\ttfamily]
% plot solution
plot( XY(1,:), XY(2,:), '-r' ) ;
axis equal
\end{lstlisting}
%%%

\section{How to cite}
If you use the present software in your research, please cite both the article \cite{Bertolazzi:2014} and the implementation \cite{algo:ref}. The respective bibtex are listed below.
\begin{lstlisting}[breaklines, backgroundcolor=\color{gray!10},basicstyle=\small\ttfamily]
@article{bertolazzifrego:2014,
  author    = {Bertolazzi, Enrico and Frego, Marco},
  title     = {$G^1$ fitting with clothoids},
  journal   = {Mathematical Methods in the Applied Sciences},
  publisher = {John Wiley & Sons, Ltd},
  issn      = {1099-1476},
  url       = {http://dx.doi.org/10.1002/mma.3114},
  doi       = {10.1002/mma.3114},
  year      = {2014},
}

@misc{bertolazzifrego:2014,
  Author       = {Bertolazzi, E. and Frego, M.},
  Howpublished = {\url{http://www.mathworks.com/matlabcentral/fileexchange/42113-g1-fitting-with-clothoids}},
  Title        = {$G^1$ fitting with clothoids},
  Year         = 2013,
}
\end{lstlisting}
%%%
\bibliographystyle{alpha} % global bibliography
\bibliography{Clothoid_fitting} % global bibliography

\end{document}


%---------------------------------------------------------------------------------
\chapter{Introduction}
\label{chap:introduction}
%---------------------------------------------------------------------------------

This report describes the work undertaken as an assignment for the Numerical Solution for Differential Equations \RN{1} course given in the Mathematical Institute by Professor Endre S\"{u}li. It describes the implementation of a number of methods for the numerical solution of ordinary differential equations (ODEs) as an open source Python software package that I have developed and made available on GitHub. The package makes extensive use of software engineering techniques to ensure that the software is robust and fully tested.

I have also developed a number of tutorial examples as Jupyter Notebooks to explain how the methods work and to demonstrate their use on some real examples. They are available through links, indicated by underlined italic font, provided throughout the report.

The structure of this report is as follows: in Chapter \ref{chap:numerical-methods}, I describe the domain of ODEs and the numerical methods that I implement, and gives links to the software and tutorial notebooks for a simple test problem; Chapter \ref{chap:code-implementation} describes the implementation and testing of the software; Chapter \ref{chap:fitzhugh-nagumo} describes the application of the methods to the Fitzhugh-Nagumo model; and Chapter \ref{chap:conclusion} gives some brief conclusions.


\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}}}%

\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}
\usepackage[colorlinks=true, linkcolor=blue, citecolor=blue, urlcolor=blue, linktocpage=true, breaklinks=true]{hyperref}
\usepackage[margin = 1in]{geometry}
\usepackage{varioref}  % adds page to references use \vref{} vs \ref{}
\usepackage{amsthm}
\newtheoremstyle{rcode}{1pt}{1pt}{}{}{\bfseries}{}{.5em}{}
\theoremstyle{rcode}
\newtheorem{rcode}{R Code}[section]
\newtheorem{GIT}{Git Example}[section]
% User Commands
\newcommand{\noind}{\setlength{\parindent}{0pt}}
\newcommand{\reind}{\setlength{\parindent}{15pt}}

\title{Using the \textbf{R Code} and {\bfseries{Git Example}} Environments with \textbf{knitr}}
\author{Alan's Modifications and Notes}
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
\begin{document}
\maketitle

\section{Introduction}

This is a test of the \textbf{R Code} and \textbf{Git Example} environments.  By the way,
this document was last compiled Wednesday, November 04, 2015 - 01:41:04 PM.

\subsection{Simple Arithmetic}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{rcode}\label{test-a}\hfill{}\begin{alltt}
\hlnum{1} \hlopt{+} \hlnum{1}
\end{alltt}
\begin{verbatim}
[1] 2
\end{verbatim}
\end{rcode}\end{kframe}
\end{knitrout}

\subsection{Generate Random Data}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{rcode}\label{test-b}\hfill{}\begin{alltt}
\hlkwd{set.seed}\hlstd{(}\hlnum{13}\hlstd{)}
\hlstd{x} \hlkwb{<-} \hlkwd{rnorm}\hlstd{(}\hlnum{100}\hlstd{)}
\end{alltt}
\end{rcode}\end{kframe}
\end{knitrout}
\noind
Find the standard deviation of \texttt{x}.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{rcode}\label{test-c}\hfill{}\begin{alltt}
\hlkwd{sd}\hlstd{(x)} \hlcom{# standard deviation   }
\end{alltt}
\begin{verbatim}
[1] 0.9508399
\end{verbatim}
\end{rcode}\end{kframe}
\end{knitrout}

Note that \textbf{R Code} \vref{test-b} and \vref{test-c} are hyperlinked!  The standard deviation of \texttt{x} is computed in \textbf{R Code} \vref{test-c} and is 0.9508399.

\clearpage
\subsection{Graphs and Environments}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{rcode}\label{plot1}\hfill{}\begin{alltt}
\hlkwd{set.seed}\hlstd{(}\hlnum{41}\hlstd{)}
\hlstd{junk} \hlkwb{<-} \hlkwd{rnorm}\hlstd{(}\hlnum{10000}\hlstd{)}
\hlstd{MEAN} \hlkwb{<-} \hlkwd{mean}\hlstd{(junk)}
\hlstd{MEAN}
\end{alltt}
\begin{verbatim}
[1] 0.006226888
\end{verbatim}
\end{rcode}\end{kframe}
\end{knitrout}

The mean of the junk is 0.0062269.  Note: It seems that an error is thrown if
a code chunk with a graph and \texttt{rcode} is executed at the same time.  Work around is
as shown below.  That is, hide the figure when showing the code...then show the figure
with a separate code chunk.  Note that Figure \vref{graphDude} is hyperlinked!

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{alltt}
\hlkwd{library}\hlstd{(ggplot2)}
\hlkwd{ggplot}\hlstd{(}\hlkwc{data} \hlstd{= mtcars)} \hlopt{+}
  \hlkwd{geom_density}\hlstd{(}\hlkwd{aes}\hlstd{(}\hlkwc{x} \hlstd{= mpg),} \hlkwc{fill} \hlstd{=} \hlstr{"pink"}\hlstd{)} \hlopt{+}
  \hlkwd{theme_bw}\hlstd{()} \hlopt{+}
  \hlkwd{labs}\hlstd{(}\hlkwc{x} \hlstd{=} \hlstr{"miles per gallon"}\hlstd{,} \hlkwc{y} \hlstd{=} \hlstr{""}\hlstd{,} \hlkwc{title} \hlstd{=} \hlstr{"$\textbackslash{}\textbackslash{}alpha + \textbackslash{}\textbackslash{}beta = \textbackslash{}\textbackslash{}delta$"}\hlstd{)}
\end{alltt}
\end{kframe}
\end{knitrout}

\begin{figure}[h]
\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}

{\centering \includegraphics[width=0.5\textwidth]{figure/GraphShow-1}

}

\end{knitrout}
\caption{This is where you explain your graph \label{graphDude}}
\end{figure}

\clearpage

\section{Git Stuff}

When working with OSX, one may want to change \texttt{engine = `sh'} to \texttt{engine = `bash'}.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{GIT}\label{GITlabel}\hfill{}\begin{alltt}
git config --list
\end{alltt}

\begin{verbatim}
user.name=Alan Arnholt
user.email=arnholtat@appstate.edu
credential.helper=cache --timeout=10000000
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=https://github.com/STAT-ATA-ASU/STT5811ClassRepo.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master
\end{verbatim}
\end{GIT}\end{kframe}
\end{knitrout}

Look at \textbf{R Code} \vref{test-a} to add $1 + 1$ and get the answer 2. The output from \textbf{Git Example} \vref{GITlabel} shows how my machine is configured. \textbf{Git Example} \vref{gitlog} shows the log.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{GIT}\label{gitlog}\hfill{}\begin{alltt}
git log --pretty=oneline -3
\end{alltt}

\begin{verbatim}
1667a1de882476bb1f8d0cf07cca5a1cdee1cdd1 t26
71c4e4a2debabc0ef39966f37dfb9d07d00e32b7 t2
10b6b277e52ec157c66a990c1ac21df6e2a2130b t1
\end{verbatim}
\end{GIT}\end{kframe}
\end{knitrout}

\clearpage

\section{Using \LaTeX{} in Graphs}

How about some more \LaTeX{} in a \texttt{ggplot2} graph.

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}\begin{kframe}
\begin{rcode}\label{molatex}\hfill{}\begin{alltt}
\hlstd{f} \hlkwb{<-} \hlkwa{function}\hlstd{(}\hlkwc{x}\hlstd{)\{}\hlkwd{sqrt}\hlstd{(}\hlnum{2}\hlopt{/}\hlstd{(x} \hlopt{-} \hlnum{1}\hlstd{))}\hlopt{*}\hlkwd{gamma}\hlstd{(x}\hlopt{/}\hlnum{2}\hlstd{)}\hlopt{/}\hlkwd{gamma}\hlstd{((x} \hlopt{-} \hlnum{1}\hlstd{)}\hlopt{/}\hlnum{2}\hlstd{)\}}
\hlkwd{library}\hlstd{(ggplot2)}
\hlstd{p} \hlkwb{<-} \hlkwd{ggplot}\hlstd{(}\hlkwd{data.frame}\hlstd{(}\hlkwc{x} \hlstd{=} \hlkwd{c}\hlstd{(}\hlnum{2}\hlstd{,} \hlnum{50}\hlstd{)),} \hlkwd{aes}\hlstd{(}\hlkwc{x} \hlstd{= x))}
\hlstd{p} \hlopt{+} \hlkwd{stat_function}\hlstd{(}\hlkwc{fun} \hlstd{= f)} \hlopt{+}
  \hlkwd{labs}\hlstd{(}\hlkwc{x} \hlstd{=} \hlstr{"$n$"}\hlstd{,} \hlkwc{y} \hlstd{=} \hlstr{"$\textbackslash{}\textbackslash{}frac\{\textbackslash{}\textbackslash{}sqrt\{2\}\textbackslash{}\textbackslash{}Gamma\textbackslash{}\textbackslash{}left(\textbackslash{}\textbackslash{}frac\{n\}\{2\}\textbackslash{}\textbackslash{}right)\}
       \{\textbackslash{}\textbackslash{}sqrt\{n-1\}\textbackslash{}\textbackslash{}Gamma\textbackslash{}\textbackslash{}left(\textbackslash{}\textbackslash{}frac\{n-1\}\{2\}\textbackslash{}\textbackslash{}right)\}$\textbackslash{}n"}\hlstd{)} \hlopt{+}
  \hlkwd{theme_bw}\hlstd{()} \hlopt{+}
  \hlkwd{geom_hline}\hlstd{(}\hlkwc{yintercept} \hlstd{=} \hlnum{1}\hlstd{,} \hlkwc{lty} \hlstd{=} \hlstr{"dashed"}\hlstd{)}
\end{alltt}
\end{rcode}\end{kframe}
\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}

{\centering \includegraphics[width=1.0\textwidth]{figure/molatexFIG-1}

}

\end{knitrout}

\begin{knitrout}
\definecolor{shadecolor}{rgb}{0.969, 0.969, 0.969}\color{fgcolor}

{\centering \includegraphics[width=\maxwidth]{figure/base-1}

}

\end{knitrout}

\begin{itemize}\raggedright
  \item R version 3.2.2 (2015-08-14), \verb|x86_64-pc-linux-gnu|
  \item Locale: \verb|LC_CTYPE=en_US.UTF-8|, \verb|LC_NUMERIC=C|, \verb|LC_TIME=en_US.UTF-8|, \verb|LC_COLLATE=en_US.UTF-8|, \verb|LC_MONETARY=en_US.UTF-8|, \verb|LC_MESSAGES=en_US.UTF-8|, \verb|LC_PAPER=en_US.UTF-8|, \verb|LC_NAME=C|, \verb|LC_ADDRESS=C|, \verb|LC_TELEPHONE=C|, \verb|LC_MEASUREMENT=en_US.UTF-8|, \verb|LC_IDENTIFICATION=C|
  \item Base packages: base, datasets, graphics, grDevices,
    methods, stats, utils
  \item Other packages: ggplot2~1.0.1, knitr~1.11,
    tikzDevice~0.8.1
  \item Loaded via a namespace (and not attached):
    codetools~0.2-14, colorspace~1.2-6, digest~0.6.8,
    evaluate~0.8, filehash~2.3, formatR~1.2.1, grid~3.2.2,
    gtable~0.1.2, highr~0.5.1, labeling~0.3, magrittr~1.5,
    MASS~7.3-44, munsell~0.4.2, plyr~1.8.3, proto~0.3-10,
    Rcpp~0.12.1, reshape2~1.4.1, scales~0.3.0, stringi~1.0-1,
    stringr~1.0.0, tools~3.2.2
\end{itemize}

\end{document}