13
$\begingroup$

I enter:

Around[0,0.5]^2

and I get 0.

This is a bit strange. Around[0,0.5] is supposed to represent numbers between -0.5 and 0.5. So by my estimates the square should be Around[0,0.25].

Can someone explain the logic here? It just seems wrong to me. The correct answer should be:

$$(0\pm 0.5)^2 = 0\pm 0.25$$

(edit: assuming two uncorrelated values multiplied together)

It only makes sense if $\delta$ is very small e.g:

$$(0 \pm 0.00001)^2 \approx 0.000000$$

But by what scale are we judging the smallness?

$\endgroup$
6
  • 1
    $\begingroup$ The interval $[-0.5,0.5]$, which you are representing as "$0 \pm 0.5$" does not square to $[-0.25, 0.25]$ (your "$0 \pm 0.25$") because the resulting interval must be non-negative. It squares to $[0,0.25]$. (If we imagine these are open intervals, $(-0.5, 0.5)$ squares to $[0,0.25)$.) $\endgroup$ Jun 7, 2019 at 4:16
  • $\begingroup$ Fair point, I was imagining two uncorrelated values multiplied together. $\endgroup$
    – zooby
    Jun 7, 2019 at 14:58
  • 1
    $\begingroup$ @zooby Why didn't you look in the tutorial? There everything is clearly defined and an example is given: Square an Around object, using a first-order series approximation: In[1]:= Around[10, 1]^2, Out[1]= Around[100., 20.] $\endgroup$ Jun 7, 2019 at 15:21
  • $\begingroup$ I treat it as a bug. $\endgroup$
    – user64494
    Jun 7, 2019 at 15:33
  • 1
    $\begingroup$ @user64494 : As noted in Around's documentation, "[t]wo different instances of the same Around object are assumed to be uncorrelated". There is only one instance of Around in Around[...]^2. And this has correct semantics: the square of an approximately known number is always nonnegative. You would require two uncorrelated approximately known numbers to permit a negative product. $\endgroup$ Jun 7, 2019 at 16:37

3 Answers 3

22
$\begingroup$

The first order approximation to Around[0, .5]^2 is 0. If you want higher order approximations, you can use AroundReplace. For example, the second order approximation is:

AroundReplace[s^2, s->Around[0,.5], 2]

Around[0.25, 0.3535533905932738]

Addendum

For uncorrelated Around objects, use:

AroundReplace[s t, {s->Around[0,.5], t->Around[0,.5]}, 2]

Around[0., 0.25]

$\endgroup$
7
  • $\begingroup$ Well this is the result if you are measuring one quantity and squaring it. But what if you were measuring two quantities both with uncertainty 0.5 around 0? $\endgroup$
    – zooby
    Jun 6, 2019 at 20:06
  • $\begingroup$ @zooby See update $\endgroup$
    – Carl Woll
    Jun 6, 2019 at 20:09
  • $\begingroup$ Ah, yes, this is the result I would expect. (Not sure if my expectations are correct.) But this is what I had expected. $\endgroup$
    – zooby
    Jun 6, 2019 at 20:11
  • $\begingroup$ I had expected Around to model a normal distribution not just the first approximation of one. $\endgroup$
    – zooby
    Jun 6, 2019 at 20:17
  • 1
    $\begingroup$ @zooby: The problem with that expectation is that a non-linear function of two normally distributed variables is not in general normally distributed. $\endgroup$ Jun 7, 2019 at 1:53
18
$\begingroup$

Around works based on the error propagation rules used in physics (and I assume other sciences) where we add errors in quadrature. If we want to know the total amount of error in a formula, we can take the root of the sum of the squares of the partial derivatives.

So if we have some formula $f(x, y) = x y$, then $\delta f = \sqrt{\left(\frac{\partial f}{\partial x}\delta x\right)^2+\left(\frac{\partial f}{\partial y}\delta y\right)^2} = \sqrt{y^2 \delta x^2 + x^2 \delta y^2}$ (where I use $\delta variable$ to mean the uncertainty in that variable. In the case of $f(x) = x^2$, this simplifies to $\sqrt{2x^2\delta x^2}$.

We can check that Around is working in the same way (here I use dvar to mean the uncertainty in a value):

Around[x, dx] Around[y, dy]
Around[x, dx]^2
Around[x, dx] Around[x, dx]

Results of using Around

The second and third results look slightly different, but are identical. Essentially, you can't get away from multiplying zero into your result at some point, which causes the whole thing to be zero.

Anyways, that's the formula that Around is using. That might suck for whatever application you need it for, but I can assure you that it's really nice for uncertainty propagation, and it's also nice that plots can automatically create error bars based on Around numbers.

If you need the higher order expansion, Carl Woll's answer should work for you. Also, if you need to specify asymmetric uncertainties, you can use Around[0, {-0.2, 0.3}], and again MMA will take care of the propagation in a similar manner.

$\endgroup$
1
  • 1
    $\begingroup$ But what does it mean when it says that $(0\pm 0.5)^2=0$ ? What is the physical meaning? Because the formulas don't match with actual experiment. If the true value of the quantity is 0.3 (within the error bar) then the square of this is not zero. It might be "nice to work with" but it doesn't make sense. $\endgroup$
    – zooby
    Jun 6, 2019 at 20:01
10
$\begingroup$

Around:

  • Two different instances of the same Around object are assumed to be uncorrelated:
a = Around[x, δ]

a^2

Around[x^2, 2 Abs[x δ]]

With x = 0 we get Around[0, 0] (giving 0 since Around[x,0] is taken as 0.)

a+a

2 x ± Sqrt[2] Sqrt[δ^2]

a a a

x^3 ± Sqrt[3] Sqrt[x^4 δ^2]

a + a + a + a

4 x ± 2 Sqrt[δ^2]

$\endgroup$
4
  • $\begingroup$ I still don't get it. Even if they are uncorrelated what if I get 0.3 from the first around and 0.2 from the second. It still doesn't give me zero. I don't understand where the formula for Around products comes from. $\endgroup$
    – zooby
    Jun 6, 2019 at 4:57
  • 1
    $\begingroup$ @zooby, can you clarify "if I get 0.3 from the first around and 0.2 from the second. It still doesn't give me zero"? Re the formula, if it is of any help, Around >>Details says "When Around is used in computations, uncertainties are by default propagated using a first-order series approximation, assuming no correlations._ $\endgroup$
    – kglr
    Jun 6, 2019 at 5:06
  • 2
    $\begingroup$ Well if the actual answer is 0.3 but the experimental answer is 0+/- 0.5 for example. 0.3 is within the margin of error. But if you square that you don't get 0. Seems like a mistake due to Around not being able to support asymmetric errors. $\endgroup$
    – zooby
    Jun 6, 2019 at 5:09
  • $\begingroup$ @zooby Around does support asymmetric errors. $\endgroup$
    – MassDefect
    Jun 6, 2019 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.