\documentclass[fleqn,nopageno,letterpaper,11pt]{report}

\input{/Users/pleclair/Documents/Alabama/Teaching/PH102/defs}

\usepackage{garamond}

\headheight 0.25in
\headsep 3ex
\topmargin -0.25in
\textheight 8.75in
\textwidth 6.5in
\oddsidemargin 0in
\evensidemargin 0in

\parindent 0in 
 
\begin{document} \garamond
\pagestyle{fancy}

\lhead[\fancyplain{}{}]           {\fancyplain{}{{\sc \large Group Members}}}
\rhead[\fancyplain{}{}]           {\fancyplain{}{{\sc }}}

\begin{center} 
	{\sc \large  University of Alabama}\\
	{\large Department of Physics and Astronomy}\\ \bigskip
	{\large EMAP / LeClair  \hfill \today} \bigskip
	
{\bf \Large Laboratory 1: Error analysis} %% EXPLAIN running average better. Excel formulas. 
\end{center}  %%% probably need more than 10 trials. a better simple source of data would be good.

\randombox{Neutral}{{\bf Needed:}
\begin{my-enumerate}
\item Meter stick
\item Paper or Excel
\item Group of 2-5 students
\end{my-enumerate}}

In this exercise we are interested in learning how to correctly analyze data. The main point here is that any time one measures a quantity, one must be able to tell the accuracy of this quantity. Otherwise, there is no way to tell whether the number agrees with the predictions of a theory, and there is no way for another scientist to check the experiment.\\

For example, suppose I measure the circumference of a circle, then its diameter, and divide the circumference by the diameter. The result ought to be $\pi$. If my result is 3.15, have I proved that $\pi$ is not 3.14? In this case, of course, we know the accepted result. If the uncertainty of my measurement is 0.01 or more, then my result is consistent with the value that we are familiar with.\\

What we will explore in this laboratory are data analysis techniques that will allow you to determine, from a series of measurements, what the actual uncertainty is.

\section*{Standard Deviation}

Suppose a series of measurements is made of the value of some unknown quantity. 
Usually these measured values will not all be the same. A statistical analysis of the measured 
values estimates the quantity and its variability. Analysis of the uncertainty determines the 
probability that the ``true'' value lies within a certain range. Of course, the percent difference 
between two measured values gives some idea of the range of measured values to be expected, 
but this is not a very reliable indicator.  Whenever a measurement is reported, a determination of 
the reliability of a measurement is equally important to report.  The mathematical methods used 
to determine statistical uncertainty are commonly referred to as error analysis. \\

A mathematically complete treatment of error analysis is beyond the scope of this course. 
It is necessary to understand the basic methods of error analysis to properly report the results of 
the experiments.  Some basic assumptions are necessary to estimate the uncertainties 
encountered in the measurements and analysis of data.  First, it is assumed that differences in 
measurements are due to small random fluctuations that are just as likely to make the 
measurement higher as it is to make it lower. In some cases there is a systematic error which 
always makes a measurement smaller or larger than the ``true'' value.  Examples of systematic 
errors include parallax in reading a meter stick, friction in balance or meter bearings, tightening 
of a micrometer screw too much, failure to account for air resistance, etc. \\
 
In well-designed experiments, systematic errors are accounted for, noted and measured.   
Under these conditions, a very large number of measurements of the same quantity should 
distribute themselves symmetrically about the simple arithmetic mean or average, which is the 
``best'' value of the quantity. The expected variations of the measurements can be described by a 
quantity called the ``standard deviation''\\  

The standard deviation is computed in a straightforward manner. Suppose the quantity $x$ is 
measured $n$ times. The measured values are labelled $x_1$, $x_2$, \ldots $x_n$. First, we calculate the {\it mean}, or average of all the values, denoted $\overline{x}$. This is just as you would expect:

\begin{equation}
\overline{x} = \frac{1}{n}\sum\limits_i^n x_i \label{eq:mean}
\end{equation}

Next, calculate the deviation of {\it each} measurement from the mean, $x_i-\overline{x}$ and square the result: $\left(x_i-\overline{x}\right)^2$. Finally, add the squared deviations together, divide by the number of measurements $n$ and take the square root of the result:

\begin{equation}
\sigma = \sqrt{\frac{1}{n}\sum\limits_{i=1}^n \left(x_i-\overline{x}\right)^2} \label{eq:std-dev}
\end{equation}

A sneaky, and somewhat less tedious formula is given by

\begin{equation}
\sigma = \frac{1}{n} \sqrt{n\left(\sum\limits_{i=1}^n x_i^2\right) - \left(\sum\limits_{i=1}^n x_i\right)^2 }\label{eq:std-dev2}
\end{equation}

A large standard deviation indicates that the data points are far from the mean and a small standard deviation indicates that they are clustered closely around the mean. The reported standard deviation of a group of repeated measurements should give the precision of those measurements. When deciding whether measurements agree with a theoretical prediction, the standard deviation of those measurements is of crucial importance: if the mean of the measurements is too far away from the prediction (with the distance measured in standard deviations), then the theory being tested probably needs to be revised. This makes sense since they fall outside the range of values that could reasonably be expected to occur if the prediction were correct and the standard deviation appropriately quantified.\\

According to sampling theory, there is a 68\% probability that any additional 
measurement made of the quantity $x$ will lie within $\pm \sigma$ of the mean and a 95\% probability that it will lie within $\pm 2\sigma$ of the mean. in most of the experiments of this course, repeated  measurements are performed about five or ten times.  Using the above analysis for less than five independent measurements of a quantity is generally not considered to be statistically reliable. \\

The statistical treatment assumes that all errors are random and ignores any systematic 
error, such as improper meter calibration, wind resistance, etc. which might be present. In any 
laboratory situation, it is the responsibility of the experimenter to determine whether or not these 
systematic errors are significant and to include them in the estimate of accuracy if they are.  On 
occasion, it will not be feasible to repeat an experiment several times and find a mean and 
standard deviation. It may be possible, however, to determine or estimate the uncertainties in the 
measurements of the quantities used in computing the final result. For example, a manual 
measurement of a time interval is accurate to $\pm 0.1$ second, due to reaction times in starting and 
stopping the timer. 

\section*{Hypothesis:} The {\it statistical} uncertainty in a series of measurements should approach a constant value as the number of data points increases, for a small number of trials. That is, by taking many measurements, we should be able to define a characteristic uncertainty in the data set. We can check this by calculating the standard deviation for an increasing number of data points.

\section*{Experiment}

Have one group member take the meter stick and hold it downward by its top end. Have a second group member place their thumb and forefinger at the $50\,$cm mark, ready to grasp the meter stick. A third group member should record data. Let the first member drop the meter stick, and the second grab it as soon as they can. Record the difference between the position on the meter stick where the second group member was able to grab and stop it and $50\,$cm. This will be a measure of his or her reaction time. Note that $x\!=\!50-\text{stopping distance}$.\\

Record this ``reaction distance'' $x$ ten or twelve times, and make a table similar to the one below. Report only the number of digits which are reliably measured.\\ 

\begin{table}[h]\centering
\begin{tabular}{ccc@{}} \toprule[1.5pt]
{\bf point $i$} & {\bf stopping position [cm]} & {\bf reaction distance $x$ [cm]} \\\midrule
1 & 20 & 30\\
2 & 23 & 27\\
3 & 21 & 29\\
4 & 22 & 28\\
5 & 24 & 26\\
\ldots & \ldots & \ldots	\\ \bottomrule[1.5pt]
\end{tabular}
\end{table}

\randombox{Neutral}{{\bf Questions:}\\
What is the {\it systematic} error in your measurement? Meaning, what is the accuracy of your position measurement? Call this quantity $\delta x$.}

\section*{Analysis}

Once you have acquired your data, calculate running mean and standard deviation as a function of the number of points taken, by making a table such as the one below. At each data point after the first one, calculate the average according to Eq.~\ref{eq:mean} and the standard deviation according to Eq.~\ref{eq:std-dev} or Eq.~\ref{eq:std-dev2}. Note that for calculating the standard deviation after $n$ points, you need to use the average after $n$ points. For example, if your three points are 11.0, 11.5, and 12.0, the average after 2 points is 11.25 and after 3 points it is 11.5. After two points, your average and standard deviation would be:

\begin{align*}
\overline{x}_2 &= \frac{1}{n}\sum\limits_i^n x_i = \frac{1}{2}\left[11.0 + 11.5\right] = 11.25\\
\sigma_2 &= \sqrt{\frac{1}{n}\sum\limits_{i=1}^n \left(x_i-\overline{x}\right)^2} = \sqrt{\frac{1}{2}}\sqrt{\left(11.0-11.25\right)^2 + \left(11.5-11.25\right)^2} = 0.25
\end{align*}

After three points, it looks like this:

\begin{align*}
\overline{x}_3 &= \frac{1}{n}\sum\limits_i^n x_i = \frac{1}{3}\left[11.0 + 11.5 + 12.0\right] = 11.5\\
\sigma_3 &= \sqrt{\frac{1}{n}\sum\limits_{i=1}^n \left(x_i-\overline{x}\right)^2} = \sqrt{\frac{1}{3}}\sqrt{\left(11.0-11.5\right)^2 + \left(11.5-11.5\right)^2 + \left(12.0-11.5\right)^2)} \approx 0.41\\
\text{or}\qquad \sigma_3 &= \frac{1}{3}\sqrt{3\cdot \left(11.0^2 + 11.5^2+12.0^2\right) - \left(11.0+11.5+12.0\right)^2}\approx 0.41
\end{align*}

For the purposes of analysis, you might want to make a table something like the one below, which will make calculating standard deviation with Eq.~\ref{eq:std-dev2} relatively easy:
\clearpage

\begin{table}[h]\centering
\begin{tabular}{cccccc@{}} \toprule[1.5pt]
{\bf point}  & {\bf distance}& {\bf running}  & {\bf running}& {\bf running}  & {\bf running}\\
{\bf point $i$} & {\bf $x_i$} & {\bf average $\overline{x}$}  & $\sum_i x_i$& $\sum_i x_i^2$ & {\bf $\sigma$} \\\midrule
1  & 28.1 & 28.1 & 28.1 & 789.61 &-- \\
2  & 28.5 & 28.3 & 56.6 & 1601.86 & 0.20\\
3  & 28.7 & 28.4 & 85.3 & 2425.55 &0.25\\
4  & 28.3 & \ldots & \ldots\\
5  & 28.0 & \ldots& \ldots\\
\ldots & \ldots & \ldots & \ldots	\\ \bottomrule[1.5pt]
\end{tabular}
\end{table}

Once you have analyzed your data, plot the standard deviation ($y$ axis) as a function of $n$ ($x$ axis), either on paper or using, e.g., Excel.\\

\section*{Reporting Final Data}

After a series of measurements and subsequent analysis, you now have two sources of error to report: the statistical error due to measurement fluctuations (the standard deviation), and the systematic  or instrument error, reflecting the accuracy of individual measurements. You can report your final result as:
\begin{align}
\text{(quantity)} &= \text{(mean)} \pm \text{(systematic error)} \pm \text{(statistical error)} \nonumber \\
\text{or} \qquad x &= \overline{x} \pm \delta x \pm \sigma
\end{align}

\randombox{Neutral}{{\bf Questions:}
\begin{itemize}
\item Does the uncertainty change as the number of points increases? 
\item Does your data confirm the stated hypothesis?
\item How could you reduce the systematic error?
\item Is the systematic error small or large compared to the statistical error?
\item Compare data with neighboring groups. Is the human to human variation larger or smaller than the measurement errors?
\end{itemize}
}

\section*{Homework}

Can you figure out how to do this in Excel?\\
Bring in a rubber ball for the next session (Fri 10 July, 3:45pm)

\end{document}