Measurements.jl

Measurements.jl is a package that allows you to define numbers with uncertainties, perform calculations involving them, and easily get the uncertainty of the result according to linear error propagation theory. This library is written in Julia, a modern high-level, high-performance dynamic programming language designed for technical computing.

When used in the Julia interactive session, it can serve also as an easy-to-use calculator.

The main features of the package are:

  • Support for most mathematical operations available in Julia standard library involving real and complex numbers. All existing functions that accept AbstractFloat (and Complex{AbstractFloat} as well) arguments and internally use already supported functions can in turn perform calculations involving numbers with uncertainties without being redefined. This greatly enhances the power of Measurements.jl without effort for the users
  • Functional correlation between variables is correctly handled, so \(x - x \approx 0 \pm 0\), \(x/x \approx 1 \pm 0\), \(\tan(x) \approx \sin(x)/\cos(x)\), \(\mathrm{cis}(x) \approx \exp(ix)\), etc...
  • Support for arbitrary precision (also called multiple precision) numbers with uncertainties. This is useful for measurements with very low relative error
  • Define arrays of measurements and perform calculations with them. Some linear algebra functions work out-of-the-box
  • Propagate uncertainty for any function of real arguments (including functions based on C/Fortran calls), using @uncertain macro
  • Functions to get the derivative and the gradient of an expression with respect to one or more independent measurements
  • Functions to calculate standard score and weighted mean
  • Parse strings to create measurement objects
  • Easy way to attach the uncertainty to a number using the ± sign as infix operator
  • Combined with external packages allows for error propagation of measurements with their physical units

Further features are expected to come in the future, see the “How Can I Help?” section and the TODO list.

The Measurements.jl package is licensed under the MIT “Expat” License. The original author is Mosè Giordano.