Summary of the problem solving of the SiC exercise (2.13): interval calculation error, sicp2.13

Source: Internet
Author: User

Summary of the problem solving of the SiC exercise (2.13): interval calculation error, sicp2.13

There is nothing to do with programming, but it cannot block us from doing it.


The question requires us to prove that when the error percentage is small, we can use a simple formula to calculate the error of the product based on the error of the given range.


At the same time, in order to simplify the problem, we can only calculate the number of positive cases, because when negative numbers are involved, the positive and negative changes of the product are diverse, and it is not easy to deal with them in a unified manner.


The most direct reaction after I see a question is not to prove it, but to find this simple formula through a program, a typical programmer's psychology.


It is easier to do this. We construct some intervals with a small percentage of errors, multiply them, and then look at the error pattern of the product.

The code I tested is as follows:


  (define first (make-center-percent 3647278 2))  (define second (make-center-percent 1223378 3))  (define mul-result (mul-interval first second))  (display (+ 0.0 (percent mul-result)))(newline)

 

To avoid coincidence, you can perform more than a few tests. The results are obvious. When the error is 2% and 3%, the error percentage of the product range is approximately % 5.


So we can boldly guess that this simple formula is to add the error percentage of the multiplication interval.


Furthermore, it is difficult to prove this in mathematics. Students who are not interested can skip this step. However, if you are interested, it is not difficult to prove it.


The question allows us to calculate only the number of positive numbers, so we can calculate them using two positive intervals.


We have discussed before that if both intervals are positive, the starting point of the product interval is the product of the starting point of the multiplication interval, and the ending point of the product interval is the product of the end point of the multiplication interval.


Suppose we have two more intervals (a1 b1), (a2 b2)


Yes (a1 B 1) * (a 2 b2) = (a1 * a2 b1 * b2)


The error percentage of range 1 is (b1-a1)/2)/(b1 + a1)/2 ),

Actually (b1-a1)/(b1 + a1)

The error percentage of range 2 is (b2-a2)/(b2 + a2)


The error percentage of range 1 and range 2 is

(B1-a1)/(b1 + a1) + (b2-a2)/(b2 + a2)

Equal:

(B1-a1) * (b2 + a2) + (b2-a2) * (b1 + a1)/(b1 + a1) * (b2 + a2 ))


=> (B1b2-a1b2 + b1a2-a1a2 + b1b2-a2b1 + a1b2-a2a1)/(b1 + a1) * (b2 + a2 ))

=> (2 * b1b2-2 a1a2)/(b1 + a1) * (b2 + a2 ))

=> (2 * b1b2-2 a1a2)/(b1b2 + a1b2 + b1a2 + a1a2)

=> 2*(b1b2-a1a2)/(b1b2 + a1a2 + a1b2 + b1a2)

Because the percentage of error between interval 1 and interval 2 is very small, we can think that (b1b2 + a1a2) and (a1b2 + b1a2) are very close, so there are

=> 2*(b1b2-a1a2)/2*(b1b2 + a1a2)

=> (B1b2-a1a2)/(b1 b2 + a1a2)


The error percentage of the product range is:

(B1b2-a1a2)/(b1 b2 + a1a2)


This is the mathematical proof of exercise 2.13. Because it is not a major in mathematics, the proof is not very rigorous. You can probably understand what it means. If you need to read the rigorous proof, You can google it.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.