Numerical Analysis CC413 Propagation of Errors.

Slides:



Advertisements
Similar presentations
Truncation Errors and Taylor Series
Advertisements

Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
3- 1 Chapter 3 Introduction to Numerical Methods Second-order polynomial equation: analytical solution (closed-form solution): For many types of problems,
Roundoff and truncation errors
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Computational Modeling for Engineering MECN 6040
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Approximations and Errors
NUMERICAL ERROR ENGR 351 Numerical Methods for Engineers
Part 3 Truncation Errors Second Term 05/06.
Round-Off and Truncation Errors
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors.
Revision.
Part 3 Truncation Errors.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 5 Approximations, Errors and The Taylor Series.
NUMERICAL ERROR ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
Computer Programming (TKK-2144) 13/14 Semester 1 Instructor: Rama Oktavian Office Hr.: M.13-15, W Th , F
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Introduction and Analysis of Error Pertemuan 1
Chapter 1 Scientific Computing Approximation in Scientific Computing (1.2) January 12, 2010.
MMJ 1113 Computational Methods for Engineers Mohsin Mohd Sies Fakulti Kejuruteraan Mekanikal, Universiti Teknologi Malaysia.
Lecture 2 Number Representation and accuracy
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
CISE301_Topic11 CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4:
EE 3561_Unit_1(c)Al-Dhaifallah EE 3561 : - Computational Methods in Electrical Engineering Unit 1: Introduction to Computational Methods and Taylor.
ES 240: Scientific and Engineering Computation. Chapter 4 Chapter 4: Errors Uchechukwu Ofoegbu Temple University.
Round-off Errors.
Introduction to error analysis Class II "The purpose of computing is insight, not numbers", R. H. Hamming.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University 1 Chapter 1 Mathematical.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter.
NUMERICAL ERROR Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Meeting 15 Introduction to Numerical Methods Error Analysis.
Introduction to computing
Errors in Numerical Methods
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Truncation Errors and the Taylor Series Chapter 4.
ESO 208A/ESO 218 LECTURE 2 JULY 31, ERRORS MODELING OUTPUTS QUANTIFICATION TRUE VALUE APPROXIMATE VALUE.
Numerical Analysis CC413 Propagation of Errors. 2 In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Introduction to error analysis Class II "The purpose of computing is insight, not numbers", R. H. Hamming.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
1 Approximations and Round-Off Errors Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis Applied Numerical Method for Engineers Chapter.
CSE 330: Numerical Methods. What is true error? True error is the difference between the true value (also called the exact value) and the approximate.
Numerical Methods and Optimization C o u r s e 1 By Bharat R Chaudhari.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Chapter 2 Errors in Numerical Methods and Their Impacts.
NUMERICAL ANALYSIS I. Introduction Numerical analysis is concerned with the process by which mathematical problems are solved by the operations.
Introduction to Numerical Analysis I
Machine arithmetic and associated errors Introduction to error analysis Class II.
New head garb has been ordered
Floating Point Numbers: x 10-18
Machine arithmetic and associated errors Introduction to error analysis (cont.) Class III.
Taylor series in numerical computations (review)
Chapter 2 ERROR ANALYSIS
Roundoff and Truncation Errors
Approximations and Round-Off Errors Chapter 3
SKTN 2393 Numerical Methods for Nuclear Engineers
Chapter 2: Floating point number systems and Round-off error
Chapter 1 / Error in Numerical Method
Roundoff and Truncation Errors
Errors and Error Analysis Lecture 2
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Presentation transcript:

Numerical Analysis CC413 Propagation of Errors

Propagation of Errors In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate through the calculations?

Underflow and Overflow Numbers occurring in calculations that have a magnitude less than 2 -1023 .(1+2 -52) result in underflow and are generally set to zero. Numbers greater than 2 1024 .(2-2 -52) result in overflow.

Significant Figures 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 3 5.380 x 104 4 5.3800 x 104 5 Zeros are sometimes used to locate the decimal point not significant figures. 0.00001753 4 0.0001753 4 0.001753 4

Error Definitions Numerical error - use of approximations to represent exact mathematical operations and quantities true value = approximation + error error, et=true value - approximation subscript t represents the true error shortcoming....gives no sense of magnitude normalize by true value to get true relative error

Example 1: Find the bounds for the propagation in adding two numbers. For example if one is calculating X +Y where X = 1.5 ± 0.05 Y = 3.4 ± 0.04 Solution Maximum possible value of X = 1.55 and Y = 3.44 Maximum possible value of X + Y = 1.55 + 3.44 = 4.99 Minimum possible value of X = 1.45 and Y = 3.36. Minimum possible value of X + Y = 1.45 + 3.36 = 4.81 Hence 4.81 ≤ X + Y ≤4.99.

Example 2: The strain in an axial member of a square cross-section is given by Given Find the maximum possible error in the measured strain.

Example 2: Solution THG picture http://numericalmethods.eng.usf.edu

Error definitions cont. True relative percent error

Example Consider a problem where the true answer is 7.91712. If you report the value as 7.92, answer the following questions. What is the true error? What is the relative error?

Example Determine the absolute and relative errors when approximating p by p∗ when

Solution This example shows that the same relative error, 0.3333×10−1, occurs for widely varying absolute errors. the absolute error can be misleading and the relative error more meaningful, because the relative error takes into consideration the size of the value.

Error Definitions cont. Round off error – Symmetric rounding originate from the fact that computers retain only a fixed number of significant figures: y = 0.73248261 to be 0.7325 Error = y-round(y) = 0.00001739 and relative error = error /y = -0.000024 Truncation errors – Chopping errors that result from using an approximation in place of an exact mathematical procedure: y = 0.73248261 to be 0.7324 Error = 0.0008261 and relative error = 0.00011

Example Determine the five-digit (a) chopping and (b) rounding values of the irrational number π. Solution The number π has an infinite decimal expansion of the form π = 3.14159265. . . . Written in normalized decimal form, we have π = 0.314159265 . . . × 10. (a) The floating-point form of π using five-digit chopping is f l(π) = 0.31415 × 10 = 3.1415. (b) The sixth digit of the decimal expansion of π is a 9, so the floating-point form of π using five-digit rounding is f l(π) = (0.31415 + 0.00001) × 10 = 3.1416.

Computations are repeated until stopping criterion is satisfied. Use absolute value. Computations are repeated until stopping criterion is satisfied. If the following criterion is met you can be sure that the result is correct to at least n significant figures. Pre-specified % tolerance based on the knowledge of your solution

Numerical Stability Rounding errors may accumulate and propagate unstably in a bad algorithm. Can be proven that for Gaussian elimination the accumulated error is bounded

Example Solution: Note that  Suppose that x = 57 and y = 13. Use five-digit chopping for calculating x + y, x − y, x × y, and x ÷ y. Solution: Note that 

Solution (Cont.)

Chopping Errors (Error Bounds Analysis) Suppose the mantissa can only support n digits. Thus the absolute and relative chopping errors are Suppose ß = 10 (base 10), what are the values of ai such that the errors are the largest?

Chopping Errors (Error Bounds Analysis)

Round-off Errors (Error Bounds Analysis) Round down Round up fl(z) is the rounded value of z

Round-off Errors (Error Bounds Analysis) Absolute error of fl(z) When rounding down Similarly, when rounding up i.e., when

Round-off Errors (Error Bounds Analysis) Relative error of fl(z)

Summary of Error Bounds Analysis Chopping Errors Round-off errors Absolute Relative β base n # of significant digits or # of digits in the mantissa Regardless of chopping or round-off is used to round the numbers, the absolute errors may increase as the numbers grow in magnitude but the relative errors are bounded by the same magnitude.

Machine Epsilon Relative chopping error Relative round-off error eps is known as the machine epsilon – the smallest number such that 1 + eps > 1 epsilon = 1; while (1 + epsilon > 1) epsilon = epsilon / 2; epsilon = epsilon * 2; Algorithm to compute machine epsilon

Exercise Discuss to what extent (a + b)c = ac + bc is violated in machine arithmetic.

How does a CPU compute the following functions for a specific x value? cos(x) sin(x) ex log(x) etc. Non-elementary functions such as trigonometric, exponential, and others are expressed in an approximate fashion using Taylor series when their values, derivatives, and integrals are computed. Taylor series provides a means to predict the value of a function at one point in terms of the function value and its derivatives at another point.

Taylor Series (nth order approximation): The Reminder term, Rn, accounts for all terms from (n+1) to infinity. Define the step size as h=(xi+1- xi), the series becomes:

Any smooth function can be approximated as a polynomial. Take x = xi+1 Then f(x) ≈ f(xi) zero order approximation first order approximation Second order approximation: nth order approximation: Each additional term will contribute some improvement to the approximation. Only if an infinite number of terms are added will the series yield an exact result. In most cases, only a few terms will result in an approximation that is close enough to the true value for practical purposes

Taylor Series Expansion

Example Use zero through fourth order Taylor series expansion to approximate f(1) given f(0) = 1.2 (i.e. h = 1) Note: f(1) = 0.2

Solution n=0 n=1 f(1) = 1.2 et = abs [(0.2 - 1.2)/0.2] x 100 = 500% f '(x) = -0.4x3 - 0.45x2 -x -0.25 f '(0) = -0.25 f(1) = 1.2 - 0.25h = 0.95 et =375%

Solution n=2 f "=-1.2 x2 - 0.9x -1 f "(0) = -1 f(1) = 0.45 et = 125%

Solution n=4 f ""(0) = -2.4 f(1) = 0.2 EXACT Why does the fourth term give us an exact solution? The 5th derivative is zero In general, nth order polynomial, we get an exact solution with an nth order Taylor series

Example Approximate the function f(x) = 1. 2 - 0. 25x - 0. 5x2 - 0 Example Approximate the function f(x) = 1.2 - 0.25x - 0.5x2 - 0.15x3 - 0.1x4 from xi = 0 with h = 1 and predict f(x) at xi+1 = 1.

Taylor Series Problem Use zero- through fourth-order Taylor series expansions to predict f(4) for f(x) = ln x using a base point at x = 2. Compute the percent relative error et for each approximation.

computing f(x) = ex using Taylor Series expansion Example: computing f(x) = ex using Taylor Series expansion Choose x = xi+1 and xi = 0 Then f(xi+1) = f(x) and (xi+1 – xi) = x Since First Derivative of ex is also ex : (2.) (ex )” = ex (3.) (ex)”’ = ex, … (nth.) (ex)(n) = ex As a result we get: Looks familiar? Maclaurin series for ex

computing f(x) = cos(x) using Taylor Series expansion Yet another example: computing f(x) = cos(x) using Taylor Series expansion Choose x=xi+1 and xi=0 Then f(xi+1) = f(x) and (xi+1 – xi) = x Derivatives of cos(x): (1.) (cos(x) )’ = -sin(x) (2.) (cos(x) )” = -cos(x), (3.) (cos(x) )”’ = sin(x) (4.) (cos(x) )”” = cos(x), …… As a result we get:

Error Propagation Let xfl refer to the floating point representation of the real number x. Since computer has fixed word length, there is a difference between x and xfl (round-off error) and we would like to estimate the error in the calculation of f(x) : Both x and f(x) are unknown. If xfl is close to x, then we can use first order Taylor expansion and compute: Result: If f’(xfl) and Dx are known, then we can estimate the error using this formula