uncertainties

Transparent calculations with quantities with uncertainties (aka "error propagation")
Download

uncertainties Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Price:
  • FREE
  • Publisher Name:
  • Eric O. LEBIGOT
  • Publisher web site:
  • http://normalesup.org

uncertainties Tags


uncertainties Description

Transparent calculations with quantities with uncertainties (aka "error propagation") uncertainties is a Python module that allows calculation such as (0.2 +- 0.01)**2 = 0.04 +- 0.004 to be performed transparently.Correlations between expressions are correctly taken into account (x-x is exactly zero, for instance).Correlations between expressions are correctly taken into account (x-x is exactly zero, for instance).Basic examples:import uncertaintiesfrom math import * # Must be done *after* importing uncertainties# Mathematical operations:x = uncertainties.NumberWithUncert((0.20, 0.01)) # x = 0.20+-0.01x = uncertainties.NumberWithUncert("0.20(1)") # Other representationprint x**2 # Prints "0.04+-0.004"print sin(x**2) # Prints "0.0399...+-0.00399..."print x.position_in_sigmas(0.17) # Prints "-3.0": deviation of -3 sigmas# Access to the nominal value, and to the uncertainty:s = x**2 # Squareprint s # Prints "0.04+-0.004"print s.nominal_value # Prints "0.04"print s.std_dev() # Prints "0.004..."print s.derivatives # Partial derivative: prints "0.4" (= 2*0.20)print s - x*x # Exactly zero: correlations taken into accountThe Python (or IPython) shell can thus be used as a powerful calculator that handles quantities with uncertainties (print statements are optional, and all mathematical functions can for instance be imported with from math import * after importing this module with import uncertainties).Almost all mathematical operations are supported, including most functions from the standard math module and functions from the third-party numpy module (fast operations on arrays and matrices). Comparison operators (>, ==, etc.) are supported too. There is no restriction on the complexity of the expressions, or on the number of variables involved.Another possible use of this module is the calculation of partial derivatives of mathematical functions (see example above).More examples and additional information can be obtained with pydoc uncertainties after installation.Please send feature requests, bug reports, or feedback to the author.Installation: sudo easy_install uncertainties might work for you (this does not require any manual download). For additional installation methods, see README.txt in the provided file. Requirements: · Python What's New in This Release: · Number_with_uncert was renamed NumberWithUncert"


uncertainties Related Software