Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 21 additions & 37 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ uncertainties

.. image:: https://readthedocs.org/projects/uncertainties/badge/?version=latest
:target: https://uncertainties.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://img.shields.io/pypi/v/uncertainties.svg
:target: https://pypi.org/project/uncertainties/
.. image:: https://pepy.tech/badge/uncertainties/week
Expand All @@ -13,29 +12,22 @@ uncertainties
.. image:: https://img.shields.io/github/actions/workflow/status/lmfit/uncertainties/python-package.yml?logo=github%20actions
:target: https://github.com/lmfit/uncertainties/actions/workflows/python-package.yml

``uncertainties`` allows **calculations** such as (2 +/- 0.1)*2 = 4 +/-
0.2 to be **performed transparently**. Much more complex mathematical
expressions involving numbers with uncertainties can also be evaluated
directly.

The ``uncertainties`` package **takes the pain and complexity out**
of uncertainty calculations.

**Detailed information** about this package can be found on its `main
website`_.
The ``uncertainties`` package allows calculations with values that have
uncertaintes, such as (2 +/- 0.1)*2 = 4 +/- 0.2. ``uncertainties`` takes the
pain and complexity out of error propagation and calculations of values with
uncertainties. For more information, see https://uncertainties.readthedocs.io/

Basic examples
--------------

.. code-block:: python

>>> from uncertainties import ufloat

>>> x = ufloat(2, 0.25)
>>> x
2.0+/-0.25

>>> square = x**2 # Transparent calculations
>>> square = x**2
>>> square
4.0+/-1.0
>>> square.nominal_value
Expand All @@ -46,37 +38,33 @@ Basic examples
>>> square - x*x
0.0 # Exactly 0: correlations taken into account

>>> from uncertainties.umath import * # sin(), etc.
>>> from uncertainties.umath import sin, cos # and many more.
>>> sin(1+x**2)
-0.95892427466313845+/-0.2836621854632263

>>> print (2*x+1000).derivatives[x] # Automatic calculation of derivatives
2.0

>>> from uncertainties import unumpy # Array manipulation
>>> random_vars = unumpy.uarray([1, 2], [0.1, 0.2])
>>> print random_vars
>>> varr = unumpy.uarray([1, 2], [0.1, 0.2])
>>> print(varr)
[1.0+/-0.1 2.0+/-0.2]
>>> print random_vars.mean()
>>> print(varr.mean())
1.50+/-0.11
>>> print unumpy.cos(random_vars)
>>> print(unumpy.cos(varr))
[0.540302305868+/-0.0841470984808 -0.416146836547+/-0.181859485365]

Main features
-------------

- **Transparent calculations with uncertainties**: **no or little
modification of existing code** is needed. Similarly, the Python_ (or
IPython_) shell can be used as **a powerful calculator** that
handles quantities with uncertainties (``print`` statements are
optional, which is convenient).
- **Transparent calculations with uncertainties**: Liittle or
no modification of existing code is needed to convert calculations of floats
to calculations of values with uncertainties.

- **Correlations** between expressions are correctly taken into
account. Thus, ``x-x`` is exactly zero, for instance (most
implementations found on the web yield a non-zero uncertainty for
``x-x``, which is incorrect).
account. Thus, ``x-x`` is exactly zero.

- **Almost all mathematical operations** are supported, including most
- **Most mathematical operations** are supported, including most
functions from the standard math_ module (sin,...). Comparison
operators (``>``, ``==``, etc.) are supported too.

Expand Down Expand Up @@ -112,12 +100,12 @@ Further details are in the `on-line documentation
Git branches
------------

The GitHub ``master`` branch is the latest development version. It should
represent a stable pre-release and should pass the tests, but will be more
experimental. Tagged releases will be available on GitHub, and correspond to
the releases to PyPI. The GitHub ``gh-pages`` branch will contain a stable
version of the documentation that can be viewed at
<https://lmfit.github.io/uncertainties/`_. Other Github branches should be
The GitHub ``master`` branch is the latest development version, and is intended
to be a stable pre-release version. It will be experimental, but should pass
all tests.. Tagged releases will be available on GitHub, and correspond to the
releases to PyPI. The GitHub ``gh-pages`` branch will contain a stable test version
of the documentation that can be viewed at
`<https://lmfit.github.io/uncertainties/>`_. Other Github branches should be
treated as unstable and in-progress development branches.


Expand All @@ -127,10 +115,6 @@ License
This package and its documentation are released under the `Revised BSD
License <LICENSE.txt>`_.

Voluntary donations
-------------------
If you find this open-source software useful (e.g. in saving you time or helping you produce
something valuable), please consider `donating $10 or more <https://www.paypal.com/donate/?cmd=_s-xclick&hosted_button_id=4TK7KNDTEDT4S>`_.

History
-------
Expand Down
6 changes: 1 addition & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ version = "3.2.1"
authors = [
{name = "Eric O. LEBIGOT (EOL)", email = "[email protected]"},
]
description = """\
Transparent calculations with uncertainties on the \
quantities involved (aka error propagation); \
fast calculation of derivatives').\
"""
description = "calculations with values with uncertainties, error propagation"
readme = "README.rst"
requires-python = ">=3.8"
keywords = [
Expand Down