views:

245

answers:

5

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.

+1  A: 

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
+1  A: 

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
+2  A: 

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
+2  A: 

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
Bingo! Thanks very much.
boost
+1  A: 

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.

EOL