# How does the Around command at zero work?

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?

• 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)$.) Jun 7, 2019 at 4:16
• Fair point, I was imagining two uncorrelated values multiplied together. Jun 7, 2019 at 14:58
• @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:= Around[10, 1]^2, Out= Around[100., 20.] Jun 7, 2019 at 15:21
• I treat it as a bug. Jun 7, 2019 at 15:33
• @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. Jun 7, 2019 at 16:37

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]

For uncorrelated Around objects, use:

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


Around[0., 0.25]

• 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? Jun 6, 2019 at 20:06
• @zooby See update Jun 6, 2019 at 20:09
• Ah, yes, this is the result I would expect. (Not sure if my expectations are correct.) But this is what I had expected. Jun 6, 2019 at 20:11
• I had expected Around to model a normal distribution not just the first approximation of one. Jun 6, 2019 at 20:17
• @zooby: The problem with that expectation is that a non-linear function of two normally distributed variables is not in general normally distributed. Jun 7, 2019 at 1:53

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] 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.

• 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. Jun 6, 2019 at 20:01
• 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 Sqrt[δ^2]

a a a


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

a + a + a + a


4 x ± 2 Sqrt[δ^2]

• 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. Jun 6, 2019 at 4:57
• @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._
– kglr
Jun 6, 2019 at 5:06
• 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. Jun 6, 2019 at 5:09
• @zooby Around does support asymmetric errors. Jun 6, 2019 at 8:07