Description: | A collection of scientific number classes for arbitrary precision, standard and custom units, and uncertainty for measured values. |
Latest Version: | 2021 |
Source Code: | src/ |
Architecture: |
|
Dependencies: |
|
Build Dependencies: |
|
Arch Repositories: |
|
AUR Page: | python3-scinum |
Arch Forum Thread: | 151525 |
Tags: |
SciNum is a collection of classes and functions for working with scientific numbers in Python. Numerical values are represented internally using Decimal object. These are provided by the standard module decimal, which is Python’s implementation of the General Decimal Arithmetic Specification. That module provides context objects than can be used to determine the precision and behavior of arithmetic operations in different cases.
SciNum provides several classes that encapsulate the Decimal object:
A wrapper around the decimal module that adds includes several of the recipes from the module’s homepage along with some convenience functions for extracting data from decimals.
The Unit
class is used to represent arbitrary units. The
module includes several functions for expressing given units in terms of
arbitrary units and manipulating unit prefixes. Support is provided for
SI units by default, but extension to any system of units should be
straight-forward.
The module also provides a class named WithUnits
that
can be used to add units to any numerical value. This is how
MeasuredDecimalWithUnits
and
UncertainDecimalWithUnits
have been declared.
The declarations of the numerical classes, and functions for working with and interconverting them are located here. Most of the code is dedicated to managing properties across arithmetic operations.
See the examples on this page and the python3-nist page. Most if not all of the code has help text and useful comments.
The code is still fresh and not extensively tested. The internals will likely change a bit as everything settles, so consider this experimental for now. Keep a local copy if you come to rely on this for your own applications.