# Lecture4 - 1 LECTURE 1.2 Overview(Covers pages 28 36 Loss...

This preview shows pages 1–3. Sign up to view the full content.

1 LECTURE 1.2 Dr. Vyas Overview: (Covers pages 28 – 36) Loss of significance Order of approximation and Big-O algebra Propagation of error Examples I. Loss of Significance 1. The loss of significance implies the loss of significant digits as a result of arithmetic subtraction. 2. For example, consider a quantity x with nine significant digits, 1.23456789 x = ; likewise consider another quantity y with nine significant digits, 1.23456742 y = . The subtraction of y from x yields another quantity, say z , where 0.00000047 z = with only two significant digits. Thus, seven significant digits were lost as a result of subtractive cancellation (aka loss of significance). 3. Subtractive cancellation combined with rounding process can result in loss of accuracy of the computed result. This is demonstrated by way of example. Example 1: Evaluate, 2 ( ) 1 f x x x = + - for 123.456 x = using six significant digits and rounding. Show that 2 1 ( ) 1 g x x x = + + is an equivalent expression and avoids the error resulting from the subtractive cancellation. Solution: Note that six significant digits and rounding means that we must round off at the sixth significant digit at each arithmetic operation. The process is illustrated via Matlab. >> format long >> x = 123.456; (semi-colon suppresses output to the command window) >> x^2 ans = 1.52413 8393600000e+004 >> % now we round off at the sixth significant digit. Therefore, >> % a new variable is introduced to avoid confusion of variable assignments. >> p = 15241.4; >> s = p + 1 ( 2 1 x + ) s = 1.524240000000000e+004 >> % Note that the number of significant digits have not changed >> sqrt(s) 2 1 x + ans = 1.234601150169560e+002

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 >> % Round off again at sixth significant digit and introduce another variable. >> t = 123.46 2 ( 1) t rounded x = + t = 1.234600000000000e+002 >> f = t – x 2 ( 1) f rounded x x = + - f = 0.003999999999991 : (will defer rounding unless necessary) 2 2 2 2 2 2 2 2 1 1 1 1 ( ) 1 1 1 1 1 x x x x x x f x x x x x x x x x + - + + + - = + - = × = = + + + + + + >> % Now we evaluate g the same way. We can directly use "t" in formula for g >> g = 1/(t + x) g = 0.004049960310389 (in former versions, it appeared as 0.00404996031039) >> % Now let us see the "true" value obtained by carrying all the decimal places >> F = sqrt(x^2 + 1) - x F = 0.00404995 949094 The fundamental idea to avoid subtractive cancellation is to use an equivalent alternative formulation that avoids the subtraction arithmetic using methods of algebra, trigonometry or calculus. The application of these methods is left for students to learn via homework ( example and exercise problems ) . Please refer to the Appendix to learn of another application of the loss of significance formulation. : This digit was not output
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 10

Lecture4 - 1 LECTURE 1.2 Overview(Covers pages 28 36 Loss...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online