Post Reply 
Interval Arithmetic - x-squared and other functions
10-03-2022, 12:13 AM (This post was last modified: 10-03-2022 09:18 PM by johnb.)
Post: #1
Interval Arithmetic - x-squared and other functions
Sorry, this is an Introduction, so it's somewhat long! The question is about 2/3 of the way down...

Off and on for the past few years, I have been writing an HP-48G/GX library and mode of operation that supports so-called Interval Arithmetic.

For those who have not encountered this before, in Interval Arithmetic a scalar is a well-bounded continual range of values. This has uses in both scientific measurement and in computing (reliable numerics, which can tell you when a computation looks like it's returning a valid result but the values have degraded to garbage due to numerical instabilities).

The basic idea is not so difficult to understand. When you measure a 12 ft by 14 floor (perhaps to know how much 1" x 1" tile to buy), you might really only know the measurements to the nearest half inch. The dimensions you really have are [143.5, 144.5] inches by [167.5, 168.5] inches. Multiplication is pretty simple in this case: the result is [24036.25, 24348.25] inches.

My library also carries the "best guess" value through the computation, so that each scalar interval is treated as a triple, which I'll annotate here in the format "best_value:[bottom, top]". This is better than the conventional way of tracking error terms because it doesn't assume the error is evenly distributed above and below the estimated value. The product above would be written 24192:[24036.25, 24348.25] inches. This shows that the "best" estimated value isn't smack in the middle of the range.

Other operations and functions are trickier.

I've recently picked up my old library and starting going through it and second-guessing some of the decisions I've previously made.

QUESTION

Suppose you have an interval value x = 2:[-1.5,5]. What, then, is x squared?

I can think of two options; you might think of others.

I don't think you should just treat the value as a vector {2, -1.5, 5} and square each element. It's a continuous range on the number line, not a vector of discrete values (though we do call out one particular value in the midst of that range).

Let's take just the range part [-1.5,5], to start.

Is the square of the range [ min( (-1.5)^2, 5^2 ), max( (-1.5)^2, 5^2 ) ]
= [ min(2.25, 25), max(2.25, 25) ]
= [2.25, 25]

Or is it [ min( -1.5*-1.5, -1.5*5, 5*-1.5, 5*5), max( -1.5*-1.5, -1.5*5, 5*-1.5, 5*5) ]
= [ min(2.25, -7.5, -7.5, 25), max(2.25, -7.5, -7.5, 25) ]
= [-7.5, 25]

Or is it something else?

Note that I wrote all 4 permutations in the second example because I want to generalize this to other operators, not just multiplication / powers. Now you can see how quickly this starts getting complicated!


BTW, I would >LOVE< it if the new WP-43 project included an interval arithmetic mode! Preferably a better one than the one I've been writing.

Daily drivers: 15c, 32sII, 35s, 41cx, 48g, WP 34s/31s. Favorite: 16c.
Latest: 15ce, 48s, 50g. Gateway drug: 28s found in yard sale ~2009.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Interval Arithmetic - x-squared and other functions - johnb - 10-03-2022 12:13 AM



User(s) browsing this thread: 1 Guest(s)