Errors in Numerical Methods Chapter 2 Errors in Numerical Methods and Their Impacts
Objectives Know finite-word length effect Know computing errors, their causes and impacts to numerical calculation Know how to compute the errors Know the effect of error propagation Know how to avoid large errors
Content Introduction Finite word-length effect (Floating-point number representation) Error How to avoid error Conclusion
Introduction Why we need to know ? Computers are great tools, however, without fundamental understanding of engineering problems, they will be useless.
Finite wordlength effect How floating numbers are stored in a computer ? Sign bit Exponent Mantissa Base of the number system used IEEE 64-bit floating-point number representation
Finite wordlength effect
Finite wordlength effect Ex: 402C000000000000 S Exponent Mantissa 4 2 C 1 S = 0 E = Exp-1023=1026-1023=3 M = 1+0.11 Check with MATLAB command: “hex2num” F = +(1.11)2x23 = (1110)2=14
Finite wordlength effect(cont’d) Step to convert from decimal number to IEEE stand. Check with MATLAB Use num2hex command S Exponent Mantissa 1 4 8
Finite wordlength effect(cont’d) How to add 2 numbers :- This is done by bit alignment (only mantissa) with refer to the biggest number. Finally, the Mantissa words are added in 2’s system. Example : 1015 Ans: 1.1100011010111111010100100110001101x21072-1023 Example : 1 Ans: 1.0x21023-1023 1015 Example : 1015+1 (show only Mantissa) Ans: 1 1 1 Right shift 49 bits 1
Finite wordlength effect(cont’d) 1 1 430C6BF526340008 How to substract 2 numbers :- Complement and done by bit alignment with refer to the biggest number 1015 Example : 1015-1 1 1 1 2’s of 1 1 1015-1 1
Finite wordlength effect(cont’d) 1 1 430C6BF52633FFF8 Will u try with the following problems? -1015 -1 -1015+1
Errors Error from numerical algorithm Truncation error Round-off error Overflow/Underflow Loss of significance Negligible addition Error magnification
Errors: Numerical algorithm Numerical integration on Error from exact solution = 0.1667 Error from exact solution = 0.0011
Errors: Numerical algorithm Numerical integration on
Errors: Truncation error Truncation error is resulted from truncation series. Ex. Say x = 1 find exp(x)
Error: Loss of significance Bad subtraction in finite wordlength can create loss of significance. See the following example: Try with x= 1,10,100,…1015
Error: Propagation error Errors are propagated with the four arithmetic Operations. Let the exact values are X and Y, where their related values are x and y, respectively.
Errors Accuracy. How close is a computed or measured value to the true value Precision (or reproducibility). How close is a computed or measured value to previously computed or measured values. Inaccuracy (or bias). A systematic deviation from the actual value. Imprecision (or uncertainty or variance). Magnitude of scatter.
Errors (cont’d)
Errors (cont’d) Error Definitions True Value = Approximation + Error Et = True value – Approximation (+/-) MATLAB Example True error
Errors (cont’d) What u can see is we can’t estimate the true error for all cases !! (why ?) So we use the following error definition instead. Approximation error …
Errors (cont’d) Apply approximation error to numerical approach (iterative) (+ / -) Meaning that the result is correct at least n significant figures Define criteria :- Compute until
Errors: Practical