<- Back
Comments (47)
- fouronnes3Author here. Outward rounding to combat precision issues is what interval arithmetic is most known for (try 0.1+0.2 with "full precision mode" enabled), but that's really a shame in my opinion. Outward rounding is cool, but the "inclusion property", as it's known in research papers, works at every scale! This is what enables things like: 50 * (10 + [-1, 1]) [450, 550] which is lovely, I think. Adding the union layer to it enables even cooler things, like the true inverse of the square function. Did you know it's not sqrt? Try 'sqinv(64)'.I made interval calculator actually mostly as a way to test my implementation of interval union arithmetic [0], which I needed for another project: a backwards updating spreadsheet [1][2].[0] https://github.com/victorpoughon/not-so-float[1] https://victorpoughon.github.io/bidicalc/[2] https://news.ycombinator.com/item?id=46234734
- iamwilThis is great. You might be interested in Matt Keeter's work on Implicit surfaces, and using interval math for its optimization:https://youtu.be/UxGxsGnbyJ4?si=Oo6Lmc4ACaSr5Dk6&t=1006
- memalignYou might be interested in this graphing calculator I made using interval arithmetic:https://memalign.github.io/m/formulagraph/index.htmlSome detail on how this works, including links to the relevant interval math code:https://memalign.github.io/p/formulagraph.html
- _MicroftVery nice, thanks for sharing! Maybe show which upper or lower values are included in the intervals? A notation I am familiar with uses outward facing brackets if the value is not included in the interval. That always applies to infinity.Applied to the cases here:]-∞, -1] U [0.5, +∞[The excluded interval in between becomes ]-1, 0.5[ then.That’s how min (and analogously max) works, right? min(A, B) = [lo(A,B), lo (hi(A), hi(B))].Edit: idea: copy a formula from the results section to the input field if the user clicks/taps on it.
- roger_I can see valid uses of this but I also feel like a probabilistic calculator would be more useful.e.g. the result for the 1 / [-1, 2] example doesn’t tell you how likely each value is and it clearly won’t be uniformly distributed (assuming the inputs are).
- malcolmjuxtI wish I had known about interval arithmetic when I first wrote tick, a time interval library in Clojure, which includes a. implementation of Allen's Interval Algebra. It also embraces the notion of sets of discrete intervals which are useful for practical work calculations, like determining the set of intervals of your vacations that are in a particular year (for HR calculations). I accidentally stumbled on benefits of these sets without knowing much beyond Allen's work.https://github.com/juxt/tickhttps://en.wikipedia.org/wiki/Allen's_interval_algebra
- akstVery cool! I don't entirely understand some of the operations, but for what I do understand its pretty neat.I wish in classes we were introduced to a notion of arithmetic on intervals as it comes up. Like in basic statistics with confidence intervals there's ±, as well as in the quadratic equation. It found some what dissatisfying we couldn't chain the resulting a series of operations and instead repeat the operations for the 2 seperate values of the ±. I get a teacher would rather not get hung up on this because they want to bring it back to the application generally, like solving a more complicated equation or hypothesis testing in basic stats. I just wish they hinted at the idea we can do arithmetic on these kinds of things more generally.I realise what you've got here is well beyond this, but seeing this was some level of validation that treating the interval as a piece of data with its own behaviour of certain operations does make some sense.
- SkiFire13Expanding the logic to union of intervals looks cool, but what is the complexity of that? Since you introduce the the possibility of an operation on an interval producing two intervals I suspect executing N operations might have an exponential complexity, which unfortunately makes this unfeasible to use for some common intervals applciations like abstract interpretation, unless you start introducing approximations once you have enough intervals.
- mike-the-mikadoI recently implemented something somewhat similar, but from the perspective of set membership.I therefore needed to include a complement operation, so that I could do full Boolean analysis of interval membership.Your intervals are all closed sets, consequently the complements are open intervals. I chose not to distinguish between open and closed intervals, since for my practical purposes whether the end points are members of the set is unimportant.Of course, with inexact arithmetic, the question of whether the set is open of closed probably not well-defined.
- wvlia5Hey, what about this idea? redefine interval representation, such that [a, b] means the same if a<b; but if b<a, it means [-∞, b]U[a, +∞]. Then your example would become 1/[-1,2]=[0.5,-1]
- anematodeExcellent!! I love interval arithmetic and also wrote a TS implementation for a graphing calculator project. Agree that it's very underrated, and I wish that directed rounding was exposed in more languages.
- JSR_FDEDI just read up on interval arithmetic. I understand its desirable properties. Where in practice have you applied it? What’s a real world application for interval arithmetic?
- FalimondaRandom example generator would be nice
- Eric_XuaReally cool project—turning interval unions into a usable, polished calculator makes the math feel practical.
- teifererThe last point in your intro description can't be stressed enough: this allows for safe handling of rounding errors in floating point operations.Though you are inherently losing precision: there are values in the output interval which don't have a corresponding input that causes this output.
- pettersYou could add a feature where it will compute the global optimum of any function of a small number of variables. Branch and bound with interval arithmetic works well for a small number of variables.Disjoint unions of intervals seems like a nice thing to have
- mboCould this support a native datetime type? I shipped a much worse of this for managing repeated events and schedules.
- adaptitThis interval calculator is surprisingly robust. The way it handles boundary conditions and asymmetric intervals is clean and efficient.
- ttoinouWhy not use disks / exterior disks in the complex numbers plane instead of intervals ? It might make the mental model easier to reason about
- dnnddidiejInterals can be used to model errors and uncertainty and this lets you see how they conpound in calculations like speed = distance over time.
- dfgtuVery nice work. I was wondering if it might be useful to combine this with a library for arbitrary precision arithmetic. How difficult do you think that might be?
- jakeinspaceThis is great
- boobsbrNeat.
- lou1306Sorry to be a party pooper, the Web app is neat, but I have some reservations about the paper.Namely, the "powerset of intervals" domain has been known since the '70s [1], and powerset domains have been generalised to arbitrary base domains decades ago [2]. A paper from the mid-2010s on these topics that lacks any engagement with the abstract interpretation literature is a bit disappointing.As for the interpretation of division suggested here, it makes, say, 1 / S non-distinguishable from 1 / ([0, 0] U S) for any set of intervals S, which sounds suspicious.[1] Patrick Cousot and Radhia Cousot. 1979. Systematic Design of Program Analysis Frameworks. In 6th ACM Symposium on Principles of Programming Languages (POPL), January 1979. ACM Press, San Antonio, TX, USA, 269–282. https://doi.org/10.1145/567752.567778[2] Gilberto Filé and Francesco Ranzato. 1999. The Powerset Operator on Abstract Interpretations. Theor. Comput. Sci. 222, 1–2 (1999), 77–111. https://doi.org/10.1016/S0304-3975(98)00007-3
- i_love_retrosThank you for creating and sharing something that feels authentic and human made. No sign of AI vibe coded slop at all. It's beautiful.
- mehmetkerem[dead]
- wallhz[dead]
- Sergey777[dead]
- LXforever[flagged]