Skip to content

Around ​

A number x with an uncertainty dx, propagated to first order through arithmetic and functions -- the same uncertainty-arithmetic layer as Interval and CenteredInterval. Provided by @enumeratio/analytic, though the head's natural home is @enumeratio/statistics.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageAround!
Around(x, dx)x with uncertainty dx, propagated as Around(f(x), |f′(x)|·dx) through a function f.
Typed signatures
TypePackageApplies
(number, real?) -> numberanalyticalways

Domain: Interval arithmetic

Details
  • Add sums several independent uncertainties in quadrature (√Σdxᵢ²); a scalar Multiply scales the uncertainty linearly; several Around factors multiplied together combine their RELATIVE uncertainties in quadrature (the same rule, since d(∏xᵢ) = Σⱼ(∏_{i≠j}xᵢ)dxⱼ in quadrature, divided back out by the product); Power with a concrete exponent and Exp (Wolfram's Exp, canonicalized to Power(E, ·)) use their own closed-form derivatives.
  • Every other function -- the elementary heads, Log in any base, and the special functions -- takes f′ from compute-engine's symbolic D where it resolves, and from a central difference where it doesn't.
  • A head is propagated through as ONE function of its uncertain argument, before its own definition expands it: Multinomial(Around(2, 0.01), 2) is (a+2)(a+1)/2 at a = 2 ± 0.01, so 6 ± 0.035. Expanding first would count the same uncertainty in a numerator and a denominator as if they were independent.

Plot

Examples

2 more kept as data, checked against the oracles
Basic #

Independent uncertainties add in quadrature

live ↗
InAround(1,0.1)+Around(2,0.2)\mathrm{Around}(1, 0.1)+\mathrm{Around}(2, 0.2)OutAround(3,0.223 606 797 749 979)\mathrm{Around}(3, 0.223\,606\,797\,749\,979)

Scaling scales the uncertainty

live ↗
In3Around(2,0.1)3\mathrm{Around}(2, 0.1)OutAround(6,0.3)\mathrm{Around}(6, 0.3)

Independent uncertainties add in quadrature

live ↗
InAround(2,0.01)+Around(3,0.02)\mathrm{Around}(2, 0.01)+\mathrm{Around}(3, 0.02)OutAround(5,0.022 360 679 774 997 897)\mathrm{Around}(5, 0.022\,360\,679\,774\,997\,897)
live ↗
In3Around(2,0.01)3\mathrm{Around}(2, 0.01)OutAround(6,0.03)\mathrm{Around}(6, 0.03)

Independent uncertainties add in quadrature: 0.12+0.22\sqrt{0.1^2 + 0.2^2}

live ↗
InAround(5,0.1)+Around(3,0.2)\mathrm{Around}(5, 0.1)+\mathrm{Around}(3, 0.2)OutAround(8,0.223 606 797 749 979)\mathrm{Around}(8, 0.223\,606\,797\,749\,979)

Relative uncertainties combine: 6(0.1/2)2+(0.2/3)2=0.56\sqrt{(0.1/2)^2 + (0.2/3)^2} = 0.5

live ↗
InAround(2,0.1)Around(3,0.2)\mathrm{Around}(2, 0.1)\mathrm{Around}(3, 0.2)OutAround(6,0.5)\mathrm{Around}(6, 0.5)
Scope #

Through a function: ∣f′(x)∣ δx|f'(x)|\,\delta x

live ↗
InAround(2,0.1)2\mathrm{Around}(2, 0.1)^2OutAround(4,0.4)\mathrm{Around}(4, 0.4)
live ↗
InAround(4,0.4)\sqrt{\mathrm{Around}(4, 0.4)}OutAround(2,0.1)\mathrm{Around}(2, 0.1)

Through a function, to first order: f′(2)=3.5f'(2) = 3.5, so Multinomial(2±0.01,2)=6±0.035\mathrm{Multinomial}(2 \pm 0.01, 2) = 6 \pm 0.035

live ↗
InMultinomial(Around(2,0.01),2)\mathrm{Multinomial}(\mathrm{Around}(2, 0.01), 2)OutAround(6,0.035)\mathrm{Around}(6, 0.035)

A power scales the uncertainty by the derivative, 2⋅3⋅0.12 \cdot 3 \cdot 0.1

live ↗
InAround(3,0.1)2\mathrm{Around}(3, 0.1)^2OutAround(9,0.600 000 000 000 000 1)\mathrm{Around}(9, 0.600\,000\,000\,000\,000\,1)

0.224\frac{0.2}{2\sqrt4}

live ↗
InAround(4,0.2)\sqrt{\mathrm{Around}(4, 0.2)}OutAround(2,0.05)\mathrm{Around}(2, 0.05)

An exact factor scales the uncertainty

live ↗
In10Around(1.5,0.02)10\mathrm{Around}(1.5, 0.02)OutAround(15,0.2)\mathrm{Around}(15, 0.2)

Through an elementary function: δ⋅e2\delta \cdot e^2

live ↗
IneAround(2,0.01)e^{\mathrm{Around}(2, 0.01)}OutAround(7.389 056 098 930 65,0.073 890 560 989 306 5)\mathrm{Around}(7.389\,056\,098\,930\,65, 0.073\,890\,560\,989\,306\,5)

Through a special function, with its derivative as slope

live ↗
Inerf⁡(Around(2,0.01))\operatorname{erf}(\mathrm{Around}(2, 0.01))OutAround(0.995 322 265 018 952 7,0.000 206 669 853 540 920 54)\mathrm{Around}(0.995\,322\,265\,018\,952\,7, 0.000\,206\,669\,853\,540\,920\,54)

First-order propagation: the uncertainty scales by ∣cos⁡1∣|\cos 1|

live ↗
InN(sin⁡(Around(1,0.1)))N(\sin(\mathrm{Around}(1, 0.1)))OutAround(0.841 470 984 807 896 5,0.054 030 230 586 813 98)\mathrm{Around}(0.841\,470\,984\,807\,896\,5, 0.054\,030\,230\,586\,813\,98)
live ↗
Inln⁡(Around(2,0.01))\ln(\mathrm{Around}(2, 0.01))OutAround(0.693 147 180 559 945 3,0.005)\mathrm{Around}(0.693\,147\,180\,559\,945\,3, 0.005)
live ↗
InAround(2121,1919)\mathrm{Around}(21^{21}, 19^{19})OutAround(5 842 587 018 385 982 521 381 124 421,1 978 419 655 660 313 589 123 979)\mathrm{Around}(5\,842\,587\,018\,385\,982\,521\,381\,124\,421, 1\,978\,419\,655\,660\,313\,589\,123\,979)
Properties #

Squaring an uncertain value: the error doubles with the value, 2⋅10⋅1=202\cdot10\cdot1 = 20

live ↗
InAround(10,1)2\mathrm{Around}(10, 1)^2OutAround(100,20)\mathrm{Around}(100, 20)
About
Examples20
Checked againstWolfram Language 17 agree3 differ
CrosswalkWolfram Language

Implementation

mappedsympypackages/oracle/src/mappings.ts

SymPy has no value with an uncertainty, nor first-order propagation through arithmetic (that is the separate uncertainties package, not SymPy), so there is nothing for an Around row to run on; sympy.stats is probabilistic, not error propagation.

See also: Interval, CenteredInterval