Theory of Errors
Content Errors in computation Absolute Error Relative Error Roundoff Errors Truncation Errors Floating Point Numbers Normalized Floating Point Numbers Roundoff Error in Floating Point Arithmetic Operations
Errors in Computation There are two types of errors in the computational work: Inherent errors are those that exist in the data before such calculations. Acquired errors are produced during the calculation either rounding or truncations.
Absolute Error The error in a quantity is defined as the difference between the true value and the calculated or measured value, ie: Let us denote the symbol for any arithmetic operation +,,,.
Absolute Error The error in an amount will be denoted by, where and are known quantities that contain errors and respectively, which may be errors inherent or acquired. Then the error amount is
Absolute Error 1. Addition: 2. Subtraction: 3. Multiplication:, neglecting 4. Division:, if 1
Absolute Error Adding the rounding or truncation errors: 1. Addition: 2. Subtraction: σ 3. Multiplication: 4. Division:
Relative Error The relative error in an amount is defined as the ratio between the absolute value and its true value, most commonly defined in relation to the measured or calculated value, such that: then
Relative Error 1. Addition: 2. Subtraction: 3. Multiplication: 4. Division:
Relative Error
Relative Error Example. Form the sum of the real numbers,,, which have relative errors,,,, respectively. Let denote the relative roundoff error in the kth addition.
Relative Error
Relative Error
Roundoff Errors Roundoff errors arise because the computer can only store a fixed number of significant figures in the calculation.
Truncation Errors Are those that result when using an approximation rather than an exact mathematical procedure.
Floating Point Numbers where: is the coefficient or mantissa is the base of the number system is the exponent
Floating Point Numbers Example: 245.3 N = 245.3(10 0 ) N = 24.53(10) N = 2.453(10 2 ) N = 0.2453(10 3 ) N = 0.02453(10 4 )
Normalized Floating Point Numbers If the coefficient is a proper fraction F in the base system such that: 1/ 1 then expressed in number is called a normalized floating point number NFPN Example: Normalized: 0.2453 (10 3 ) No Normalized: 245.3
Roundoff Errors in Floating Point Arithmetic Operations The mantissa of the result, where = +,,,, and where and are proper fractions containing d digits; can have up to 2d digits if it is formed in a double length accumulator. However, if we can only store numbers having mantissas with a maximum d digits, then it is necessary to round off the mantissa before storing in Z. The leftmost d digits in the double length accumulator are the most significant, and are denoted by F, while the rightmost d digits are the least significant, and are denoted by f.
Roundoff Errors in Floating Point Arithmetic Operations Then Z can be expressed in the form 10 10 Example: d = 4, X = 0.4836(10 3 ), Y = 0.5123(10 2 ), Z = X Y =? Z = 0.24774828(10 5 ) = [0.2477 + 0.00004828] 10 5 = 0.2477(10 5 ) + 0.4828(10 5 4 )
Roundoff Errors in Floating Point Arithmetic Operations General Rule for Rounding: If f 0.5 then Z = F 10 (truncation) If f 0.5 then Z = F 10 10 (roundoff) Then as in Example f <0.5, the value of Z is rounded 0.2477 (10 5 ) Assuming, for the same example, that f > 0.5, then the value of Z would rounded 0.2477 (10 5 ) + 10 5 4 = 0.2477 (10 5 ) + 10 = 24770 + 10 = 24780 = 0.2478 (10 5 ).
Roundoff Errors in Floating Point Arithmetic Operations Maximum rounding error: The absolute rounding error interpret it as:,,, If f < 0.5 then 10 then the absolute maximum rounding error will be 0.4999 10 If f 0.5 then 1 10 then the absolute maximum rounding error will 0.5 10 Then in both cases the absolute maximum rounding error is: 0.5 10 0.5 10
Roundoff Errors in Floating Point Arithmetic Operations Relative Error Rounding: The relative rounding error interpret it as:,,, Relative maximum rounding error: 0.5 10 0.1 10 5 10 5 10
Roundoff Errors in Floating Point Arithmetic Operations Example: They are two numbers in NFPN: N1 = 0.3478239 (10 12 ) N2 = 0.62548971 (10 11 ) With relative errors: r1 = 0.1237 (10 3 ) r2 = 0.1082 (10 3 )? Whereas to be rounded to 3 significant digits.
Roundoff Errors in Floating Point Arithmetic Operations N 1 +N 2 =0.3478239(10 12 )+0.62548971(10 11 ) N 1 +N 2 =[0.3478239+0.62548971(10 1 )] 10 12 N 1 +N 2 =0.410372871(10 12 ) F=0.410(10 12 ); f=0.372871(10 9 )<0.5(10 9 ) Z=0.410(10 12 ) zr =f=0.372871(10 9 )= r zr = zr /Z=[0.372871(10 9 )]/[0.410(10 12 )]=0.909411(10 3 )= r (N1+N2) =[r 1 N 1 /(N 1 +N 2 )]+[r 2 N 2 /(N 1 +N 2 )]+ =0.1030779(10 2 ) N O + N O +R= N (N1+N2) =zr (N1+N2) =[0.410(10 12 )][0.1030779(10 2 )]=0.4226194(10 9 )
Homework 2 1. Calculate the absolute error that occurs to form the product of real numbers,,,, which have relative errors,,,, respectively. Consider represents the relative rounding error in each product. Also enter the formula for the general case. 2. If the coefficients,,, polynomial,, have relative errors,,, respectively, determine the absolute error in for a given value of with relative error. Use the nested Horner method to evaluate the polynomial and consider and as the relative rounding errors in operations. 3. Calculate the relative rounding error numbers below NFPN, consider rounding to 4 digits: a) x = 0.32147282 (10 5 ), d = 4 b) y = 0.14532778 (10 5 ), d = 4
Homework 2 4. They are two numbers in NFPN: x = 0.7325(10 7 ) and y = 0.3942(10 8 ) with relative errors: r x = 0.1023(10) and r = 0.1104(10 2 ) respectively. Calculate the absolute error ( ) to add, subtract, multiply and divide those numbers, considering that the result should be rounded to 4 digits. Hint: Calculate the first operation to assess the rounding error and then apply NONOR. 5. Repeat the previous exercise but considering the relative maximum rounding error.
Theory of Errors