]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex2_13.clj
solutions to 4.38, 4.39 and 4.40
[sicp.git] / src / sicp / ex2_13.clj
1 (ns sicp.ex2_13
2   (:use [sicp utils ch2_1_extended ex2_7]
3         [clojure.test]))
4 (comment
5   "let l1 = c1 - t1,
6        u1 = c1 + t1,
7        l2 = c2 - t2 and
8        u2 = c2 + t2.
9
10 Product of two intervals = min (multiples), max (multiples). But since
11 t1 and t2 are small, we ignore the t1*t2 terms, so the products
12 p1,p2,p3 and p4 are:
13
14  p1 = c1*c2 - c1*t2 - c2*t1
15  p2 = c1*c2 + c1*t2 - c2*t1
16  p3 = c1*c2 - c1*t2 + c2*t1
17  p4 = c1*c2 + c1*t2 + c2*t1
18
19 Now, since all numbers are positive, p1 is the min and p4 is the max.
20 So, percentage tolerance of the product =
21  (c1t2 + c2t1)/c1c2   * 100
22
23  But t1 = c1 * p1 and t2 = c2 *p2
24
25 So, product tolerance is p1 + p2. i.e. sum of individual tolerances."
26 )