←back to thread

Uncertain<T>

(nshipster.com)
444 points samtheprogram | 1 comments | | HN request time: 0.251s | source
Show context
j2kun ◴[] No.45056827[source]
This concept has been done many times in the past, under the name "interval arithmetic." Boost has it [1] as does flint [2]

What is really curious is why, after being reinvented so many times, it is not more mainstream. I would love to talk to people who have tried using it in production and then decided it was a bad idea (if they exist).

[1]: https://www.boost.org/doc/libs/1_89_0/libs/numeric/interval/... [2]: https://arblib.org/

replies(8): >>45056929 #>>45057194 #>>45057366 #>>45057865 #>>45058239 #>>45058375 #>>45058723 #>>45062336 #
kccqzy ◴[] No.45057366[source]
The article says,

> Under the hood, Uncertain<T> models GPS uncertainty using a Rayleigh distribution.

And the Rayleigh distribution is clearly not just an interval with a uniformly random distribution in between. Normal interval arithmetic isn't useful because that uniform random distribution isn't at all a good model for the real world.

Take for example that Boost library you linked. Ask it to compute (-2,2)*(-2,2). It will give (-4,4). A more sensible result might be something like (-2.35, 2.35). The -4 lower bound is only attainable when you have -2 and 2 as the multiplicands which are at the extremes of the interval; probabilistically if we assume these are independent random variables then two of them achieving this extreme value simultaneously should have an even lower probability.

replies(1): >>45060585 #
rendaw ◴[] No.45060585[source]
While it does sound like GP missed a distinction, I don't see how (-2.35, 2.35) would be sensible. The extremes can happen (or else they wouldn't be part of the input intervals) and the code has to sensibly deal with that event in order to be correct.
replies(3): >>45062972 #>>45064017 #>>45080705 #
1. Dylan16807 ◴[] No.45080705[source]
-2 and 2 were not the extremes to begin with.