SICP Exercise 2.14

Question

Demonstrate that Lem is right. Investigate the behaviour of the system on a variety of arithmetic expressions. Make some intervals \(A\) and \(B\), and use them in computing the expressions \(A/A\) and \(A/B\). You will get the most insight by using intervals whose width is a small percentage of the centre value. Examine the results of the computation in centre-percent form (see exercise 2.12).

Answer

First, let’s see whether par1 and par2 do, in fact, return different results:

(define x (make-centre-percent 1000 1))
(define y (make-centre-percent 2500 5))

(define xy (div-interval x y))
(define yx (div-interval y x))
(define xx (div-interval x x))
(define yy (div-interval y y))

(par1 x y)
(par2 x y)

Results:

     '(646.8363136176066 . 787.890044576523)
     '(698.7369985141158 . 729.3672627235213)

So, the results are actually different, even though arithmetically, it should be the same operation. Why this happens will be explored in more detail within the following exercises, 2.15 and 2.16.

For now, let us look at some $A/B$s and $A/A$s as the question suggests. First, we should look at the centre values:

(centre xy)
(centre yx)
(centre xx) ; expected: 1
(centre yy) ; expected: 1

Results:

     0.401203007518797
     2.5015001500150014
     1.000200020002
     1.005012531328321

So the centre of the division is very close to the division of the centres, but not exactly the same value. Interestingly, the centre of an interval divided by itself is not exactly 1, which we would have expected. How about percentage tolerances?

(percent xy)
(percent yx)
(percent xx)
(percent yy)

Results:

     5.997001499250372
     5.997001499250374
     1.9998000199979968
     9.975062344139655

The tolerance of the result is generally close to the sum of the component tolerances, but again not exactly the same value. This matches what we determined in exercise 2.13.