Re: How to use matlab to do interval arithmetic(or range arithmetic)?
- From: roberson@xxxxxxxxxxxxxxxxxx (Walter Roberson)
- Date: Sun, 6 Apr 2008 23:42:13 +0000 (UTC)
In article <ftbk8d$27n$1@xxxxxxxxxxxxxxxxxx>, Yi <hvachy@xxxxxxx> wrote:
Supposing
A~[-1 1]:means minimum A=-1 maximum A=1;
B~[4 6]:means minimum B=4,maximum B=6;
C~[100 200]:means minimum C=100,maximum C=100;
How to get the interval of f=A*B-C+....
I want to develope a general code for these kind of
problems.
One thing you are going to need to decide: when a name (a variable)
appears more than once in the formula, does it represent the
same value at each place, or does it represent a possibly different
value at each place?
For example, take the simple A / A over [-2 -1]. Does that
evaluate to [1] (the interval containing only 1), or does it
evaluate to [-1/-2 -2/-1] (i.e, [1/2 2]) ?
Also, you need to decide what to do about singularities. For example
if A is [-1 1] and you have chosen the "same value at all places"
interpretation, then A / A is [1] except for the possibility that A
was 0; with 0/0 being undefined, A/A would be the set {1, undefined}.
You can come up with similar scenarios in which the expression
has a nice well-contained range, except that it has a singularity
at which it becomes one of the infinities.
Maple has range arithmetic; it chose the "a name represents
a possibly different value each time" interpretation, which is
a lot easier to process, but is frustrating to deal with for
many situations that you want interval arithmetic for.
Note that if you chose "a name represents the same value
each time it occurs", then if the input is a polynomial, in
order to get the correct range, you would have to calculate the
minima and maxima of the polynomial over the range -- which would
most easily be handled by calculating the first derivative of the
polynomial, solving for zeros (which might not be symbolically
possible if the polynomial was degree 5 or higher), and taking
the second derivative to figure out which class each of the
solution points is (minima, maxima, saddle-point). That's probably
why Maple chose the other (less useful) interpretation -- less work!!
You should give consideration to allowing an additional
notation on your inputs. One type of work for which interval
arithmetic is used a fair bit is for error analysis in scientific
formulae, for which the input numbers would tend to be
written as A +/- B (e.g., 6.023E-23 +/- 0.002E-23).
This is convertable to your [] notation, but users would generally
find it inconvenient to do the conversion themselves.
Another common use for interval arithmetic is in being given
rounded numbers, and asked to calculate the significance of the
rounding -- i.e., to take a range +/- 0.5 on the last written
digit. It's a nuisance to the user to have to put in those ranges
manually.
--
"Style is instinctive and few achieve it in a notable degree. Its
development is not hastened by instruction. It comes or it doesn't.
It will take care of itself." -- Walter J. Phillips
.
- References:
- Prev by Date: Re: Quadgk and Legendre-Gauss
- Next by Date: Re: simple question: how to figure out what the axes_handle property is within the grid function??
- Previous by thread: How to use matlab to do interval arithmetic(or range arithmetic)?
- Next by thread: Re: How to use matlab to do interval arithmetic(or range arithmetic)?
- Index(es):
Relevant Pages
|
Loading