## Exercise 2.11 of SICP

Exercise 2.11: In passing, Ben also cryptically comments: “By testing the signs of the endpoints of the intervals, it is possible to break mul-interval into nine cases, only one of which requires more than two multiplications.” Rewrite this procedure using Ben’s suggestion.

The assumption made here is that for any interval $[x_1,x_2]$ : $x_1 \le x_2$
Using this assumption here are the 9 valid signs combinations.

Notice that the case of 3 will need a little extra logic since it is possible for the two negative lower bounds to multiply together and become larger than the two positive upper bounds.

> (print (mul-interval (make-interval 1 2) (make-interval 3 4)))
[3,8]
> (print (mult-interval (make-interval 1 2) (make-interval 3 4)))
[3,8]
> (print (mult-interval (make-interval -2 -1) (make-interval -4 -3)))
[3,8]
> (print (mul-interval (make-interval -2 -1) (make-interval -4 -3)))
[3,8]
> (print (mul-interval (make-interval -2 1) (make-interval -4 -3)))
[-4,8]
> (print (mult-interval (make-interval -2 1) (make-interval -4 -3)))
[-4,8]

I suspect this problem is given not because it’s an expert systems programmer’s way of solving it but for the interval arithmetic to sync in about always maximizing the width of the new interval whenever possible.