+
Error Propagation
Developed by Earl Blodgett  Published August 5, 2016
In this set of exercises, the student will explore error propagation for experimental data, comparing a general purpose Monte Carlo method to the traditional method of error propagation. The Monte Carlo method is useful for situations where the function is not sufficiently linear for the approximations made in the traditional method of error propagation. The Monte Carlo method is also useful in situations where calculating the derivatives for the traditional method of error propagation is tedious.
Subject Areas  Mathematical/Numerical Methods and Experimental Labs 

Levels  First Year and Beyond the First Year 
Available Implementation  IPython/Jupyter Notebook 
Learning Objectives 
Students who complete these exercises will
 be able to apply the standard analytic approach to error propagation for functions involving only addition/subtraction, only multiplication/division and functions involving both addition and multiplication. (**Exercises 1, 2, 3 and 4**);
 be able to modify the supplied code to implement the Monte Carlo method for evaluating the value and uncertainty for any wellbehaved function (**Exercises 2, 3, 4 and the Extension**);
 be able to recognize and describe the conditions under which the standard approach to evaluating a function of multiple parameters begins to break down. (**Exercise 4 and the Extension**).

Time to Complete  90 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
### Exercise 1: Error Propagation for Simple Addition/Subtraction
The template Error Propagation.ipynb is preset for this problem. Note that the template reports a ridiculous number of digits, so you will need to properly round off the reported uncertainties and mean values yourself.
Suppose that you have measured two distances, $x_1$ = 5.00 ± 0.20 m and $x_2$ = 6.50 ± 0.10 m.
 If you add the two distances, what is the uncertainty in that sum?
 If you find the difference $x_2  x_1$, what is the uncertainty in that difference?
 What difference do you see between adding and subtracting?
 Explore the role of N: make it much smaller and much larger, so that you can see how the Monte Carlo results converge to the traditional results. Python is quite capable of handling a millionpoint array!
### Exercise 2: Error Propagation for Simple Multiplication/Division
You will need to make more modifications to the Jupyter notebook. If you want to preserve your earlier work separately, go to the $File$ menu and select $Make a copy...$ and then $Rename...$ it.
For this exercise, you could still use the same two parameters, $x_1$ = 5.00 ± 0.20 m and $x_2$ = 6.50 ± 0.10 m.
 Modify the block of code that calculates the traditional value for the function and uncertainty for the function $f(x_1,x_2) = x_2 * x_1$.
 Modify the block of code that performs the Monte Carlo method.
 Compare the average and uncertainty for the Monte Carlo method with the traditional method, they should agree very well.
 Modify for the function $f(x_1,x_2) = x_2 / x_1$ and again compare the two methods.
 What difference do you see between multiplication and division?
 Calculate the relative uncertainty for both situations, multiplication and division, and reconsider the previous question.
### Exercise 3: Error Propagation for a Simple Compound Function
A compound function involves both addition and multiplication, so that the simple quick methods for error propagation cannot be applied. In this exercise, you will predict the velocity of an object given the initial velocity, acceleration and elapsed time.
$$ v = v_0 + a * t $$
where $v_0$ = 2.40 ± 0.20 $m/s$,$a$ = 1.55 ± 0.15 $m/s^2$ and $t$ = 12.0 ± 1.0 $s$.
 Modify the block of code that calculates the traditional value for the velocity and uncertainty of the velocity.
 Modify the block of code that performs the Monte Carlo method.
 Compare the average and uncertainty for the Monte Carlo method with the traditional method.
 The uncertainty in the predicted velocity is rather large. If you could only improve the precision of $one$ of the parameters, which one would have the most impact on the final precision? Which would have the least impact? (One way to explore this to divide each uncertainty by 10, one by one.) This type of exploratory error analysis can help in deciding where to focus resources in improving the precision of an experiment.
### Exercise 4: Exploring nonlinearity
The standard approach to error propagation relies on the approximation that the function is approximately linear over the range $\overline a ± \sigma_{\overline a}$. For many situations encountered in experimental physics, this is a very good approximation. In this exercise you will push the limits.
Consider the function $f(r) = \frac{1}{r^4}$ which you might encounter in a measurement of the elastic moduli of a cylinrical rod. For the purpose of this exercise, start out with $\overline r$ = 5.00 ± 0.01 mm.
 Modify the block of code that calculates the traditional value and uncertainty of the function.
 Modify the block of code that performs the Monte Carlo method.
 Compare the average and uncertainty for the Monte Carlo method with the traditional method. Increase the standard error of $r$ to ± 0.50 mm and repeat the comparison. Also look at the shape of the histogram of the simulations, is it still symmetric?
 It is easy to calculate the derivative for this function, and evaluate it at the mean value of r and at the mean ± sigma. Use a per cent difference to describe how much the slope varies compared to the derivative at the center. Examine how the relative uncertainty in r relates to the variation in the slope, looking for where the traditional approach deviates noticeably from the Monte Carlo approach.
### Extension: Range of a Projectile
If a projectile is launched from zero altitude with initial speed $v_0$ at an angle of $\theta$ above horizontal, it will return to zero altitude at a range given by
$$R = \frac{v^2_0}{g} sin(2 \theta)$$
Do you want to input your angle in degrees? You'll need to be able to convert degrees to radians in the program!
Consider an initial speed of 25 ± 1 m/s and an angle of 35 ± 2 degrees.
 This function is a little more complicated to do the traditional error propagation, complicated enough that you might start to see some value in the Monte Carlo approach versus the traditional approach. Do the traditional error propagation and code it.
 Compare the Monte Carlo and traditional results. Is the function sufficiently linear with the given uncertainties? How can you tell?
 Which parameter is most crucial for a precise prediction of the range? Describe how you determined your answer.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Earl Blodgett, "Error Propagation," Published in the PICUP Collection, August 2016.
The instructor materials are ©2016 Earl Blodgett.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license