Note: this wiki is now retired and will no longer be updated!

The static final versions of the pages are left as a convenience for readers. Note that meta-pages such as "discussion," "history," etc., will not work.

SICP exercise 2.15

From Drewiki
Jump to: navigation, search

Problem

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 from the text is a "better" program for parallel resistances than par1. Is she right? Why?

Solution

Eva is correct in saying that par2 will produce tighter error bounds than par1, at least for intervals whose widths are greater than the rounding error introduced by the computer's finite-precision arithmetic operations.

Note that an interval operation cannot reduce the uncertainty of the system; how can we remove uncertainty from an uncertain calculation? Each uncertain value used in an interval computation increases the uncertainty of the answer.

If its arguments r1 and/or r2 are uncertain values (i.e., they have non-zero width), par1 will produce an overly pessimistic error bound for the computed parallel resistance because it uses the uncertain values r1 and r2 twice each in two different computations. By treating each distinct use of r1 and r2 in the computation as distinct uncertain values, par1 overcompensates. The two distinct occurrences of r1 in the calculation refer to one actual resistor, not two resistors with the same uncertainty. Stated another way, the value that r1 may take is somewhere within its interval, but whatever value it does take, it's the same value for both occurrences of r1 in the procedure. The interval arithmetic system we've devised doesn't have a way of communicating that the uncertainty of any given value should only be accounted for once in the computation.

By using the values of r1 and r2 only once each in its computation, procedure par2 does not overcompensate for the range of uncertainty of these values. Each value's uncertainty is introduced into the calculation only once. par2 does use the interval one in several places, but this interval has zero uncertainty, so repeated uses of one don't add any uncertainty to the computation.

Whether the fact that par2 produces tighter error bounds makes par2 qualitatively "better" than par1 is a matter of judgement, and depends at least partially on the application.

Personal tools