SICP 2.16 interval arithmetic (circuit)

This is not a matter of homework, I just was not satisfied with my understanding of interval arithmetic and the consequences of exercises 2.16.

The arithmetic of intervals defined in Section 2.14 does not have the properties of normal arithmetic. Two should be equivalent operations, (r1 * r2) / (r1 + r2) and 1 / (1 / r1 + 1 / r2), give different results. The exercise asks why this is so, and if it is possible to construct an interval-arithmetic system in which it is not.

This section discusses the calculation of the error in the resistance of electrical components. I'm not sure I understand what this would mean in these terms to multiply and divide the intervals. What is the application for multiplying two intervals?

Is it possible to build an interval arithmetic system without a problem in this example?

http://mitpress.mit.edu/sicp/full-text/book/book-ZH-14.html#%_sec_2.1.4

(define (make-interval ab) (cons ab)) (define (make-center-width cw) (make-interval (- cw) (+ cw))) (define (make-center-percent cp) (make-center-width c (* c (/ p 100.0)))) (define (lower-bound i) (car i)) (define (upper-bound i) (cdr i)) (define (center i) (/ (+ (upper-bound i) (lower-bound i)) 2)) (define (width i) (/ (- (upper-bound i) (lower-bound i)) 2)) (define (percent i) (* 100.0 (/ (width i) (center i)))) (define (add-interval xy) (make-interval (+ (lower-bound x) (lower-bound y)) (+ (upper-bound x) (upper-bound y)))) (define (sub-interval xy) (make-interval (- (lower-bound x) (lower-bound y)) (- (upper-bound x) (upper-bound y)))) (define (mul-interval xy) (let ((p1 (* (lower-bound x) (lower-bound y))) (p2 (* (lower-bound x) (lower-bound y))) (p3 (* (lower-bound x) (lower-bound y))) (p4 (* (lower-bound x) (lower-bound y)))) (make-interval (min p1 p2 p3 p4) (max p1 p2 p3 p4)))) (define (div-interval xy) (if (= (width y ) 0) (error "division by interval with width 0") (mul-interval x (make-interval (/ 1.0 (upper-bound y)) (/ 1.0 (lower-bound y)))))) (define (parl1 r1 r2) (div-interval (mul-interval r1 r2) (add-interval r1 r2))) (define (parl2 r1 r2) (let ((one (make-interval 1 1))) (div-interval one (add-interval (div-interval one r1) (div-interval one r2)))) (define (r1 (make-interval 4.0 3.2))) (define (r2 (make-interval 3.0 7.2))) (center (parl1 r1 r2)) (width (parl1 r1 r2)) (newline) (center (parl2 r1 r2)) (width (parl2 r1 r2)) 
+6
source share
1 answer

This is because operations in interval arithmetic do not have the field arithmetic structure.

According to Sussman, the exercise is difficult - you need to check each of the operations of the field structure and see which one is not performed.

In the exercise, we asked to show that interval arithmetic is not arithmetic of ranges of functions.

A function like f (x) = x ^ 2 defined on the area [-1, 1] has a range of [0,1], which is included in [-1,1] * [-1,1] = [-1 , 1] obtained by replacing the symbol x with the region of the symbol x .

If we define a similar function that uses a different variable for each dimension, for example, in f (x, y) = x * y, then the range of this function, defined in the area [-1,1] * [-1,1], coincides with the interval [-1,1] * [-1,1] = [-1, 1], since x is used once, and therefore with y.

It happens that all the time when the function f (.., x, ..) is continuous in each variable x , we have range arithmetic to be identical with interval arithmetic if each character is used only once in the definition of f.

In the first Alice formula, a parallel resistor is calculated repeating 2 times the variable R1 and 2 times the variable R2, and using the same argument, the range of this function is included in the product of the corresponding intervals obtained from the formula of the function, replacing each name with the corresponding domain interval, but it is not strictly the same.

We are invited to either rewrite any function so that the range of the rewritten function is the same as the interval obtained by applying the formula of the rewritten function, the names being replaced by intervals equal to the area of ​​the corresponding name from the rewritten function, or to show that this is impossible for every possible function.

This problem is called the “dependency problem”, and it is a big problem, the understanding of which does not meet the purpose of the SICP and requires solving differential equations in several variables.

The goal of this exercise is, as Sussman himself said, to simply show that data can be encoded in several ways. The focus is not on mathematics, but on data abstraction.

+8
source

All Articles