1 """
2 Utilities for NumPy arrays and matrices that contain numbers with
3 uncertainties.
4
5 This package contains:
6
7 1) utilities that help with the creation and manipulation of NumPy
8 arrays and matrices of numbers with uncertainties;
9
10 2) generalizations of multiple NumPy functions so that they also work
11 with arrays that contain numbers with uncertainties.
12
13 - Arrays of numbers with uncertainties can be built as follows:
14
15 arr = unumpy.uarray(([1, 2], [0.01, 0.002])) # (values, uncertainties)
16
17 NumPy arrays of numbers with uncertainties can also be built directly
18 through NumPy, thanks to NumPy's support of arrays of arbitrary objects:
19
20 arr = numpy.array([uncertainties.ufloat((1, 0.1)),...])
21
22 - Matrices of numbers with uncertainties are best created in one of
23 two ways:
24
25 mat = unumpy.umatrix(([1, 2], [0.01, 0.002])) # (values, uncertainties)
26
27 Matrices can also be built by converting arrays of numbers with
28 uncertainties, through the unumpy.matrix class:
29
30 mat = unumpy.matrix(arr)
31
32 unumpy.matrix objects behave like numpy.matrix objects of numbers with
33 uncertainties, but with better support for some operations (such as
34 matrix inversion):
35
36 # The inverse or pseudo-inverse of a unumpy.matrix can be calculated:
37 print mat.I # Would not work with numpy.matrix([[ufloat(...),...]]).I
38
39 - Nominal values and uncertainties of arrays can be directly accessed:
40
41 print unumpy.nominal_values(arr) # [ 1. 2.]
42 print unumpy.std_devs(mat) # [ 0.01 0.002]
43
44 - This module defines uncertainty-aware mathematical functions that
45 generalize those from uncertainties.umath so that they work on NumPy
46 arrays of numbers with uncertainties instead of just scalars:
47
48 print unumpy.cos(arr) # Array with the cosine of each element
49
50 NumPy's function names are used, and not those of the math module (for
51 instance, unumpy.arccos is defined, like in NumPy, and is not named
52 acos like in the standard math module).
53
54 The definitions of the mathematical quantities calculated by these
55 functions are available in the documentation of uncertainties.umath.
56
57 - The unumpy.ulinalg module contains more uncertainty-aware functions
58 for arrays that contain numbers with uncertainties (see the
59 documentation for this module).
60
61 This module requires the NumPy package.
62
63 (c) 2009-2010 by Eric O. LEBIGOT (EOL) <eric.lebigot@normalesup.org>.
64 Please send feature requests, bug reports, or feedback to this address.
65
66 This software is released under a dual license. (1) The BSD license.
67 (2) Any other license, as long as it is obtained from the original
68 author."""
69
70
71 from core import *
72 import core
73 import ulinalg
74
75
76
77
78 __all__ = core.__all__
79
80
81 __all__.append('ulinalg')
82