2.13

练习 2.13 请证明,在误差为很小的百分数的条件下,存在着一个简单公式,利用它可以从两个被乘区间的误差算出乘积的百分数误差值。你可以假定所有的数为正,以简化这一问题。


在前面的练习2.11 中,已经讨论了区间相乘的 9 种情况。在所有的数都为正的情况下,有:

[x1,x2][y1,y2]=[x1y1,x2y2] [x_1, x_2] \cdot [y_1, y_2] = [x_1\cdot y_1, x_2 \cdot y_2]

一个区间的百分数误差值和宽度以及中心点的关系是:

centerpercent=width center \cdot percent = width

(define (make-interval a b) (cons a b))
(define upper-bound cdr)
(define lower-bound car)
(define (add-interval x y) 
    (make-interval (+ (lower-bound x) (lower-bound y))
                    (+ (upper-bound x) (upper-bound y))))
(define (sub-interval x y) (add-interval x (make-interval (- 0 (upper-bound y)) (- 0 (lower-bound y)))))
(define (subtract-interval x y)
    (define p1 (- (lower-bound x) (lower-bound y)))
    (define p2 (- (lower-bound x) (upper-bound y)))
    (define p3 (- (upper-bound x) (lower-bound y)))
    (define p4 (- (upper-bound x) (upper-bound y)))

    (make-interval (min p1 p2 p3 p4) (max p1 p2 p3 p4)))

(define (mul-interval x y)
    (define p1 (* (lower-bound x) (lower-bound y)))
    (define p2 (* (lower-bound x) (upper-bound y)))
    (define p3 (* (upper-bound x) (lower-bound y)))
    (define p4 (* (upper-bound x) (upper-bound y)))

    (make-interval (min p1 p2 p3 p4) (max p1 p2 p3 p4))
)

(define int1 (make-interval 2 4))
(define int2 (make-interval 3 6))
(mul-interval int1 int2)
(define (make-center-percent center percent)
  (make-interval (- center (* center percent))
                 (+ center (* center percent))))

(define (center x) (/ (+ (lower-bound x) (upper-bound x)) 2))

(define (percent x)
  (/ (width x) (center x)))

(define int (make-center-percent 2 0.5))
int
(center int)
(define (width x) (/ (- (upper-bound x) (lower-bound x)) 2))
(percent int)

先用几个例子找一下规律:

(define i1 (make-center-percent 2 0.5))
(define i2 (make-center-percent 2 0.25))

i1
i2
(define i3 (mul-interval i1 i2))
i3
(percent i3)

看起来是 (1/2) * (1/4) = (1/3) = (1+1) / (2+4)

不过,这个直观的规律和并不能和以上的定义产生什么联系。还是老老实实地计算吧。

证明

int1=[x1,x2],int2=[y1,y2] int1 = [x_1, x2], int2 = [y_1, y_2] 以及 [x1,x2][y1,y2]=[x1y1,x2y2]=int3 [x_1, x_2] \cdot [y_1, y_2] = [x_1\cdot y_1, x_2 \cdot y_2] = int3

int3 的百分数误差值是

p3=x2y2x1y12x1y1+x2y22=x2y2x1y1x1y1+x2y2 p_3 = \frac{\frac{x_2 y_2 - x_1 y_1}{2}}{\frac{x_1 y_1 + x_2 y_2}{2}} = \frac{x_2 y_2 - x_1 y_1}{x_1 y_1 + x_2 y_2}

p1=x2x1x1+x2p2=y2y1y1+y2 p_1 = \frac{x_2 - x1}{x_1 + x_2} p_2 = \frac{y_2 - y1}{y_1 + y_2}

引入中心点的关系,

c1=x1+x22,c2=y1+y22 c_1 = \frac{x_1 + x_2}{2}, c_2 = \frac{y_1 + y_2}{2}

即:

x1=c1c1p1,x2=c1+c1p1,y1=c2c2p2,y2=c2+c2p2 x_1 = c_1 - c_1 p_1, x_2 = c_1 + c_1 p_1, y_1 = c_2 - c_2 p_2, y_2 = c_2 + c_2 p_2

代入上面的公式,得到

p3=x2y2x1y1x1y1+x2y2 p_3 = \frac{x_2 y_2 - x_1 y_1}{x_1 y_1 + x_2 y_2} =(c1+c1p1)(c2+c2p2)(c1c1p1)(c2c2p2)(c1c1p1)(c2c2p2)+(c1+c1p1)(c2+c2p2) = \frac{(c_1 + c_1 p_1) (c_2 + c_2 p_2) - (c_1 - c_1 p_1) (c_2 - c_2 p_2)}{(c_1 - c_1 p_1) (c_2 - c_2 p_2) + (c_1 + c_1 p_1) (c_2 + c_2 p_2)} =(c1c2+c1c2p2+c1p1c2+c1p1c2p2)(c1c2c1c2p2c1p1c2c1p1c2p2)(c1c1p1)(c2c2p2)+(c1+c1p1)(c2+c2p2) = \frac{(c_1 c_2 + c_1 c_2 p_2 + c_1 p_1 c_2 + c_1 p_1 c_2 p_2) - (c_1 c_2 - c_1 c_2 p_2 - c_1 p_1 c_2 - c_1 p_1 c_2 p_2)}{(c_1 - c_1 p_1) (c_2 - c_2 p_2) + (c_1 + c_1 p_1) (c_2 + c_2 p_2)} =p1+p21+p1p2 = \frac{p_1+p_2}{1+p_1 p_2}

由于 p1,p2 p1, p2 都很小,所以相乘后的结果几乎为0,从而以上公式可以得到

p3p1+p2 p_3 \approx p_1 + p_2

results matching ""

    No results matching ""