You are on page 1of 10

TL2.

Error Propagation
Prelab Checklist
Prelab Quiz
Install Python and Jupyter Notebooks (See instructions on OnQ)
Download the ErrorPropagationCode2021.ipynb Jupyter Notebook
Review Python Tutorial Video(s)

Introduction
As described in the Tutorial 2 prelab, there are three equations typically used for error
propagation.
When y is only dependent on a single variable x then the propagated error in y is:

When y is dependent on a number of variables x1, x2, x3…. then the maximum propagated error in y
is:
𝜕𝑦 𝜕𝑦 𝜕𝑦
𝛿𝑦 = |𝜕𝑥 | 𝛿𝑥1 + |𝜕𝑥 | 𝛿𝑥2 + |𝜕𝑥 | 𝛿𝑥3 … (2)
1 2 3

Remember that, as discussed in the prelab, equation 2 usually overestimates the propagated
error somewhat. Your Python code uses equation 3 from the prelab, which gives a better
estimation of the error (the likely error) but is harder to calculate by hand.

Error Propagation exercises:


For each of the three situations described below, you will determine the desired value with
error in two ways:
1. Calculate the maximum error (by hand) using equation 2 above.
2. Using your Python code for equation 3 above, determine the likely error and produce
a sensitivity analysis.

Situation 1
The initial position of the free end of a horizontal beam is 65.5 ± 0.1 cm above the ground.
After a load has been added to the free end the position is re-measured and found to be 42.1
± 0.1 cm above the ground. By how much has the beam deflected? Using the following
variable names write out an algebraic expression for the deflection:
hi = initial height, hf = final height, d = deflection

d = hi - hf (algebraic expression)

In the box below, use equation (2) to derive an expression for the maximum error in d. Use
as many lines as you wish. You can type in the box or do it on a piece of paper and take a
photo of it.
𝜕𝑑 𝜕𝑑
𝛿𝑑 = |𝜕ℎ𝑖| 𝛿ℎ𝑖 + |𝜕ℎ𝑓| 𝛿ℎ𝑓

𝜕𝑑 𝜕𝑑
𝛿𝑑 = |−ℎ𝑓| 𝛿ℎ𝑖 + |−ℎ𝑖| 𝛿ℎ𝑓

𝜕𝑑 𝜕𝑑
𝛿𝑑 = |−42.1| 0.1 + |−65.5| 0.1

= 0.2

Substitute the values into your equations and write down the answer for d below
(remember the sigfig reporting rules):
d = 23.4 ± 0.2 cm

Python calculation for Situation 1: Fill out the data table on the first sheet of the Excel file
and paste it below.

Table 1: Description of the variables and their values used in the error propagation calculation

Variables Description Value Error


hi initial height 65.5 0.1
hf final height 42.1 0.1

Run the Python code, entering in your algebraic expression, variable values and their
respective errors. This will determine your value for d with error and produce the
sensitivity analysis. Add your result below.
d = 23.4 +/- 0.1 cm
Compare the calculated Python result (which uses equation 3) with your manually-
calculated result using equation 2. Comment on whether this is what you expect. (note
your results should be similar. If not check your calculations.)

The result calculated manually using equation two gave the maximum value of error. The
result calculated by Python used a variation on the equation that uses the Pythagorean
theorem to find the more likely error as opposed to the maximum. The maximum value
found in the manual calculation, as expected, was larger than Python’s generated answer.
Since the equations are so similar and the margin for error is not that large, the answers are
quite similar.

Paste your sensitivity analysis result below.

Figure 1: Above shows the sensitivity analysis determined by Python’s calculation demonstrating
how each parameter contributed to the error of the dependent variable.
Comment on the results of your sensitivity analysis. What does it tell you about which
parameter contributed the most to the error in the deflection d? Does this make sense given
your equations?

The results of the sensitivity analysis show that both parameters contributed exactly
50% to the error of the deflection, meaning that they contribute equally. Given the
equation, this is a logical sensitivity analysis. In the calculation for error, both
independent variables resulted in the same derivative with the same value. Next, they
were simply added together. Therefore, it makes sense for the parameters to contribute
equally to the error for deflection, as they have the same value.

Situation 2

In the experiment, x was varied (the independent variable) and the resulting y value was
recorded. A graph of y versus x is plotted which results in a straight line. The slope of the
line is determined to be m = 31 ± 2. If  has been measured to be 3.20 ± 0.05, what is the
value of B?

Write out an algebraic expression for B in terms of m and w.

𝟒𝝎𝟐
B= (algebraic expression)
𝒎

In the box below, use equation (2) to derive an expression for the maximum error in B. Use
as many lines as you wish. You can type in the box or do it on a piece of paper and take a
photo of it.
𝜕𝐵 𝜕𝐵
𝛿𝐵 = |𝜕𝜔| 𝛿𝜔 + |𝜕𝑚| 𝛿𝑚

8𝜔 4𝜔 2
𝛿𝐵 = | 𝑚 | 𝛿𝜔 + |−𝑚2 | 𝛿𝑚

8(3.20) 4(3.20)2
𝛿𝐵 = | | 0.05 + | |2
31 −312

= 0.1
Substitute the values into your equations and write down the answer for B below:
B= 1.3 ± 0.1 .

Python = calculation for Situation 2: Fill out the data table on the second sheet of the Excel
file and paste it below.

Table 2: Description of the variables and their values used in the error propagation calculation

Variables Description Value Error


ω n/a 3.2 0.05
m slope of line 31 2

Run the Python code, entering in your algebraic expression, variable values and their
respective errors. This will determine your value for B with error and produce the
sensitivity analysis. Add your result below.
B= 1.32 ± 0.09 .

Compare the calculated Python result (which uses equation 3) with your manually-
calculated result using equation 2. Comment on whether this is what you expect. (note
your results should be similar. If not check your calculations.)

The result calculated manually using equation two gave the maximum value of error. The
result calculated by Python used a variation on the equation that uses the Pythagorean
theorem to find the more likely error as opposed to the maximum. The maximum value
found in the manual calculation, as expected, was larger than Python’s generated answer.
Since the equations are so similar and the margin for error is not that large, the answers are
quite similar.

Paste your sensitivity analysis result below.


Figure 2: Above shows the sensitivity analysis determined by Python’s calculation demonstrating
how each parameter contributed to the error of the dependent variable.

Comment on the results of your sensitivity analysis. What does it tell you about which
parameter contributed the most to the error in the variable B? Does this make sense
given your equations and the information in the Data table? If you were trying to
improve your experiment to reduce the overall error, what parameter would you
focus on?
The sensitivity analysis shows that parameter ω contributed 19% to the total error and
parameter m contributed 81% to the error. This clearly shows that variable m
contributed significantly more to the error of variable B. This makes sense given the
equation for error propagation for B, as the product of the derivative and error for
parameter m was larger than that for parameter ω. These values were summed to
determine the error of B, therefore it makes sense that the larger value contributes
more to the error of B. If overall error was attempted to be reduced, m would be the
variable focused on for this change, as it is the main contributor.
Situation 3

A nitrite solution is made by diluting 2.50 ± 0.02 ml of a 5.00 ± 0.04mg/L stock nitrite
solution to 50.0 ± 0.1ml. Thus the final concentration C is

Where: Vs = volume of stock solution [ml], Co = concentration of stock solution [mg/L], Vf


= final volume [mL], C = final concentration [mg/L]

In the box below, use equation (2) to derive an expression for the maximum error in C. Use
as many lines as you wish. You can type in the box or do it on a piece of paper and take a
photo of it.
𝜕𝐶 𝜕𝐶 𝜕𝐶
𝛿𝐶 = |𝜕𝑉𝑠| 𝛿𝑣𝑠 + |𝜕𝑉𝑓| 𝛿𝑣𝑓 + |𝜕𝑉𝑜| 𝛿𝑐𝑜

𝐶𝑜 𝑉𝑠𝐶𝑜 𝑉𝑠
𝛿𝐶 = |𝑉𝑓| 𝛿𝑣𝑠 + | 𝜕𝑣𝑓 | 𝛿𝑣𝑓 + |𝑉𝑓| 𝛿𝑐𝑜

5 2.5(5) 2.5
𝛿𝐶 = |50| 0.02 + | −502 | 0.1 + | 50 | 0.04
= 0.0045

Substitute the values into your equations and write down the answer for C below:
C= 0. 250 ± 0.005 mg/L

Python calculation for Situation 3: Fill out the data table on the third sheet of the Excel file
and paste it below.

Table 3: Description of the variables and their values used in the error propagation calculation

Variables Description Value Error


vs volume of stock solution [ml] 2.5 0.02
co concentration of stock solution [mg/L] 5 0.04
vf final volume [mL] 50 0.1

Run the Python code, entering in your algebraic expression, variable values and their
respective errors. This will determine your value for C with error and produce the
sensitivity analysis. Add your result below.
C= 0.250 ± 0.003 mg/L

Compare the calculated Python result (which uses equation 3) with your manually-
calculated result using equation 2. Comment on whether this is what you expect. (note
your results should be similar. If not check your calculations.)

The result calculated manually using equation two gave the maximum value of error. The
result calculated by Python used a variation on the equation that uses the Pythagorean
theorem to find the more likely error as opposed to the maximum. The maximum value
found in the manual calculation, as expected, was larger than Python’s generated answer.
Since the equations are so similar and the margin for error is not that large, the answers are
quite similar.

Paste your sensitivity analysis result below.


Figure 3: Above shows the sensitivity analysis determined by Python’s calculation demonstrating
how each parameter contributed to the error of the dependent variable.

Comment on the results of your sensitivity analysis. What does it tell you about which
parameter contributed the most to the error in the variable C? Does this make sense
given your equations and the information in the Data table? If you were trying to
improve your experiment to reduce the overall error, what parameter would you
focus on?
The sensitivity analysis shows that parameters vs and co both contributed 48.48% to the
error for the final concentration, and parameter vf contributed 3.03%. This shows that vs and
co contributed equally to make up the majority of the error, while vf only contributes a small
amount. This makes sense given the equations and information presented in Table 3. The
product of the derivative and error for vs was equal to that for co, therefore it is logical for
the parameters to have equal contributions. The value of the same product for vf was
significantly smaller, also aligning with the sensitivity analysis results.

NOW UPLOAD YOUR FILE TO THE ONQ DROPBOX FOR TUTORIAL LAB 2. IT MUST BE IN PDF
FORMAT.
TO DO THIS - BEFORE YOU LEAVE THE LAB -
• GO TO “FILE” AND CLICK EXPORT.
o CLICK “CREATE PDF”
o SAVE IT (PUBLISH IT) TO YOUR TUTORIAL LAB 2 SUBFOLDER.
• THEN UPLOAD YOUR PDF FILE TO THE ONQ DROPBOX.
DO NOT UPLOAD THE WORD FILE TO THE DROPBOX - MAKE SURE IT IS A PDF. WE WILL NOT MARK
A WORD FILE

You might also like