python3-scinum

2014-03-27 19:21 UTC
  • Xyne

Metadata

Description:

A collection of scientific number classes for arbitrary precision, standard and custom units, and uncertainty for measured values.

Latest Version:

2012.12

Architecture:

  • any

Dependencies:

  • python3

Arch Repositories:

  • [xyne-any]
  • [xyne-i686]
  • [xyne-x86_64]

AUR ID:

63993

Arch Forum ID:

151525

Tags:

About

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:

DecimalWithUnits

The standard Decimal type with support for arbitrary units.

MeasuredDecimal

A numerical object that internally tracks its own precision and thus currectly represents significant figures in output.

MeasuredDecimalWithUnits

This is just MeasuredDecimal with support for arbitrary units.

UncertainDecimal

A numerical object that tracks its upper and lower bounds through all operations and thus represents the range within one can expect to find the value.

UncertainDecimalWithUnits

This is just UncertainDecimal with support for arbitrary units.

Modules

SciNum.decimal

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.

SciNum.units

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.

SciNum.number

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.

Usage

See the examples on this page and the python3-nist page. Most if not all of the code has help text and useful comments.

Stability

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.

CHANGELOG

2012-10-31

  • added basic support for siunitx string generation from units (MeasuredDecimal and UncertainDecimal are not yet supported)
Contact
echo xyne.archlinux.ca | sed 's/\./@/'
Feeds
Blog News
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0