Sections
> Blog > Uncertainty Analysis

Uncertainty Analysis

I am working on the uncertainty analysis for the bicycle physical parameter measurements and was thinking about writing my own functions in python to handle partial derivatives of general functions. Most of the calcs are pretty easy except that I need to calculate the uncertainty of a least squares fit. I found an awesome python package that does most of what I need and it looks pretty slick.

His wrap() function isn't general enough to handle non-scalar inputs but he does have an implementation of an inverse of a matrix that works. Here's how it is used:

au = np.matrix(u.array_u(([[2, 1], [3, -1]], [[0.2, 0.1], [0.3, 0.1]])))
bu = u.array_u(([9, 16], [0.1, 0.1]))
xu = np.dot(au.I, bu)
print "numpy inv", xu   # Prints the result with uncertainties!

It turns out that numpy.matrix.I calculates the pseudo inverse for non-square matrices and this can be used to do least-squares with uncertainties too.

The code that I'm using the uncertainties package in is posted on my github page.

Wikipedia has a listing of uncertainty software (doesn't look like many options).