{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Chapter4.1-2 - 1232009 Roundoff and Truncation errors...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1232009 Roundoff and Truncation errors. Discussion of accuracy and precision in textbook. Note that I do not agree that Figure 4.1 (b) is a good example of improved accuracy compared to Figure 4.1(a). In fact, 4.1(d) shows results that are substantially more accurate than 4.1(b) and not only more precise. For most of your engineering calculations, precision will refer to how many digits you will use in presenting your results, and accuracy will refer to how many of these digits are correct. One sure way to look like a novice is to give many more digits than are needed, even if they are accurate! To anchor the discussion of error, recall the calculations of the derivative of arcsin(x) at x=0.5 that we carried on the last class >> [email protected](x,h) (asin(x+h)asin(x))/h asindif = @(x,h) (asin(x+h)asin(x))/h >> asindif(0.5,0.1) ans = 1.1990 >> asindif(0.5,0.001) ans = 1.1551 >> asindif(0.5,1e5) ans = 1.1547 >> asindif(0.5,1e7) ans = 1.1547 It appears that we are getting a result that is accurate to the precision that we use (5 significant digits), with a step size of 1e5. Thus for a step size of 0.1 we have a true error of 1.19901.1547=0.0443, which translates to a relative error of (0.0443/1.1547)100%=3.8%. If we did only the first two step sizes of 0.1 and 0.001, we would have estimated an error of 1.11901.1551=0.0439, and we may have compared that against a stopping criterion in deciding whether to go to an even smaller step size. Roundoff errors Numbers are stored on the computer as binary numbers. Why? Can use Matlab to get the binary number associated with any integer and vice versa >> dec2bin(36) ans = 100100 >> bin2dec('10111') ans = 23 However, you should be able to do the transformation by hand for the exam! Because of the finite number of digits used for numbers, roundoff error accumulate when performing long strings of calculation. However, in extreme cases that can happen with very few operations. For example >> a=2^(1.e10) a = 1.00000000006931 >> a^1e10 ans =2.00000116165295 ...
View Full Document

{[ snackBarMessage ]}