in Scientific Applications
Lynn Robert Carter
2018-02-23
Introduction
The more we study, the more we realize there is to learn. As small children, we learned math
and the idea that there are right and wrong answers to simple arithmetic problems. I
enjoyed math, because I liked being able to check my work to ensure that I had the right
answer. It wasn’t until much later that I came to understand that there are seldom simple
right and wrong answers to the important questions in the real world.
This turns out to be true in so many things. In scientific applications, there are some cases
whether there are exact values. In most cases, however, whatever the figure we use, there is
some degree of uncertainty. For example, it is true that we can count the number of cars in
a small parking lot and feel comfortable about the number being exact. As the parking lot
becomes larger and larger, it becomes more difficult to be so certain. While you were in the
middle of the count in one portion of the lot, did some people come back to their cars and
leave from that portion of the lot you have already counted without you knowing it?
This paper provides an initial survey of key concepts from a most excellent book by John R.
Taylor, entitled An Introduction to Error Analysis; The study of uncertainties in physical
measurements, Second Edition. For a more serious and broader treatment of this subject,
please consider Professor Taylor’s book. (It is hard to miss with a cover photo of a building
after a steam locomotive has crashed through it.)
2
the point that there is a distribution that must be considered and that statistical tools can be
used to produce the error term.
Given the real data, we can compute the standard deviation. We can then use that figure,
with the confidence level we require, to compute the size of the uncertainty. It is convention
to express the error term rounded to just a single significant digit1, because we want people
to be able to accurately produce the range of values in their head.
Once you know the error term, you can then figure out how to write out the best estimate. If
the error term is “± 3”, it does not make sense to have a value expressed as “15.35 ± 3”. The
error term specifies uncertainty about the best estimate. If the uncertainty is “± 3”, it is a
waste of time and energy to show any more than that same precision in the best estimate
value. Therefore, it should be shown as “15 ± 3”.
The general rule about writing out these values is to compute and round the error term to
one significant figures and then round the best estimate to the same least significant digit.
For example, if the error term ends up as “± 0.1” and the best estimate was shown as
“12.72316”, the best estimate should be rounded to four significant decimal places, or “12.7”
in this case and the value would be shown as “12.7 ± 0.1”
Consider the situation where the error term is “± 200” and the best estimate was shown to
be “672,316”. How should one write out the value? Again, we should round the best estimate
to the same significant digit as the error term. Since the significant digit in the error term is
in the 100s digit, we should round the best estimate value to the 100s. Therefore, the result
should be written as “672,300 ± 200”.
Not all values have an error term. For example, if you are to record the number of windows
in a house, it is possible to count the number of windows precisely and there is no need to
add an error term. Another situation where one does not typically use an error term is with
constant values, such as 𝜋. The notion here is that you write out as many significant digits as
you believe are needed. For example, to be accurate within a kilometer when dealing with
the distances from the Earth or Mars, which can range from 54.6 million km to 401 million
km, will require at least nine significant digits. The value of 𝜋 should therefore be at least
that many digits, if not a couple more to deal with rounding and truncation. For this reason,
using 3.14 would be unwise, while 3.141592653589793 might be a bit overkill, but not
unreasonable. The implication of the first value is that 𝜋 could be any value from 3.135… to
3.144… assuming the result has been rounded and the same can be concluded about the last
digit in the more precise value. (In reality, the next digit is a “2”, round up from “1” due to the
digit after it, which is a “5”.)
When one does computations with one or more values with no error terms showing, we must
conclude that all shown digits are precise. It is for this reason, we strongly encourage people
to write 672,300 ± 200 as 6.723E+2 as opposed to 672,300 when forced to not use an error
term. The former gives no hints about the tens’ and units’ digits, while the latter implies the
value is precise through to the units’ digit, when that is clearly not true.
1 The value 0.001 has just one significant digit. The leading zeros do not count. The easiest way to think about
this is to express the value in scientific notation, where the mantissa is less than 1 and greater than or equal
to .1. In this situation, the value would be .1 × 10-2. Here, then, it is clear that there is only one digit in the
mantissa (the “.1”).
3
Should one specify one operand with no error term and a second with an error term, it is
wise to produce an implied error term based on the input and then employ the rules that
have been summarized in this document or refer to Taylor’s book for a much more detailed
presentation.
8.5
8.5
4
Accuracy is a measure of the degree to which a set of measured values clusters around the
actual value of something being measured. Precision is a measure of the amount of deviation
among a set of measured values of a something being measured.
We scientists and engineers like measurements than are both accurate and precise.
5
requires use to add the two smallest and the two largest, which results in a value range of
[33.32374, 33.42376]. The size of the range between these two values in the range is
“0.10002”. If we assume a normal distribution, the best estimate would be at the middle,
“33.37375”, and the error term would have half above and half below this value, resulting in
“33.37375 ± 0.05001”. Following our rule about error terms having just one significant digit,
the appropriate error term would be “± 0.06” (round up). If we really want to be sure that
our result truly includes the smallest and largest values, it is better to round up to “± 0.06”.
Using this to round the best estimate, the sum should be listed at “33.37 ± 0.06” with a range
of [33.31, 33.43]3 which includes the calculated end-points [33.32374, 33.42376].
To add two uncertain values, add the two best estimates, add the error terms, round the
error term to just one or maybe two significant digits, use the significance of the new error
term to determine the significance of the sum, and write the rounded sum with its new error
term.
In the case of subtracting two uncertain values, the same results apply, subtract the two best
estimates (producing a difference), add the error terms, round this new error term to just
one or maybe two significant digits, use the significance of the new error term to determine
the significance of the difference, and write out the rounded difference with its new error
term.
6
leave it to you to determine how you feel about gambling that the actual amount will be the
low side of this figure as opposed to the high side when it comes to purchasing just one can
of mastic. (Especially if you can return an unused can and get your money back.)
Consider the case of the division of two values: 36.375 ± 0.003 ÷ 2.2255 ± 0.0001. Following
the same process, we convert both to ranges of [36.372, 36.378] ÷ [2.2254, 2.2256]. To
perform the division, we need to establish the range from the smallest to the largest possible
result from these ranges. The smallest possible result comes from dividing the smallest
possible numerator value by the largest denominator. Similarly, the largest possible result is
produced when the largest possible numerator is divided by the smallest denominator.
Therefore, the result would be in the range [36.372 ÷ 2.2256, 36.378 ÷ 2.2254]. Performing
the division, the result would be [16.342559, 16.346724]. To convert it back to a value
plus/minus an error, we average the two values and then compute the error by subtracting
this average from the two limits. The average is 16.3446415 and the error term would be
0.0020825. To simplify the error term to just a single digit, we should round it to 0.0034,
which covers the limits we have calculated, or 16.3446415 ± 0.003. Removing the digits that
are beyond the precision we can justify given the error term, 16.345 ± 0.003 would be the
result and that covers the limits that we have computed.
The formula for computing the error term in the product is obviously more complex that just
the sum of the component error terms. Multiplication and division work like a magnifier and
that can magnify errors as well as the product and quotient. We will not derive the formula
here, but we will explain its use in the example we’ve just covered.
4 You might think that 0.0020825 should be rounded to 0.002 as opposed to 0.003. If we used 0.002 as the
rounded error term, we would have a range of [16.343, 16.347], but the smallest and largest possible results
would not be in this range. It is for that reason that we round up to 0.003 as opposed to just round to 0.002
which is much closer to the actual error. When we use 0.003 as the range, we get [16.342, 16.348], which
includes both 16.342559 and 16.346724.
7
ProductErrorTerm Value1ErrorTerm Value2ErrorTerm
= +
⎮Product⎮ ⎮Value1⎮ ⎮Value2⎮
To compute the error term (ProductErrorTerm) we first need to compute the result:
Product = Value1 × Value2
Compute the relative fraction of Value1 that is uncertain (Value1errorFraction):
Value1ErrorFraction = Value1ErrorTerm / ⎢ Value1 ⎢
Compute the relative fraction of Value2 that that is uncertain (Value2ErrorFraction):
Value2ErrorFraction = Value2ErrorTerm / ⎢ Value2 ⎢
Compute the Product’s error (ProductErrorTerm):
ProductErrorTerm = (Value1ErrorFraction + Value2ErrorFraction) × ⎢ Product ⎢
5 We round up to ensure the actual upper and lower values will be included.
8
The process for determining the uncertainty for division is precisely the same as the
uncertainty for multiplication. A common mistake is to assume that step (6) on the previous
page should be changed to be a division when dividing two uncertain values, but this is not
true. Exactly the same algorithm is performed, including the multiplication by the quotient,
as shown below:
QuotientErrorTerm Value1ErrorTerm Value2ErrorTerm
= +
⎮Quotient⎮ ⎮Value1⎮ ⎮Value2⎮
To compute the error term (QuotientErrorTerm) we first need to compute the result:
Quotient = Value1 / Value2
Compute the relative fraction of Value1 that is uncertain (Value1errorFraction):
Value1ErrorFraction = Value1ErrorTerm / ⎢ Value1 ⎢
Compute the relative fraction of Value2 that that is uncertain (Value2ErrorFraction):
Value2ErrorFraction = Value2ErrorTerm / ⎢ Value2 ⎢
Compute the Quotient’s error (QuotientErrorTerm):
QuotientErrorTerm = (Value1ErrorFraction + Value2ErrorFraction) × ⎢ Quotient ⎢
9
Propagating uncertainties with powers and roots
The final portion of this paper will explore raising an uncertain value to a power or taking a
root (as in square root). From Taylor’s book, we learn the following:
PowerErrorTerm ValueErrorTerm
= ⎮n⎮ ×
⎮Power⎮ ⎮Value⎮
To compute the error term (PowerErrorTerm) we first need to compute the result:
Power = Valuen
Compute the relative fraction of Value that is uncertain (ValueerrorFraction):
ValueErrorFraction = ValueErrorTerm / ⎢ Value ⎢
Compute the Power’s error (PowerErrorTerm):
PowerErrorTerm = ⎮n⎮× ValueErrorFraction × ⎢ Power ⎢
Conclusion
Taylor’s book provides a wealth of wisdom and is a must-read book for any serious scientist
or engineer and a must-use book for anyone performing important scientific computations,
especial those that are mission-, business-, or life-critical. This paper has tried to simplify
the Taylor’s materials in support of the teaching of programming, but this paper should not
be used as citable source or for any actual important computation as there is much more to
this topic that can be covered in an introductory paper such as this.
10