# SICP Solutions

### Section - 2.1 - Introduction to Data Abstraction

#### Exercise 2.14

Lets first take an example of two intervals, $I_1$ and $I_2$, and compute $\frac 1 { { \frac 1 { I_1 } } + { \frac 1 { I_2 } } }$ and $\frac {I_1 I_2} {I_1 + I_2}$ using the procedures par1 and par2 given in exercise.

Clearly both results in different answers.

Lets see if the formulas are actually equivalent when applied to intervals.

We have:

$\frac 1 { { \frac 1 { I_1 } } + { \frac 1 { I_2 } } }$
By algebra, we can simplify it as:
$\frac 1 { { \frac { I_1 } { I_1 I_2 } } + { \frac { I_2 } { I_1 I_2 } } }$

This will be true for intervals, iff:

• ${ \frac 1 { I_1 } } = { \frac { I_1 } { I_1 I_2 } }$ for any interval $I_1$ and $I_2$. If we look closely this actually means that $\frac I I = [1, 1]$.
• $\frac 1 { \frac 1 I } = I$, for any interval $I$.

Lets see using Alyssa’s “interval arithmetic” that above is correct or not:

As we can see by interval arithmetic that $\frac I I \ne [1, 1]$. Thus the algebraic equivalent is not same as interval equivalent. However $\frac 1 { \frac 1 I } = I$, for any interval $I$ holds true which means this farmulae alegebraic equivalent is same as arithmetic equivalent.