;; Exercise 2.3
The two representations for a rectangle are as two segments, or
as four points. The perimeter and area procedures will work
with either representation because I have selectors,
rect-length-side1 and rect-length-side2, that hide the
details of how the rectangles are represented.
;; Exercise 2.5
3 is not divisible by 2. The square of 3 isn't divisible by 2, if it was,
then there would be some factor of the square of 3 that was
divisible by 2. However the square of 3 is uniquely factorized as
33, and neither factor is divisible by 2. The cube of three is
uniquely factorized as 3(33), and neither 3 nor (33) is divisible
by 2. We can continue the argument for any nth-power of 3.
;; Exercise 2.9
let the upper bound of interval 1 be U1 and the lower bound of interval 1 be L1
For summing two intervals:
interval = L1 + L2, U1 + U2
width = ((U1 + U2) - (L1 + L2))/2
= ((U1 - L1)/2 + (U2 - L2)/2
= sum of the widths of the intervals
For subtracting two intervals
interval = L1 - U2, U1 - L2
width = ((U1- L2) - (L1 - U2))/2
= ((U1 - L1)/2 + (U2 - L2)/2
= sum of the widths of the intervals
For multiplication
Let interval 1 = 3 +/- 1 and width = 1
interval 2 = 5 +/- 2 and width = 2
(mul-interval (make-interval 2 4) (make-interval 3 7)) ; Value (6,28)
has width (28-6)/2 = 11 which is greater than the sum of 1 and 2
(div-interval (make-interval 2 4) (make-interval 3 7)) ; Value (0.2857, 1.3333)
has width -.5238 which is less than than the sum of 1 and 2
;; Exercise 2.13
let a = [Ca(1 - Ta), Ca(1 + Ta)]
let b = [Cb(1 - Tb), Cb(1 + Tb)]
ab = CaCb[(1 - Ta)(1 - Tb), (1 + Ta)(1 + Tb)]
which is approximately CaCb[(1 - Ta - Tb), (1 + Ta + Tb)]
The tolerance of the product is approximately the sum of the factors.
Every time an interval is multiplied (or divided) the percentage tolerance
of that interval is summed into the total interval. For our example,
in par1 we have multiplied two intervals (r1 * r2) which totals (5% + 5%), and then
divide by another interval (r1 + r2) which adds another 5%. Giving a total tolerance
of 15%! The upper limit on our calculation (r1 r2)/(r1 + r2), is 3 times the tolerance
of the factors.
The case of addition and subtraction is better, where the width of the interval isn't
the sum of the percentage tolerance of each of the intervals, but rather only the sum of
the widths of the intervals.
;; Exercise 2.15
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. Why? We are trying
to get some upper (and lower) limit to the error of our combined approximate quantities,
but every time we combine another interval we need to re-evaluate the goodness of the total
interval, and this will always increase. That is, each uncertain value used in an interval
computation increases the uncertainty of the answer.
If we can design our calculations so that no variable that represents an uncertain number
is repeated, then the measure of the error in our answer, the width of the interval,
will be be less.