Skip to main content

Measurements are precise only up to a particular uncertainty. Such measurement results are thus called uncertain quantities. When performing calculations with uncertain quantities, the uncertainties of the results depend on the uncertainties of the operands involved. The quantification of uncertainties resulting from a mathematical operation involving uncertain operands is called uncertainty propagation.

From a programmer’s point of view, uncertainties might be associated with the respective nominal values, such that the propagation of uncertainties happens automatically, and existing algorithms can be re-used with the uncertain quantities as arguments. Here I am proposing a Python package to define uncertain operands, to carry out calculations using such operands with uncertainty propagation, and to provide string representations of uncertain quantities involved.

Complex numbers can be used to define uncertain quantities; for such complex-valued uncertainties no net uncertainty can be calculated.

The objects holding uncertain values have array properties, though scalar arrays can be used; elements of an uncertain array behave as if they were uncertain quantities on their own.

When requesting a string representation of an uncertain quantity, the typeset result depends on the number of standard deviations to use and on the chosen precision, given by the number of digits with respect to the uncertainty. Furthermore, when typesetting multidimensional arrays with uncertainty, the decimal fractions are aligned to improve readability of the results.

upy uses algorithmic differentiation (also known as automatic differentation) to track uncertainties through the operations. Uncertain values might be used in calculations together with other uncertain values as well as with any numeric Python or numpy.ndarray objects. A range of mathematical functions is supported.

upy provides several syntactic conventions appropriate to the subject. For instance, defining uncertain quantities is possible by writing:

uvalue = nominal +- u(uncertainty)

where u is a function provided by upy. Uncertain values constructed in this way will be independent of each other with respect to their uncertainties; upy will keep track of the correlations arising from combination of uncertain quantities in mathematical operations. All functionality is suited both for use in the interactive Python shell as well as in programs for numerical analysis.

Release files for upy2 2.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for upy2 2.4.0
File Size Uploaded
upy2-2.4.0.tar.gz 27.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for upy2 2.4.0
File Interpreter ABI Platform
upy2-2.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 62.1 kB

Release files / upy2-2.4.0.tar.gz

Download URL upy2-2.4.0.tar.gz
Size 27.5 kB
Tags Source
SHA-256 checksum
How to use checksums
51c7cb45227e72670bee06d89f323ad4d011723bcbbaab8ee33e3ffe3fa4cd74
BLAKE2b-256 checksum
How to use checksums
e0c7cd0b0197bfd061753a38c5e104c874394edcd63406e9f8d8c00590f0e3c7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release files / upy2-2.4.0-py3-none-any.whl

Download URL upy2-2.4.0-py3-none-any.whl
Size 34.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
037908cd30708a65beaf4cff1f7d4f0667ded433e6f2c4477b2e82d20360add7
BLAKE2b-256 checksum
How to use checksums
13d0fa29c638c589b37317d4aa285d683198f53cf96a54473ebdf87ca97fe546
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.2

Release history Release notifications | RSS feed

This release

2.4.0 This release

2 release files

2.3.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page