For general propagation of uncertainty tasks , we use
Uncertainties: a Python package written by Eric. O. Lebigot, the same package Pint uses "under the hood" for calculations invoking
.plus_minus()
. The uncertainties module returns its result with the uncertainty specified by linear
error propagation theory, taking into account any direct correlations between variables. Quoting from the uncertainties website,
The standard deviations and nominal values calculated by this package are thus meaningful approximations as long as uncertainties are “small”. A more precise version of this constraint is that the final calculated functions must have precise linear expansions in the region where the probability distribution of their variables is the largest. Mathematically, this means that the linear terms of the final calculated functions around the nominal values of their variables should be much larger than the remaining higher-order terms over the region of significant probability (because such higher-order contributions are neglected).
For example, calculating x*10
with x
= 5±3 gives a perfect result since the calculated function is linear... Another example is sin(0+/-0.01)
, for which uncertainties
yields a meaningful standard deviation since the sine is quite linear over 0±0.01. However, cos(0+/-0.01)
, yields an approximate standard deviation of 0 because it is parabolic around 0 instead of linear; this might not be precise enough for all applications.
Here we provide a demonstration of how to use
Uncertainties to calculate the uncertainty values (error bars) for the data shown in Fig.
\ref{525200}).
First, import the data and assign values, including specification of uncertainties to the input parameters \(V_0\), \(V_1\), \(\theta_0\) and the data array \(\theta\).