SICP Exercise 2.15
Question
Eva Lu Ator, another user, has also noticed the different intervals
computed by different but algebraically equivalent expressions. She says
that a formula to compute with intervals using Alyssa’s system will produce
tighter error bounds if it can be written in such a form that no variable
that represents an uncertain number is repeated. Thus, she says, par2
is
a “better” program for parallel resistances than par1
. Is she right? Why?
Answer
This question touches on the subject of identity. The reason that the two procedures return different results is because of the way interval division works. This is a somewhat hard problem in mathematics.
Of course, if you divide any regular number by itself, the result is always
The reason why this does not happen is because
This uncertainty increases proportionally to the number of instances of an
uncertain interval like par2
does
not contain a division of an interval by itself, this is not an issue, and
Eva is correct in saying that par2
will yield a more accurate result.
Although this may or may not be a good thing, since it may be useful to
reflect uncertainty in the result if it exists. So whether par2
is
actually the better function depends entirely on the use case.