Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add solution to 2_09

  • Loading branch information...
commit 8758e9e49dc88c04c789fa266d9383a36c1d7cf0 1 parent 65119b2
@fastred authored
Showing with 37 additions and 0 deletions.
  1. +37 −0 2_09.scm
View
37 2_09.scm
@@ -0,0 +1,37 @@
+Let's assume that we have two intervals:
+(define a (make-interval c d))
+(define b (make-interval e f))
+(define a-width (/ (- d c) 2)) ; (d - c) / 2
+(define b-width (/ (- f e) 2)) ; (f - e) / 2
+
+
+a) Addition
+
+Width of (add-interval a b) equals to (in infix notation):
+((d + f) - (c + e)) / 2
+(d + f - c - e) / 2
+(d - c + f - e) / 2
+(d - c) / 2 + (f - e) / 2
+a_width + b_width
+
+
+b) Multiplication
+
+Width of (mul-interval a b) equals to:
+(max((c * e) (c * f) (d * e) (d * f)) - min((c * e) (c * f) (d * e) (d * f))) / 2
+
+
+It's not clear whether we can transform this expression to the form based only on
+a_width and b_width.
+As a counterexample we can find two pairs of intervals of the same widths and see whether
+widths of results are the same.
+
+
+(mul-interval (make-interval 1 2)
+ (make-interval 2 3))
+; (2 . 6) -- width 2
+
+(mul-interval (make-interval 2 3)
+ (make-interval 3 4))
+; (6 . 12) -- width 3
+
Please sign in to comment.
Something went wrong with that request. Please try again.