TLDR question:

How to redefine Around to work with higher order approximation.


From the documentation

Around represents an approximate number or quantity with a value an uncertainty. When Around is used in computations, uncertainties are by default propagated using a first-order series approximation, assuming no correlations.

First order is a common choice approximation when the magnitude of the error is very small and such approximation is valid.

But a first order approximation gives misleading results for large errors, specially for functions with asymmetries in the derivative, where one expects the error to be asymmetric.

I argue that Mathematica should not make a priori assumptions about the magnitude of the error. Around should not be limited to small error cases, but work in general.Therefore limiting Around to first order is a poor choice and we need, at least as an option, higher order approximation when the errors are significant in magnitude.

The question

I would like to profit from all the nice ways Around is interpreted by Mathematica, including ListPlot error bars and error propagation, but working at higher orders.

I would expect

(* The magic here *)
Exp[Around[0, 1, "Order" -> 3]]
Around[1., {0.6666666666666667, 1.6666666666666665`}]

Instead of

Exp[Around[0, 1]]
Around[1., 1.]

Edit: Probably Around[0, 1, "Order" -> 3] is too problematic (As per the comment by @MichaelE2). It may be better this other form

Block[{$ErrorPropagationOrder=3}, Exp[Around[0, 1]]]

Can we redefine Around and fix it?

  • 1
    $\begingroup$ Shouldn't the output be Around[1., {0.6666666666666667, 1.6666666666666665`}, "Order" -> 3] so that the order is propagated throughout the steps of a computation? $\endgroup$
    – Michael E2
    Commented Aug 27, 2020 at 14:17
  • $\begingroup$ @MichaelE2 Yes, you are correct, unless the order is stored in some other way. It would be Ok if is was variable $ErrorPropagationOrder=3 or some other idiomatic way. $\endgroup$
    – rhermans
    Commented Aug 27, 2020 at 14:30
  • $\begingroup$ I don't know why you think that the first order approximation only works when the variability is small. From the online manual: "For linear computations, Around[x,[Delta]] behaves like a number whose values are distributed according to the normal distribution NormalDistribution[x,[Delta]]." There's nothing that restricts the size of delta to be small. It's when a transformation such as Exp leads to non-symmetric distributions of the error that plus-or-minus one standard deviation isn't a very good descriptor. $\endgroup$
    – JimB
    Commented Aug 28, 2020 at 5:55
  • $\begingroup$ @Jim Around "works" for large errors only in the sense that returns a number, not in in the sense that the values that returns makes a reasonable approximation of the error propagation. $\endgroup$
    – rhermans
    Commented Aug 29, 2020 at 7:12
  • 2
    $\begingroup$ For propagating error one might use 'Interval'. It won't format like 'Around' though. $\endgroup$ Commented Aug 29, 2020 at 15:54

3 Answers 3


Perhaps AroundReplace may be useful for this:

AroundReplace[Exp[s], s->Around[0, 1], 3]

Around[1.5, 1.707825127659933]

  • $\begingroup$ Thanks, indeed that gets closer. But shouldn't the error be asymmetric? Particularly Around[1., {0.6666666666666667, 1.6666666666666665}]`? $\endgroup$
    – rhermans
    Commented Aug 29, 2020 at 7:32

I’ve completely rewritten my answer to suggest that prior to the “enhancement” of Around more examples of what those enhancements might be are needed and that higher orders of approximation aren’t necessarily needed depending on the specifics of what is desired.

Consider that $X$ has a normal distribution with uncertainty $\delta$. In Mathematica this is stored as

Around[x, δ]

This represents x and the interval x-δ, x+δ} which contains a percentage 100 p of a normal distribution with mean x and standard deviation σ such that there is 100(1-p)/2 in each tail. This is known as the central 100p% of the distribution. To determine p one needs to know that δ represents.

If δ is the value of the standard deviation, then

p = CDF[NormalDistribution[],1]-CDF[NormalDistribution[],-1]

which equals 1/2 Erfc[1/Sqrt[2]] and is approximately 0.682689.

But now say we’re interested in Exp[x]. If Around were to be enhanced, what should the result from Exp[Around[x, δ]] be?

I would think that one should end up with Exp[x] and an interval that has the same central percentage. That would result in asymmetrical uncertainties (using Mathematica terms in the documentation) with the lower bound in the interval being Exp[x-δ] and the upper bound being Exp[x+δ]. That makes the asymmetrical uncertainties as

{Exp[x - δ] (Exp[δ] - 1), Exp[x] (Exp[δ] - 1)}

The lower bound will never be less than 0.

This can be achieved with the helper function:

expAround[x_, δ_] := Around[Exp[x], {Exp[x - δ] (Exp[δ] - 1), Exp[x] (Exp[δ] - 1)}]

Using your example,

expAround[0, 1]

Result of expAround[0, 1]

expAround[0, 1]["Interval"]
(* Interval[{0.367879, 2.71828}] *)

There is (essentially) no restriction on size of δ. Nor is there any need for any higher order derivatives to be involved: The observation is transformed directly and the same central percentage is kept. Such a function would be a part of an enhanced Around function.

Why aren’t higher order terms needed for this result? The higher order options with AroundReplace sometimes change the transformed value and I suspect that is an attempt to get an unbiased estimate of the mean. But it’s not necessarily the mean that one has interest. There’s nothing wrong with the median. But in any event the issue is that the documentation simply states that the transformed value might not be what you expect with higher orders. Much more explanation in the documentation is necessary.

I understand that the function defined above does not directly address your question. I'm just suggesting that the resulting enhancements be made more explicit and that would need to start with the Mathematica documentation.

  • $\begingroup$ As much as I appreciate you considerable effort and good disposition, expAround[0, 1] does not return the requested output. This answer is ad hoc the particular example, not a general modification of Around for higher order approximations. $\endgroup$
    – rhermans
    Commented Aug 29, 2020 at 7:39
  • 1
    $\begingroup$ I understand that I didn't answer the question. My concern is that with transformations that always result in non-negative numbers, it is the lack of symmetry that causes problems when the standard deviation is large. In other words the standard deviation is not a good descriptor of the distribution when there isn't symmetry. Also, the higher order approximations also can change the observation and not just the measure of precision. If the initial observation is 3, the observation should be Exp[3] unless there's an expressed need to adjust for bias. No so with higher orders. $\endgroup$
    – JimB
    Commented Aug 29, 2020 at 17:02
  • 2
    $\begingroup$ In short, the current documentation for Around and AroundReplace is inadequate to know exactly what is going on. Yes, one can see the symbolic results but that doesn't document what method was used to obtain those results. $\endgroup$
    – JimB
    Commented Aug 29, 2020 at 17:04
  • 2
    $\begingroup$ I rewrote my answer deal more explicitly with the lack of need for a higher order approximation given your example. Other transformations might warrant higher order approximations. $\endgroup$
    – JimB
    Commented Aug 30, 2020 at 5:22

It seems AroundReplace gives asymmetric error in rhermans example.


enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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