Hacker News new | ask | show | jobs
by ollyfg 4289 days 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.

1 comments

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.

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.

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.

Is uncertainty calculation modeled after a finitely supported variable like this, or is it tracking the variance of operations on gaussians?
It's wrong either way.