Settings

Theme

Show HN: An Uncertainty Calculator

ollyfg.github.io

13 points by ollyfg 11 years ago · 11 comments

Reader

ollyfgOP 11 years ago

Hi, author here, I just want to say that if you happen to know more correct uncertainty propagation for scientific functions, please submit a pull request.

Also, this is aimed at undergraduates, so it ignores covariance.

  • spacehome 11 years ago

    What you're really trying to do is interval arithmetic, and it's not calculating it correctly.

    For instance: In (a+-b) * (c+-d), you're multiplying the intervals (a-b,a+b) and (c-d,c+d). If all those endpoints are positive, then you get the interval ((a-b) * (c-d),(a+b) * (c+d)).

    The answer is then: ((a-b) * (c-d)+(a+b) * (c+d))/2 +- ((a+b) * (c+d) - (a-b) * (c-d))/2

    If some of those endpoints have different signs, then you need to break it down into cases.

    • ollyfgOP 11 years ago

      Wow, this makes a lot of sense. In what ways is this different to the way I was taught through school and university (that for a+-b * c+-d, the answer was (ab)+-sqrt( (b/a)^2) + (d/c)^2 )?

      I can see that ((a-b) (c-d)+(a+b) * (c+d))/2 is different to a*b, and that makes sense when you think about it, but the second part is confusing me a bit.

      Also, I'm a bit confused by your suggestion to break it down into cases, do you mean if an uncertainty is negative? Because at the moment I'm making all uncertainties positive, but if there are cases where negative ones are correct, I need to fix that up.

      • spacehome 11 years ago

        The formula you cite is a back-of-the-envelope approximation that only works so long as c and d have much smaller magnitudes than a and b. (Try to derive that formula yourself. You'll find it pop up in a limit, but it's certainly not generally true.)

        You also need to clear up your own confusion about what exactly you mean by "uncertainty". You seem to go back and forth between several different measures.

        Uncertainties aren't negative. But solve the rest of the issues, and what I meant by cases should become more clear.

    • TTPrograms 11 years ago

      Is uncertainty calculation modeled after a finitely supported variable like this, or is it tracking the variance of operations on gaussians?

bshimmin 11 years ago

I was sort of hoping it might sometimes result in an answer of "a suffusion of yellow".

spacehome 11 years ago

I think it doesn't work. It claims:

(1+-2) / (1+-2) = 1+-2.8

When, of course, the result could be any real number.

  • ollyfgOP 11 years ago

    I'm not entirely sure I understand what you're saying here, but I think the difference you're noticing is due to co-variance, and the fact that this calculator doesn't take it into account (or just assumes that it's 0).

    For example, when you use covariance properly you could say: x=2+/-2 x-x=0

    since covariance = 1

    But this calculator assumes that covariance is zero, so it does the calculation (2+/-2) - (2+/-2) = 0+/-sqrt(2^2 + 2^2) = 0+/-2.8

    If I'm misunderstanding and this is another problem, please help me, I'm not all that good with uncertainties, but am trying to learn more in this area as it's very useful.

    • spacehome 11 years ago

      The issue is not covariance. And, if you were trying to use my example, you got the numbers and the operation wrong.

      There's lots ways to measure uncertainty, but based on this quote "What this means is that the actual length of the pencil could be anywhere between 15.1+0.05cm (15.15cm) and 15.1-0.05cm (15.05cm)." from your page, I infer you're doing interval arithmetic. However, the calculator isn't calculating any measurement of uncertainty correctly. (The mathematics behind multiplying and dividing normally-distributed variables is nuanced and not close to as easy as the addition and subtraction cases.)

      I recommend at least reading the Wikipedia article on interval arithmetic: http://en.wikipedia.org/wiki/Interval_arithmetic

alexbecker 11 years ago

1/(1+-1) = 1+-1

Great idea, but as other comments have noted, completely wrong.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection