ERROR Unlike analytical solutions, numerical methods have an error range. In addition to this input data may have errors. There are 5 basis source of error: The Source of Error 1. Measuring Errors Data is obtained by observations and some tests. Data may have errors based on envoirement and system where the measurement is made. 2. Rounding Off Errors Numbers are stored in computer memory with a limited precision; the loss of precision of a value is called a round-off error. Round-off errors are associated with the limited number of digits that are used to represent numbers in a computer. For example in a computer system with 64 bit, since 52 binary digits correspond to between 16 and 17 decimal digits, we can assume that a number represented in this system has at least 16 decimal digits of precision. The round-off errors can occur when a value is initially assigned and can be compounded
2 when values are combined in arithmetic operations. Iteration is common in computational methods and so it is important to minimise compound roundoff. 3. Truncation Errors Truncation Errors is caused by the approximations used in the discrete mathematical equations used in a mathematical algorithm to approximate continuous operations. Taylor series are one of the most important means used to derive numerical schemes for computation and to analyze these truncation errors. 4. Human Based Errors 5. Computer Based Errors Error Types 1. Absolute Error: Absolute error is the difference between an approximated or measured value and it's actual value. ε m = y g y y ε m :Absolute error; y g :Actual value; y y : Approximate value;
3 2. Relative Error: Relative error gives an relational indication of how good a measurement is relative to the size of the thing being measured. In many problems, relative error gives better indication than absolute error about how good the approximate result. ε b = y g y y y g ε b :Relative error; y g :Actual value; y y : Approximate value; Bağıl hata 100 ile çarpılarak % bağıl hata olarak kullanılabilir. Örneğin bir füzenin menzilinin (rocket range) gerçek değeri 5000 km ise ve yapılan hesaplamalarda bu 4999 km olarak bulunuyorsa, buradaki gerçek hata=5000-4999= 1 dir. Başka bir örneği inceleyecek olursak bir aracın ulaşabileceği maksimum hızın gerçek değeri 50 km/s iken yapılan hesaplamalarda 49 km/s bulunuyorsa bu durumda da mutlak hata=50-49=1 km/s dir. İki durumda da hata 1 km olarak çıkmaktadır. Fakat daha adil bir değerlendirme yapabilmek için yüzde olarak hatalarına bakıldığında ortaya çıkan hatanın büyüklükleri daha net ortaya konulacaktır. Birinci örnekte; ε b = 5000 4999 = 0,0002 dir. 5000 Yüzde bağıl hata == 5000 4999 100 = %0,02 dir. 5000
4 İkinci örnekte; ε b = 50 49 50 = 0,02 dir. Yüzde bağıl hata == 50 49 50 100 = %2 dir. Bu iki hesaplamada hataların büyüklüklerini bağıl hataları dikkate alarak daha objektif olarak değerlendirebiliriz. 3. Approximation Error: If you do not know actual value of problem, you can use approximation error instead of absolute and relative error. The approximation errors can be calculated step by step in an iteration. The previous iteration's result is compared with present iteration result. ε y = y pres y prev y pres ε y :Approximation error; y prev :The solution obtained in previous iteration; y pres : The solution obtained in present iteration; Example: Series expansion of e x is e x = 1 + x 1! + x2 + x 3 2! 3! + + x Assume e 0,5 =1,648721271, by make use of series expansion of e x,find relative and approximate errors. n n!
5 For x = 0.5 ; The first term e x = 1 The first two terms e x = 1 + x = 1 + 0,5 = 1,5. So the relative and approximation error; ε b = e0,5 1,5 e 0,5 100 = 1,648721271 1,5 100 = %9,02 1,648721271 ε y = y yeni y eski y yeni = 1,5 1 1,5 100 = %33,3 Term Number Result ε b ε y 1 1 39,3-2 1,5 9,02 33,3 3 1,625 1,44 7,69 4 1,64583333 0,175 1,27 5 1,64843750 0,0172 0,158 6 1,64869791 0,00142 0,0158 7 1,64871961 0,0001007 0,001316
6 Finite-Digit Arithmetic Ex: Suppose that x = 5 and y = 1. Use five-digit chopping for calculating 7 3 a) x + y =? b) x y =? c) x y =? d) x y =? Çözüm: x = 5 = 0,714285 after chopping x = 0,71428 100 7 y = 1 = 0,333333 after chopping y = 0,33333 100 3 a) x + y = (0,71428 + 0,33333) 10 0 = 0,10476 10 1 b) x y = (0,71428 0,33333) 10 0 = 0,38095 10 0 c) x y = (0,71428 0,33333) 10 0 = 0,28809 10 1 d) x = 0,71428 = 0,21428 100 y 0,33333 Errors; a) x + y = 22 ε = 22 0,10476 21 21 101 = 0,190 10 4 b) x y = 8 21 ε = 8 21 0,38095 100 = 0,238 10 5 c) x y = 5 21 ε = 5 21 0,28809 101 = 0,524 10 5
7 d) x y = 15 7 ε = 15 7 0,21428 101 = 0,571 10 4 Ex: Let p = 0,54617 and q = 0,54601. Use four-digit arithmetic to approximate p q and determine the absolute and relative errors using (a) rounding and (b) chopping. Çözüm: First by chopping; p = 0,5461 10 0 ve q = 0,5460 10 0 Yaklaşık p q = 0,1 10 3 ve gerçek p q = 0,16 10 3 ise; ε = 0,16 10 3 0,1 10 3 = 0,6 10 4 ε = 0,6 10 4 = 0,375 0,16 10 3 By rounding; p = 0,5462 10 0 ve q = 0,5460 10 0 Yaklaşık p q = 0,2 10 3 ve gerçek p q = 0,16 10 3 ise; ε = 0,16 10 3 0,2 10 3 = 0,4 10 4 ε b = 0,4 10 4 = 0,25 0,16 10 3
8 Nested Arithmetic Accuracy loss due to round-off error can also be reduced by rearranging calculations, as shown in the next example. Ex: Evaluate f(x) = x 3 6,1 x 2 + 3,2 x + 1,5 for x = 4.71 using three-digit arithmetic. Çözüm: x = 4,71 x 2 = 0,221841 10 2 after chopping x 2 = 0,221 10 2 x 3 = 0,104487111 10 3 after chopping x 3 = 0,104 10 3 f(4,71) = 104 6,1 22,1 + 3,2 4,71 + 1,5 = 104 134 + 15 + 1,5 = 13,5 Gerçek f(4,71) = 14,263899 ε = 14,263899 ( 13,5) = 0,763899 ε b = 0,763899 14,263899 = 0,0535 Let's arrange the f(x) function to reduce the error: f(x) = x (x(x 6,1) + 3,2) + 1,5 f(4,71) = 14,2 ε = 14,263899 ( 14,2) = 0,06389
9 ε b = 0,06389 14,263899 = 0,0045 Kaynakça Richard L. Burden, Richard L. Burden (2009). Numerical Analysis Brooks/Cole Cengage Learning, Boston. Doç. Dr. İbrahim UZUN, (2004), "Numarik Analiz Beta Yayıncılık.