You are on page 1of 14

Error Analysis

USC

Approximations and Roundoff Errors


For many engineering problems, we cannot obtain analytical solutions. Numerical methods yield approximate results, results that are close to the exact analytical solution. We cannot exactly compute the errors associated with numerical methods.

Only rarely given data are exact, since they originate from measurements. Therefore there is probably error in the input information. Algorithm itself usually introduces errors as well, e.g., unavoidable round-offs, etc The output information will then contain error from both of these sources.
2
USC

Order of operation
Addition problem:

0.99 + 0.0044 + 0.0042 = 0.9986


with 3-digit arithmetic:

exact result

(0.99 + 0.0044) + 0.0042 = 0.994 + 0.0042 = 0.998 0.99 + (0.0044 + 0.0042) = 0.99 + 0.0086 = 0.999
Round-off error

USC

Approximation and Roundoff Errors


q How

confident we are in our approximate result? q The question is how much error is present in our calculation and is it tolerable?

USC

q Accuracy.

How close is a computed or measured value to the true value (or reproducibility). How close is a computed or measured value to previously computed or measured values.

q Precision

USC

USC

Significant Figures
q

Number of significant figures indicates precision. Significant digits of a number are those that can be used with confidence, e.g., the number of certain digits plus one estimated digit.

53,800 How many significant figures? 5.38 x 104 5.380 x 104 5.3800 x 104 3 4 5

Zeros are sometimes used to locate the decimal point not significant figures. 0.00001753 0.0001753 0.001753 4 4 4 7

USC

The rules for identifying significant figures. q All non-zero digits are considered significant. q Zeros appearing anywhere between two non-zero digits are significant. q Leading zeros are not significant. 0.00052 has ? q Trailing zeros in a number containing a decimal point are significant. 12.2300 has six significant figures. 120.00 has five significant figures since it has three trailing zeros. q The number 0 has one significant figure. q The significance of trailing zeros in a number not containing a decimal point can be ambiguous.
q

USC

q 32-bit

machine: 7 significant digits machine: 17 significant digits

q 64-bit

USC

Error Definitions
True Value = Approximation + Error If p is approximation to true value p, then absolute error is Absolute error = |p p|
True error or relative error

absolute error relative error = true value

absolute error percent relative error, t = 100% true value


10
USC

For numerical methods, the true value will be known only when we deal with functions that can be solved analytically (simple systems). In real world applications, we usually will not know the answer a priori. Then

Approximate error a = 100% Approximation


q

Iterative approach, example Newtons method

Current approximation - Previous approximation a = 100% Current approximation


(+ / -) 11

USC

q q

Use absolute value. Computations are repeated until stopping criterion is satisfied.

a s
q

Pre-specified % tolerance based on the knowledge of your solution


(2 - n)

If the following criterion is met

s = (0.5 10

)%

you can be sure that the result is correct to at least n significant figures.
12

USC

Round-off Errors
Numbers such as p, e, or 7 cannot be expressed by a fixed number of significant figures. q Computers use a base-2 representation, they cannot precisely represent certain exact base-10 numbers. q Fractional quantities are typically represented in computer using floating point form, e.g.,
q

Integer part

m.be
mantissa

exponent Base of the number system used 13


USC

Chopping
Example: p=3.14159265358 to be stored on a base-10 system carrying 7 significant digits. p=3.141592 chopping error et=0.00000065 If rounded p=3.141593 et=0.00000035 q Some machines use chopping, because rounding adds to the computational overhead. Since number of significant figures is large enough, resulting chopping error is negligible.
14
USC

You might also like