Download presentation
Presentation is loading. Please wait.
1
Errors and Error Analysis Lecture 2
2
Define Error: True Value (a) = Approximate Value ๐ + Error (ฮต)
Absolute Error: ฮต= ๐โ ๐ Relative Error: ๐= ๐ ๐ = ๐โ ๐ ๐ Relative error is often expressed as (%) by multiplying (e) with 100. Absolute error can have sign as well as | . | If the error is computed with respect to the true value (if known), a prefix โTrueโ is added. For an iterative process, the true value โaโ is replaced with the previous iteration value and a prefix โapproximateโ is added. This is used for testing convergence of the iterative process.
3
Sources of Error in computation?
Errors in the Input data: initial and boundary conditions, measured values of the parameters and constants in the model Round-off error: irrational numbers, product and division of two numbers, limited by the machine capability Truncation error: truncation of an infinite series, often arises in the design of the numerical method through approximation of the mathematical problem.
4
Summary Typically, true error is never known
Significant digits/figures are the numbers that one can use with confidence Example: d = 100 ยฑ 1 m, t = 3.0 ยฑ 0.1 s, v = d/t = ? True error = True value โ Measured/Computed value approximate error error bound Typically, true error is never known
5
Summary Types of error Model error Data error: y =๐(๐ฅ) Truncation error: error committed when a limiting process is truncated before one has reached the limiting value e.g. ๐ ๐ ๐ ๐ฅ ๐๐ฅ ~ lim ๐โโ ๐=1 ๐ ๐( ๐ฅ ๐ )ฮ ๐ฅ ๐ Taylor series expansion of a function Round-off error because of finite nature of computer storage capacity
6
Error Analyses: Forward Error Analysis: Backward Error Analysis:
How an error in the given input propagates through the system model. (Robustness of the model) Backward Error Analysis: Quantification of error resulting from interaction between round-off error and truncation error in the algorithm. (Robustness of the algorithm) Error in the Input Error in the Output Both computations are using the original Mathematical Model Error in the Output Computation using numerical algorithm Computation using mathematical problem
7
Forward Error Analysis: Single Variable Function: y = f(x)
Forward Error Analysis: Single Variable Function: y = f(x). If an error is introduced in x, what is the error in y? โ๐ฅ=๐ฅโ ๐ฅ โ๐ฆ=๐ฆโ ๐ฆ =๐ ๐ฅ โ๐ ๐ฅ ๐ ๐ฅ =๐ ๐ฅ +โ๐ฅ =๐ ๐ฅ +โ๐ฅ ๐ โฒ ๐ฅ + โ๐ฅ 2 2! ๐ โฒโฒ ๐ฅ +.. Assuming the error to be small, the 2nd and higher order terms are neglected. (a first order approximation!) โ๐ฆ=๐ ๐ฅ โ๐ ๐ฅ โโ๐ฅ ๐ โฒ ๐ฅ
8
Propagation of Errors: For any x, and a corresponding y = f(x) e. g
Propagation of Errors: For any x, and a corresponding y = f(x) e.g., ๐ฅ=1.5 ยฑ0.05 and y =3.4 ยฑ0.04 (x + y)max = = 4.99 (x + y)min = = 4.81 Thus, 4.81 โค (x + y) โค 4.99 ๐๐กโ๐๐ ๐๐ข๐๐๐ก๐๐๐๐ ๐๐๐ฆ ๐๐๐ ๐ โ๐๐ฃ๐ ๐๐๐๐๐ ๐๐๐๐๐๐๐๐ก๐๐๐ ๐ ๐ข๐โ ๐๐ ๐ฅ๐ฆ; ๐ฅ ๐ฆ ; or a function of n variables f(x1, x2, โฆ, xn) โ ๐ x1, x2, โฆ, xn = ๐๐ ๐ ๐ฅ 1 โ ๐ฅ 1 + ๐๐ ๐ ๐ฅ 2 โ ๐ฅ 2 +โฆ
9
Condition Number of the Problem (Cp):
๐ถ ๐ = ๐
๐๐๐๐ก๐๐ฃ๐ ๐ธ๐๐๐๐ ๐๐ ๐ฆ ๐
๐๐๐๐ก๐๐ฃ๐ ๐ธ๐๐๐๐ ๐๐ ๐ฅ = โ๐ฆ ๐ฆ โ๐ฅ ๐ฅ โ โ๐ฅ ๐ โฒ ๐ฅ ๐ ๐ฅ โ๐ฅ ๐ฅ = ๐ฅ๐ โฒ ๐ฅ ๐ ๐ฅ Also: ๐ถ ๐ = โ๐ฆ ๐ฆ โ๐ฅ ๐ฅ = ๐ ๐ฅ โ๐ ๐ฅ ๐ ๐ฅ โ๐ฅ ๐ฅ = ๐ฅ ๐ ๐ฅ ๐ ๐ฅ +โ๐ฅ โ๐ ๐ฅ โ๐ฅ As ฮx โ 0, ๐ถ ๐ = ๐ฅ๐ โฒ ๐ฅ ๐ ๐ฅ Cp < 1: problem is well-conditioned, error is attenuated Cp > 1: problem is ill-conditioned, error is amplified Cp = 1: neutral, error is translated
10
Examples of Forward Error Analysis and Cp:
Problem 1: ๐ฆ= ๐ ๐ฅ ; โ๐ฆ=โ๐ฅ ๐ ๐ฅ ; ๐ถ ๐ = โ๐ฆ ๐ฆ โ๐ฅ ๐ฅ =๐ฅ. The problem is well-conditioned for 0 โค | x | < 1; neutral at | x | = 1 and ill- conditioned for | x | > 1. Problem 2: Solve the following system of equations: x + ฮฑy = 1; ฮฑx + y = 0 Solving: ๐ฅ= 1 1โ ๐ผ 2 =๐ฅ ๐ผ ; ๐ฅ โฒ ๐ผ = 2๐ผ 1โ ๐ผ 2 2 ๐ถ ๐ = ๐ผ ๐ฅ โฒ ๐ผ ๐ฅ = ๐ผ 2๐ผ 1โ ๐ผ โ ๐ผ 2 = 2 ๐ผ 2 1โ ๐ผ 2 well-conditioned for โฮฑโ<< 1 and ill-conditioned for ฮฑ โ 1.
11
Forward Error Analysis: Function of Multiple Variables: y = f(X), where X is a vector, X = {x0, x1, โฆ.. xn}. If error is introduced in the xiโs, what is the error in y? โ๐=๐โ ๐ = ๐ฅ 0 โ ๐ฅ 0 ๐ฅ 1 โ ๐ฅ 1 โฎ ๐ฅ ๐ โ ๐ฅ ๐ = โ ๐ฅ 0 โ ๐ฅ 1 โฎ โ ๐ฅ ๐ ๐ ๐ =๐ ๐ + ๐=1 ๐ โ ๐ฅ ๐ ๐๐ ๐ ๐ฅ ๐ ๐ +๐ป๐๐ โ๐ฆ=๐ฆโ ๐ฆ =๐ ๐ โ๐ ๐ โ ๐=1 ๐ โ ๐ฅ ๐ ๐๐ ๐ ๐ฅ ๐ ๐ An upper bound of โ๐ฆ= ๐=1 ๐ โ ๐ฅ ๐ ๐๐ ๐ ๐ฅ ๐ ๐
12
Backward Error Analysis:
What is the perturbation required in the input in order to explain the error in the output if the computation is carried out by true mathematical function without any error? Error in the Output Computation using numerical algorithm Computation using mathematical problem Hypothetical error in the Input computed using backward error analysis Error in the Output Both computations are using the original Mathematical Model
13
Floating point representation of a number = ฯ ร m ร bq
ฯ contains the sign of a number (+1, -1) m = mantissa; 1/b โค m < 1 b = base; 2 for binary, 10 for decimal, 16 for hexadecimal ๐โโ (set of rationals) If a machine (computer) rounds a number off to โtโ decimal places, for a positive number ๐ : ๐=๐ร 10 ๐ ; ๐ = ๐ ร 10 ๐ ๐โ ๐ โค0.5ร 10 โ๐ก Machine round-off unit (u) is the upper bound of the relative error in one round- off operation ๐โ ๐ ๐ โค 0.5ร 10 โ๐ก ร 10 ๐ ๐ร 10 ๐ โค0.5ร 10 1โ๐ก =๐ข Condition Number of Algorithm (Ca): change necessary in the input data in order to explain the error in the final result expressed in terms of u. Upon dividing Ca by u, CN of problem can be made machine independent IEEE-754 code is used to store single and double-precision numbers in computers for base 2
14
fl(x ร y) = x ร y(1 + ฮด) โค x ร y(1 + u) where | ฮด | โค u
Consider one floating point operation fl(x op y). โopโ can be any of +, -, ร, /. By definition of u: ๐๐ ๐ฅ op ๐ฆ โ ๐ฅ op ๐ฆ ๐ฅ op ๐ฆ โค๐ข Letโs consider the op as ร : fl(x ร y) = x ร y(1 + ฮด) โค x ร y(1 + u) where | ฮด | โค u Example: A machine with t = 2, Machine round-off unit u = 0.5ร 10 1โ๐ก (derived earlier) = 0.5 ร101-2 = 0.05 For x = 0.30 and y = 0.51, x ร y = 0.153; fl (x ร y) = 0.15 Relative error = |( )/0.153| = 0.02 โค u (= 0.05) For this operation: ฮด = -0.01; | ฮด | = โค u (= 0.05)
15
Multiple Floating Point Operations:
๐๐ ๐ฅ 1 ร ๐ฅ 2 ร ๐ฅ 3 รโฆร ๐ฅ ๐ = ๐ฅ 1 ร ๐ฅ ๐ฟ 1 ร ๐ฅ ๐ฟ 2 รโฆ ๐ฅ ๐ 1+ ๐ฟ ๐โ1 ๐ฟ ๐ โค๐ข ๐๐๐ ๐=1, 2, โฆ ๐โ1 Relative error in the final computed value: ๐= ๐๐ ๐ฅ 1 ร ๐ฅ 2 ร ๐ฅ 3 รโฆร ๐ฅ ๐ โ ๐ฅ 1 ร ๐ฅ 2 ร ๐ฅ 3 รโฆร ๐ฅ ๐ ๐ฅ 1 ร ๐ฅ 2 ร ๐ฅ 3 รโฆร ๐ฅ ๐ = 1+ ๐ฟ ๐ฟ 2 โฆ 1+ ๐ฟ ๐โ1 โ1 โค 1+๐ข ๐โ1 โ1 The quantity 1+๐ข ๐โ1 โ1 may be approximated as 1.06(n-1)u for (n-1)u < 0.1 using binomial expansion (Try!)
16
Compute ๐ฆ= 1+ sin ๐ฅ โ1 for x = 1ยฐ
Example: Using a machine with 4-decimal place precision, t = 4, u = 0.5 ร101-4 = 0.5 ร10-3 Compute ๐ฆ= 1+ sin ๐ฅ โ1 for x = 1ยฐ ๐๐ ๐ฅ = ๐ 180 =0.1745ร 10 โ1 ๐๐ sin ๐ฅ =0.1745ร 10 โ1 ๐๐ 1+sin ๐ฅ =0.1017ร 10 1 ๐๐ 1+ sin ๐ฅ =0.1008ร 10 1 ๐๐ 1+ sin ๐ฅ โ1 =0.8000ร 10 โ2 True value of y using infinite precision is ร10-2 Solve the remaining problem to find the condition number of the algorithm
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.