Accounting for uncertainty in calculations
Most measuring devices are not 100% accurate and instead are accurate up to a certain amount, usually somewhere between 0 and 10%. For instance, a thermometer might be accurate to 1%, while a pair of digital calipers might be accurate up to 0.1%. The true value in both of these cases is unlikely to be exactly the reported value, although it will be fairly close. Keeping track of the uncertainty in a value is difficult, especially when you have multiple different uncertainties combined in different ways. Rather than keeping track of this by hand, it is much better to use a consistent library to do this for you. This is what the uncertainties
package does.
In this recipe, we will learn how to quantify the uncertainty of variables and see how these uncertainties propagate through a calculation.
Getting ready
For this recipe, we will need the uncertainties
package, from which we will import the ufloat
class and the umath
module:
from...