This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 28 The Main Sources of Error Truncation Error Truncation error is defined as the error caused directly by an approximation method. For instance, all numerical integration methods are approximations and so there is error, even if the calculations are performed exactly. Numerical differentiation also has a truncation error, as will the differential equations methods we will study in Part IV, which are based on numerical differentiation formulas. There are two ways to minimize truncation error: (1) use a higher order method, and (2) use a finer grid so that points are closer together. Unless the grid is very small, truncation errors are usually much larger than roundoff errors. The obvious tradeoff is that a smaller grid requires more calculations, which in turn produces more roundoff errors and requires more running time. Roundoff Error Roundoff error always occurs when a finite number of digits are recorded after an operation. For tunately, this error is extremely small. The standard measure of how small is called machine epsilon . It is defined as the smallest number that can be added to 1 to produce another number on the machine, i.e. if a smaller number is added the result will be rounded down to 1. In IEEE standard double precision (used by Matlab and most serious software), machine epsilon is 2 52 or about 2 . 2 10 16 . A different, but equivalent, way of thinking about this is that the machine records 52 floating binary digits or about 15 floating decimal digits. Thus there are never more than 15 significant digits in any calculation. This of course is more than adequate for any application. However, there are ways in which this very small error can cause problems. To see an unexpected occurence of roundoff try the following commands: > (2^52+1)  2^52 > (2^53+1)  2^53 Loss of Precision (also called Loss of Significance) One way in which small roundoff errors can become more significant is when significant digits cancel. For instance, if you were to calculate: 1234567(1 . 9999987654321) then the result should be 1 . 52415678859930 . 97 98 LECTURE 28. THE MAIN SOURCES OF ERROR But, if you input: > 1234567 * ( 1  .9999987654321) you will get: > 1.52415678862573 In the correct calculation there are 15 significant digits, but the Matlab calculation has only 11 significant digits. Although this seems like a silly example, this type of loss of precision can happen by accident if you are not careful. For example in f ( x ) ( f ( x + h ) f ( x )) /h you will lose precision when h gets too small. Try: > format long > f=inline(x^2,x) > for i = 1:30 > h=10^(i) > df=(f(1+h)f(1))/h > relerr=(2df)/2 > end At first the relative error decreases since truncation error is reduced. Then loss of precision takes over and the relative error increases to 1....
View Full
Document
 Fall '08
 Young,T
 Approximation

Click to edit the document details