errorcalculus 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,130 @@
1
+ Metadata-Version: 2.4
2
+ Name: errorcalculus
3
+ Version: 0.1.0
4
+ Summary: Bouleau's error calculus for Python: error variances (Γ) and biases (A) propagated through computations
5
+ Author: Victor Rabiet
6
+ License-Expression: BSD-3-Clause
7
+ Project-URL: Documentation, https://errorcalculus.readthedocs.io
8
+ Project-URL: Repository, https://github.com/HubHubHubHubHub/errorcalculus
9
+ Project-URL: Issues, https://github.com/HubHubHubHubHub/errorcalculus/issues
10
+ Project-URL: Changelog, https://github.com/HubHubHubHubHub/errorcalculus/blob/main/CHANGELOG.md
11
+ Keywords: error calculus,uncertainty propagation,error propagation,bias,second order,Dirichlet forms,measurement uncertainty
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
15
+ Classifier: Topic :: Scientific/Engineering :: Physics
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.24
28
+ Provides-Extra: scipy
29
+ Requires-Dist: scipy; extra == "scipy"
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=7; extra == "test"
32
+ Requires-Dist: hypothesis; extra == "test"
33
+ Requires-Dist: sympy; extra == "test"
34
+ Requires-Dist: mpmath; extra == "test"
35
+ Requires-Dist: scipy; extra == "test"
36
+ Provides-Extra: parity
37
+ Requires-Dist: uncertainties>=3.2; extra == "parity"
38
+ Requires-Dist: soerp>=1.0.1; extra == "parity"
39
+ Requires-Dist: GTC>=1.5; extra == "parity"
40
+ Requires-Dist: folx>=0.2; extra == "parity"
41
+ Requires-Dist: jax; extra == "parity"
42
+ Provides-Extra: docs
43
+ Requires-Dist: sphinx>=8; extra == "docs"
44
+ Requires-Dist: furo; extra == "docs"
45
+ Requires-Dist: myst-parser>=4; extra == "docs"
46
+ Dynamic: license-file
47
+
48
+ # errorcalculus
49
+
50
+ **Bouleau's error calculus for Python.** errorcalculus propagates the *error variance* Γ (the quadratic error) and,
51
+ at second order, the *bias* A of quantities through a computation, exactly in the sense of the chain rule, at the
52
+ nominal values. It follows the error calculus of N. Bouleau (*Error Calculus for Finance and Physics: The Language of
53
+ Dirichlet Forms*, de Gruyter, 2003), in which Γ and A are two operators with their own calculus: a C² function F of
54
+ quantities x₁, …, xₙ satisfies
55
+
56
+ ```
57
+ F♯ = Σᵢ ∂ᵢF · xᵢ♯ (the "sharp": a linear error)
58
+ Γ[F] = Σᵢⱼ ∂ᵢF ∂ⱼF Γ[xᵢ, xⱼ]
59
+ A[F] = Σᵢ ∂ᵢF A[xᵢ] + ½ Σᵢⱼ ∂ᵢⱼF Γ[xᵢ, xⱼ]
60
+ ```
61
+
62
+ > **Status: 0.1.0, alpha.** This is the first layer of the library (finite dimension). The API of the 0.x series is
63
+ > not stable: names and signatures may still change, and every change is listed in the [changelog](https://github.com/HubHubHubHubHub/errorcalculus/blob/main/CHANGELOG.md).
64
+
65
+ ## Install
66
+
67
+ ```sh
68
+ python -m pip install errorcalculus
69
+ ```
70
+
71
+ Python 3.10 or later; NumPy is the only dependency (SciPy is used when present, for vectorised `erf`/`erfc`).
72
+
73
+ ## A first computation
74
+
75
+ The order of the calculus is explicit: `order=1` propagates error variances only (Gauss); `order=2` propagates error
76
+ variances and biases.
77
+
78
+ ```python
79
+ import errorcalculus as ec
80
+
81
+ m = ec.Model(order=2)
82
+ x = m.input(2.0, std=0.1, bias=0.01, name="x")
83
+ y = m.input(3.0, std=0.2, name="y") # no bias declared: assumed zero, and reported
84
+
85
+ f = x * ec.exp(y / 10)
86
+ print(f) # 2.6997176151520064 ± 0.1453842429031768 [bias 0.014038531598790434]
87
+ print(f.gamma) # Γ[f], the error variance of f (not the variance of f)
88
+ print(dict(f.sharp)) # {'x': 0.13498588075760032, 'y': 0.05399435230304014}
89
+ print(ec.contributions(f)) # Γ[f] split by input
90
+ print(f.summary(scale=1.0)) # ... (bias assumed zero for: y)
91
+ ```
92
+
93
+ In a first-order model, asking for a bias raises `FirstOrderError` instead of returning 0 or `None`: Gauss's calculus
94
+ excludes biases by construction, and the library says so.
95
+
96
+ ## What is in 0.1.0
97
+
98
+ - `Model`, `Quantity`, `QuantityArray`: independent and correlated inputs (Cholesky, or a spectral factorisation for
99
+ singular covariances), NumPy arrays of quantities, 23 elementary functions with their domain rules, linear algebra
100
+ (`errorcalculus.linalg.solve`, `inv`, `det`);
101
+ - user functions: `wrap` (with given or numerical derivatives, checked by step halving) and `sensitivities` (exact
102
+ gradient and Hessian);
103
+ - readings: `gamma`, `covariance_matrix`, `correlation_matrix`, `contributions` (of the error variance, and of the
104
+ bias by source), `summary(scale=s)` with s = ε² (Bouleau's gauge);
105
+ - `BiasOperator`: the bias operator L as an operator on functions, the identity Γ(φ, ψ) = L(φψ) − φL(ψ) − ψL(φ), and
106
+ its transport by a diffeomorphism;
107
+ - `compare_methods`: the same model computed by several methods (error calculus, first order, sensitivities, sigma
108
+ points, Monte Carlo, second-order Taylor moments), side by side.
109
+
110
+ Every guarantee is tested; the register of the 24 guarantees, each with its test file, is
111
+ [docs/GUARANTEES.md](https://github.com/HubHubHubHubHub/errorcalculus/blob/main/docs/GUARANTEES.md).
112
+
113
+ ## Relation to other libraries
114
+
115
+ The propagation engine is the forward recursion of value, gradient and Laplacian known as the *Forward Laplacian*
116
+ (R. Li et al., 2023, arXiv:2307.08214), here applied to error variances and biases; it is cited, not claimed. The
117
+ first-order part covers what `uncertainties` and GTC compute, and the second-order moments are those of soerp and of
118
+ R `propagate`. The test suite checks parity with `uncertainties`, GTC, soerp and folx (guarantee G15).
119
+
120
+ ## Documentation
121
+
122
+ <https://errorcalculus.readthedocs.io>
123
+
124
+ ## Contributing, support
125
+
126
+ See [CONTRIBUTING.md](https://github.com/HubHubHubHubHub/errorcalculus/blob/main/CONTRIBUTING.md). Questions and reports: <https://github.com/HubHubHubHubHub/errorcalculus/issues>.
127
+
128
+ ## License
129
+
130
+ BSD-3-Clause ([LICENSE](https://github.com/HubHubHubHubHub/errorcalculus/blob/main/LICENSE)).
@@ -0,0 +1,15 @@
1
+ errorcalculus/__init__.py,sha256=1F2ayIglq3QvO6DjmjybX3KXqLtgiW6ibqnxbUtxli8,550
2
+ errorcalculus/_array.py,sha256=F2QtLJ8b5-arNNp27ncpxph25BosrPmsvqAyO57rw6k,44229
3
+ errorcalculus/_core.py,sha256=i0pBM6DAfNuZf94BPtkMEVJlQaboNr9zbQTYwKO6xS4,55559
4
+ errorcalculus/_functions.py,sha256=pjO7ffDRER99h5U_bBywi4xkP_hG1mrVWUNJigSHqYg,16962
5
+ errorcalculus/_rules.py,sha256=jLOChw6Y3yMw0fP6er7msoIVcBOHWflmqI6fCQ2WGAU,7182
6
+ errorcalculus/calculus.py,sha256=eA4PCCJSkQpPkCuNAX9Svi_seYjijukNYwF-q-HbDMs,2577
7
+ errorcalculus/compare.py,sha256=4-a4pgLZGb83O4SsflZFPfSoZ7sfUId3xveANaO5I6o,30364
8
+ errorcalculus/errors.py,sha256=q5RDVgv6MT7svNQMpT-bcrMWP5goluXG2qWcpqr0Fcc,3497
9
+ errorcalculus/linalg.py,sha256=dVZJ3dFu60qkCkouqNNC4IXBrhppCQE08YRIj1SOnC4,12037
10
+ errorcalculus/operators.py,sha256=KAYLIG4nvDiM94z9ECaYChxSEyqIUKJv4wfdzesO1Xw,9032
11
+ errorcalculus-0.1.0.dist-info/licenses/LICENSE,sha256=qyeb1Qw8AOw04ge50UA7qAe-hAodT2TQffg2tbvYhzg,1500
12
+ errorcalculus-0.1.0.dist-info/METADATA,sha256=kRpSHT_Zdj0B7tAr0a3aQ9g1JnxPsF4lFZAqdeCQ3h0,6264
13
+ errorcalculus-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
14
+ errorcalculus-0.1.0.dist-info/top_level.txt,sha256=jUKGTyDeyO1ieotOGRv9LV4LMIc3FnYbIWSNQtzZsmw,14
15
+ errorcalculus-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Victor Rabiet
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1 @@
1
+ errorcalculus