Error Analysis Lab

M.P.Belhorn
L.A. Bryant
P.J. Malsom

Error analysis is one of the most important aspects of any scientific paper. Every scientific experiment must include a complete error analysis in order to correctly interpret results.

The "experimental" data

Let' s start by generating some "experimental" data. Below we have created a sine wave with some random noise added in.

Noise:=RandomReal[{-0.3,0.3}]
testData1=Table[{t,π Sin[1.34 t+π/2]+Noise},{t,0,4π,0.1}];
dataPlot1=ListPlot[testData1]

Creating a theoretical model and finding associated errors

As you can see, there is some variance in the sine function -- it is not perfect. This implies that we want to fit a model to the data. This model should represent some physical model -- not just some function that happens to fit.

Clear[model1]
model1[A_,ω_,ϕ_,t_]:=A Sin[ω t+ϕ];
fit1=NonlinearModelFit[testData1,model1[A,ω,ϕ,t],{A,{ω,1.3},{ϕ,1.5}},t]
Show[dataPlot1,Plot[fit1[t],{t,0,4π}]]

The output of NonlinearModelFit is what Mathematica calls a FittedModel. This object is not simply a number or a function, rather it is an abstract structure that contains a multitude of fit parameters. The properties and diagnostics of the FittedModel structure can be obtained using the following:

fit1["Properties"]

For this class, the two most important properties of the FittedModel are the "estimated variance" and the "standard error". The standard deviation (σ) is defined to be the square root of the estimated variance. The standard error is a generalization of the standard deviation. Standard error is equivalent to the standard deviation when the sample data's distribution has a Gaussian spread.

stdDev1=Sqrt[fit1["EstimatedVariance"]]

fit1["ParameterTable"]

Measurement Error

Error in measurement is one important source of error. It is a value that the experimenter should estimate when performing the experiment. It is important to be honest when reporting the values of measurement error as the estimation will effect all of the error analysis to come.

All measured quantities (Subscript[x, merasured]) are not exact. They have something called a measurement uncertainty Δx associated with them such that the exact value of whatever quantity is being measured is within 
(Subscript[x, exact]) ∈ (Subscript[x, measured])± Δx. Consider measuring the length of an object with a meter stick that has been graduated in centimeters. Suppose the object has an EXACT length of 34 + (69/250) = 34.276 centimeters. That means that the end of the object will be located between the 34 and 35 cm tick marks on the meter stick. Is it possible with this meter stick to tell the EXACT length of this object? No, at best we could guess that the length is something like l = 34.25 cm in length with an uncertainty of, say, Δl = ±0.40 cm. This error, Δl, is a measurement uncertainty and it arises from the limited "resolution" of the meter stick that we used to measure this object. To reduce this uncertainty we could use a meter stick that was graduated in millimeters or even picometers, but ultimately there is a finite resolution associated with the measuring instrument (here, the meter stick) and that finite resolution produces an uncertainty.  Even in this case where we have an object of exactly 34.276 cm in length, a meter stick graduated in picometers will tell us only that the object is 34.2760000000 ± .00000000005 cm. We express the uncertainty of a measured quantity by writing the number as seen above, namely in two parts. First the value measured (Subscript[x, measured]) and then plus - or - minus (±) the uncertainty Δx and then the units so the number looks like "
(Subscript[x, measured])±Δx units".

So all measured quantities have a finite minimum measurement uncertainty. Every instrument (a calipers, a scale, a stopwatch etc.) has a finite resolution and thus an associated minimum measurement uncertainty. The minimum measurement uncertainty associated with an instrument is constant the same for all measurements made with that instrument. We will take the minimum measurement uncertainty of an instrument in this course to be 1/2 its finest scale graduation. We can of course use an uncertainty greater than the minimum if we feel the minimum might not contain all our error.

Systematic Errors

Systematic errors are due to our ignorance or neglect of phenomena present in our experiment but absent from our models. What do we mean by model? When we say that the constant acceleration motion of a particle is described by

x=(Subscript[x, 0])+(Subscript[v, 0]) t+(1/2)a (t^2)   (1),

we are claiming that the equation above is a "model" that describes the motion of a particle under constant acceleration. When we apply this model to the motion of a particle in a gravitational field, we assume that the acceleration is truly constant and has a magnitude of a=-g=-9.8 m/(s^2). Is the acceleration truly constant? Are we forgetting anything that might affect the acceleration? Is the particle moving through air? Air is a viscous fluid that imparts a force that is proportional to the velocity of the object. Thus, if the particle is moving through air, the acceleration is NOT constant. Often we neglect air resistance by assuming it is small. Notice that if we apply equation (1) to determine the acceleration of an object moving through a viscous medium, we will find a value for the acceleration that will be consistently biased away from the true value by an amount due to the phenomenon our model ignores (here, air resistance). Thus air resistance is a systematic error when we use this model to describe the motion of an object in free fall in air. 

	Another common source of systematic error comes from poor instrument calibration or misuse. If one neglects to zero a balance (tare) before using it to make mass measurements, all masses measured will deviate from the true mass by a consistent amount. This is a calibration systematic error. Alternatively, if you consistently read an instrument incorrectly, your results will be biased in a specific way. Some of you may know that when reading the volume of a fluid in a measuring cup, beaker, or graduated cylinder you must look edge-on at the bottom of the meniscus. If you read the volume from above the plane of the meniscus, you will read a larger volume than is present. If you do this consistently, then you are biasing your results systematically. Be sure to reduce these types of error by using the equipment properly and carefully!

	In your lab reports, we will expect you to identify relevant systematic errors. What do I mean by relevant? I mean that even though in theory the gravitational pull of Jupiter is affecting you results, it affects them in such a minute way that the effects are not noticeable or measurable by the equipment we are using. I only care about systematic errors that bias your results by an amount greater than your measurement error. Sometimes it is hard to identify systematic errors. If you cannot identify any in your experiment say so, but be aware that there are usually systematic errors present.

Propagation of Error

The above model and fitting parameters are only the first step to a full error analysis of a scientific experiment. To perform a complete analysis of error we need to calculate the error of values that cannot be directly measured. This involves the propagation of error from measurements and their associated errors. As this is an advanced class, we will only cover the general formula for propagation of error. 

Suppose we have a general function of a few variables  f(α,β,γ,...), and that we have calculated the value of α, β and γ along with their associated estimated uncertainty (Δα, Δβ, Δγ,...). The error in the function (Δf) is given by the following

(((Δf))^2)=(((((∂f)/(∂α))))^2)*(((Δα))^2)+(((((∂f)/(∂β))))^2)*(((Δβ))^2)+(((((∂f)/(∂γ))))^2)*(((Δγ))^2)+...

This will allow us to calculate any measurement error of any calculation that we need to perform.

An Example of Propagation of Error

To illustrate this, consider the surface area of a cylinder of radius r and height h. The expression for the area of the ends of the cylinder is two times the area of a disk (Subscript[A, disk])=π (r^2) where π is not a measured quantity, but is instead a constant. So, (Subscript[A, ends])=2 π (r^2). The area of the body of the cylinder is a rectangle of sides h and the circumference of the end disks 2π r such that (Subscript[A, side])=2 π r h. Therefore, the total area of a cylinder is:

A(r,h)=2 π (r^2)+2π r h

To calculate the surface area of a cylinder, we measure r and h with measurement uncertainties Δr and Δh and apply the formula above to find A. The error, ΔA, in our calculated area A due to the error in our measurements of r and h is found using the formula for propagating error:

ΔA((Subscript[x, 1]),(Subscript[x, 2]))=(Sqrt[(∑_(i=1)^n)((((Subscript[Δx, i])*((∂A)/(∂(Subscript[x, i])))))^2)])=ΔA(r,h)=(Sqrt[(((Δr*((∂A)/(∂r))))^2)+(((Δh*((∂A)/(∂h))))^2)])
=(Sqrt[(((Δr*(4π r+2 π h)))^2)+(((Δh*2 π r))^2)])

Suppose someone measures the radius to be 10.0 ± 0.2 cm and the height to be 15.3 ± 0.3 cm. Then the calculated area is then going to be

A(10.0,15.3)=2 π (10.0^2)+2π 10.0*15.3=1589.7 (cm^2)≃ 1590 (cm^2)
with an uncertainty of
ΔA(10.0,15.3)=(Sqrt[(((0.2*(4π 10.0+2 π 15.3)))^2)+(((0.3*2 π 10.0))^2)])=48.2=50 (cm^2)
or, 1590±50(cm^2) in significant figures.

Question 1

Run the following code and generate fitting parameters with their corresponding errors.
(Hint: Use ParameterTable). Also calculate the standard deviation of the wave. The fitting function should have the form

f(A,ω,t,ϕ)=A Sin(ωt+ϕ)

angularVel=RandomReal[{0.8,1.2}];
phaseAngle=RandomReal[{0,2 π}];
Amplitude=RandomReal[{1,4}];
Noise:=RandomReal[{-0.3,0.3}]
sampleData=Table[{t,Amplitude Sin[angularVel t+phaseAngle]+Noise},{t,0,7 π,0.1}]

Question 2

In an RLC circuit, the alternating current is given by:

i=(Subscript[i, m])*Sin(ω t + ϕ)

where (Subscript[i, m])is

(Subscript[i, m])=((Subscript[ε, m])/(Sqrt[(R^2)+((((1/(ω C))-ω L))^2)]))

Propagate the error in (Subscript[i, m]).
(Hint: You do not need to do the derivatives by hand. Mathematica can do this for you.)

Question 3

In Lab 14, we calculate the constant c, which we define to be the mass distribution along the length of the spring. c is given by:

c=(((k/(ω^2))-M)/(Subscript[m, spring]))

Use the following values to propagate the error in c (that is, Δc).

k=10.63±0.52kg/(s^2)
ω=12.87±1.1(s^(-1))
M=.25±.01kg
(Subscript[m, spring])=0.173±.005kg

Write a sample abstract as if this was a real lab report. Be sure to quote the value of c and its error (Δc). Please check with us to make sure you have done this part correctly before you turn this lab in.