6

edited

Given that the words "uncertain" and "uncertainty" are fairly ubiquitous, it's hard to Google "uncertainty arithmetic" and get anything immediately helpful. Thus, can anyone suggest a good library of routines, in almost any programming/scripting language, that implements handling of uncertain values, as per this description:

Use uncertainty arithmetic to record values that are approximations, for which there is a measured tolerance. This is when we are unsure about a value, but know the upper and lower bounds it can have, expressed as a ±value.

sigfpe
  • 7,996
  • 2
  • 27
  • 48
bugmagnet
  • 7,631
  • 8
  • 69
  • 131

7 Answers7

6

If you are looking for an error propagation module (this is different from interval arithmetic, but error propagation is what is commonly used by scientists), I would suggest that you have a look at my uncertainties Python module. It handles error/uncertainty propagation in a transparent way, and, contrary to many implementations, properly handles correlations between variables.

Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260
6

I believe "Interval Arithmetic" is the more common name for what you're looking for. boost::interval would be my first choice for a supporting library.

timday
  • 24,582
  • 12
  • 83
  • 135
3

for reference, as it's probably way too late for you, I'd suggest BIAS/Profil: http://www.ti3.tuhh.de/keil/profil/index_e.html

luneart
  • 182
  • 1
  • 8
  • In this case, it's never too late – bugmagnet Nov 15 '13 at 07:59
  • good then! its features in your case that I see as a user would be that BIAS is a C library, with some C++ features from Profil ; it accounts for computer numerical error ; if your errors are centered, direct access to nominal value ; vector of intervals for multidimensional analyses ; complete arithmetic included (usual operations with the spin of interval arithmetic on intervals, vectors, matrices) ; finally easy to get started with using the first pages of chapter3 of the documentation: a few warnings/informations, and tables of all operations for each type. – luneart Nov 15 '13 at 10:58
3

Have a look at Thomas Flanagan's Error Propagation Java class. The approach it uses is most excellent for handling uncertainty without excess trouble.

Joonas Pulakka
  • 36,252
  • 29
  • 106
  • 169
1

It's not a library, but your question reminded me of an example in "Expert F#" that describes probabilistic workflows:

instead of writing expressions to compute, say, integers, we instead write expressions that compute distributions of integers. This case study is based on a paper by Ramsey and Pfeffer from 2002.

You can read the excerpt on google books.

Kurt Schelfthout
  • 8,880
  • 1
  • 30
  • 48
1

I'd probably go about this by declaring a class called UncertainValue, with methods and properties such as (psuedocode):

class UncertainValue
{
  private double upperbound;
  private double lowerbound;
  private double nominalvalue;
  private double certainty;
  ...
  UncertainValue add(UncertainValue value);
  UncertainValue multiply(UncertainValue factor);
}

I realise this doesn't answer your question in terms of finding a pre-made library, sorry.

thomasrutter
  • 114,488
  • 30
  • 148
  • 167
0

INTLAB (INTerval LABoratory) is a well-known library for interval arithmetic and verified numerical linear algebra. It is based on MATLAB/Octave. You can download this library from here:

http://www.ti3.tu-harburg.de/rump/intlab/

kv library is an interval arithmetic library made by C++ and Boost C++ libraries. Multiple precision interval arithmetic is available. It also has a verified ODE solver.

http://verifiedby.me/kv/index-e.html

For other interval arithmetic libraries/software, check the following website:

http://www.cs.utep.edu/interval-comp/intsoft.html

Daisuke K
  • 9
  • 2