Skip to main content

Transparent calculations with uncertainties on the quantities involved (aka "error propagation") ; calculation of derivatives

Project description

``uncertainties`` 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).

Basic examples::

# Mathematical operations:
x = uncertainties.Number_with_uncert((0.20, 0.01)) # x = 0.20+-0.01
x = uncertainties.Number_with_uncert("0.20(1)") # Other representation
print x**2 # Prints "0.04+-0.004"
print math.sin(x**2) # Prints "0.0399...+-0.00399..."

# Access to the value at the origin, and to the uncertainty:
y = x**2
print y # Prints "0.04+-0.004"
print y.origin_value # Prints "0.04"
print y.std_dev() # Prints "0.004..."

print y.derivatives[x] # Partial derivative: prints "2"

print y - x*x # Exactly zero: correlations taken into account

**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).
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.

More examples and additional information can be obtained with ``pydoc
uncertainties`` after installation.

Please send feature requests, bug reports, or compliments to the author.
.. _numpy: http://numpy.scipy.org/

Project details


Release history Release notifications | RSS feed

This version

1.0.2

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uncertainties-1.0.2.tar.gz (21.8 kB view details)

Uploaded Source

File details

Details for the file uncertainties-1.0.2.tar.gz.

File metadata

  • Download URL: uncertainties-1.0.2.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for uncertainties-1.0.2.tar.gz
Algorithm Hash digest
SHA256 7c312985ae499c01f8a4c99c2d12c00c3759efb9fc354d36f71c3f04b8d067a6
MD5 7c4eefe6a1bd7970b6c9bc54256cfd1f
BLAKE2b-256 571a90c22b214feb725c06197b1af70ae6221dc6e8f071b6951b454053ceab30

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page