Exercise 2.9: The width of an interval is half of the difference between its upper and lower bounds. The width is a measure of the uncertainty of the number specified by the interval. For some arithmetic operations the width of the result of combining two intervals is a function only of the widths of the argument intervals, whereas for others the width of the combination is not a function of the widths of the argument intervals. Show that the width of the sum (or difference) of two intervals is a function only of the widths of the intervals being added (or subtracted). Give examples to show that this is not true for multiplication or division.
If any of the four intervals expressions are used as interval endpoints their width formula will not give the tidy results of addition/subtraction.
> (print (add-interval (make-interval 6.12 7.48) (make-interval 4.465 4.935)))
> (print (sub-interval (make-interval 6.12 7.48) (make-interval 4.465 4.935)))
wactual=0.915 (ignoring the floating point number errors)
Of course this doesn’t make sense since accuracy cannot be magically gained by multiplying two interval together. More on this in the division example.
> (print (mul-interval (make-interval 6.12 7.48) (make-interval 4.465 4.935)))
> (print (div-interval (make-interval 6.12 7.48) (make-interval 4.465 4.935)))
How is it that wactual is smaller than each w1, w2? wnaive_total is just plain wrong and should be discarded.
The answer is that wactual isn’t smaller. It’s actually larger. The percentage of error that wactual represents, for it’s interval, is actually greater than either w1=10% and w2=5%. wactual = 14.9%.
As expected the error is actually higher even though the aggregate number for wactual looks smaller.