Approximations and Round-Off Errors Chapter 3

Slides:



Advertisements
Similar presentations
Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Advertisements

Roundoff and truncation errors
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Floating Point Numbers
1 IEEE Floating Point Revision Guide for Phase Test Week 5.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Approximations and Errors
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.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Floating Point Numbers
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Introduction and Analysis of Error Pertemuan 1
Information Representation (Level ISA3) Floating point numbers.
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI 230 Information Representation: Negative and Floating Point.
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:
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Floating Point (a brief look) We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large numbers,
Computer Science Engineering B.E.(4 th sem) c omputer system organization Topic-Floating and decimal arithmetic S ubmitted to– Prof. Shweta Agrawal Submitted.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Dale Roberts Department of Computer and Information Science, School of Science, IUPUI CSCI N305 Information Representation: Floating Point Representation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Computer Arithmetic Floating Point. We need a way to represent –numbers with fractions, e.g., –very small numbers, e.g., –very large.
Numerical Analysis CC413 Propagation of Errors.
Binary Arithmetic.
SPH3UIB 1 ST DAY NOTES Significant digits, Uncertainties, Error Calculations.
Errors in Numerical Methods
IT11004: Data Representation and Organization Floating Point Representation.
ESO 208A/ESO 218 LECTURE 2 JULY 31, ERRORS MODELING OUTPUTS QUANTIFICATION TRUE VALUE APPROXIMATE VALUE.
Lecture 6: Floating Point Number Representation Information Representation: Floating Point Number Representation Lecture # 7.
Numerical Analysis CC413 Propagation of Errors. 2 In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
Chapter 2 Errors in Numerical Methods and Their Impacts.
Floating Point Numbers
Introduction to Numerical Analysis I
Floating Point Representations
Department of Computer Science Georgia State University
Machine arithmetic and associated errors Introduction to error analysis Class II.
Chapter Significant Figures.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Number Systems and Binary Arithmetic
New head garb has been ordered
William Stallings Computer Organization and Architecture 7th Edition
Chapter 6 Floating Point
Data Structures Mohammed Thajeel To the second year students
Chapter 2 ERROR ANALYSIS
INTRODUCTION TO SCIENTIFIC COMPUTING
Roundoff and Truncation Errors
Number Representations
Floating Point Representation
How to represent real numbers
Dr. Clincy Professor of CS
October 17 Chapter 4 – Floating Point Read 5.1 through 5.3 1/16/2019
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Significant digits, Uncertainties, Error Calculations
Prof. Giancarlo Succi, Ph.D., P.Eng.
IT11004: Data Representation and Organization
Chapter 1 / Error in Numerical Method
Roundoff and Truncation Errors
Chapter3 Fixed Point Representation
Number Representations
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Presentation transcript:

Approximations and Round-Off Errors Chapter 3

Numerical methods yield approximate results that are close to the exact analytical solution. How confident we are in our approximate result ? In other words, “how much error is present in our calculation and is it tolerable?” 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.3800 x 104 5 Zeros are sometimes used to locate the decimal point not significant figures. 0.00001753 4 0.001753 4

Identifying Significant Digits http://en.wikipedia.org/wiki/Significant_figures All non-zero digits are considered significant. For example, 91 has two significant figures, while 123.45 has five significant figures Zeros appearing anywhere between two non-zero digits are significant. Ex: 101.1002 has seven significant figures. Leading zeros are not significant. Ex: 0.00052 has two significant figures. Trailing zeros in a number containing a decimal point are significant. Ex: 12.2300 has six significant figures: 1, 2, 2, 3, 0 and 0. The number 0.000122300 still has only six significant figures (the zeros before the 1 are not significant). In addition, 120.00 has five significant figures. The significance of trailing zeros in a number not containing a decimal point can be ambiguous. For example, it may not always be clear if a number like 1300 is accurate to the nearest unit. Various conventions exist to address this issue.

Error Definitions True error: Et = True value – Approximation (+/-) Approximate Error For numerical methods, the true value will be known only when we deal with functions that can be solved analytically. In real world applications, we usually do not know the answer a priori. Approximate Error = CurrentApproximation(i) – PreviousApproximation(i-1)

Computations are repeated until stopping criterion is satisfied Iterative approaches Computations are repeated until stopping criterion is satisfied Pre-specified % tolerance based on your knowledge of the solution. (Use absolute value) If εs is chosen as: Then the result is correct to at least n significant figures (Scarborough 1966)

EXAMPLE 3.2: Maclaurin series expansion Calculate e0.5 (= 1.648721…) up to 3 significant figures. During the calculation process, compute the true and approximate percent relative errors at each step Error tolerance MATLAB file in: C:\ERCAL\228\MATLAB\3\EXPTaylor.m Terms 1 1+(0.5) 1+(.5)+(.5)2/2 1+(.5)+(.5)2/2+(.5)3/6 Count Result εt (%) True εa (%) Approx. 1 39.3 2 1.5 9.02 33.3 3 1.625 1.44 7.69 4 1.6458333 0.175 1.27 5 1.6484375 0.0172 0.158 6 1.648697917 0.00142 0.0158

Round-off and Chopping Errors Numbers such as p, e, or √7 cannot be expressed by a fixed number of significant figures. Therefore, they can not be represented exactly by a computer which has a fixed word-length p = 3.1415926535…. Discrepancy introduced by this omission of significant figures is called round-off or chopping errors. If p is to be stored on a base-10 system carrying 7 significant digits, chopping : p=3.141592 error: et=0.00000065 round-off: p=3.141593 error: et=0.00000035 Some machines use chopping, because rounding has additional computational overhead.

Number Representation 86409 in Base-10

The representation of -173 on a 16-bit computer using the signed magnitude method

Computer representation of a floating-point number exponent mantissa Base of the number system used

(in a floating point base-10 system) 156.78    0.15678x103 (in a floating point base-10 system) Suppose only 4 decimal places to be stored Normalize  remove the leading zeroes. Multiply the mantissa by 10 and lower the exponent by 1 0.2941 x 10-1 Additional significant figure is retained

Due to Normalization, absolute value of m is limited: for base-10 system: 0.1 ≤ m < 1 for base-2 system: 0.5 ≤ m < 1 Floating point representation allows both fractions and very large numbers to be expressed on the computer. However, Floating point numbers take up more room Take longer to process than integer numbers. Q: What is the smallest positive floating point number that can be represented using a 7-bit word (3-bits reserved for mantissa). What is the number? (* Solve Example 3.4 page 61 *) Another Exercise: What is the largest positive floating point number that can be represented using a 7-bit word (3-bits reserved for mantissa).

IEEE 754 double-precision binary floating-point format: binary64 This is a commonly used format on PCs. Sign bit: 1 bit Exponent width: 11 bits Significand precision: 53 bits (52 explicitly stored) This gives from 15–17 significant decimal digits precision. If a decimal string with at most 15 significant digits is converted to IEEE 754 double precision representation and then converted back to a string with the same number of significant digits, then the final string should match the original. The real value assumed by a given 64-bit double-precision datum with a given biased exponent e and a 52-bit fraction is: = Between 252=4,503,599,627,370,496 and 253=9,007,199,254,740,992 the representable numbers are exactly the integers.

Notes on floating point numbers: Addition of two floating point numbers (exponents should be the same) Multiplication Overflow / Underflow very small and very large numbers can not be represented using a fixed-length mantissa/exponent representation, therefore overflow and underflow can occur while doing arithmetic with these numbers. Double precision arithmetic is always recommended The interval between representable numbers increases as the numbers grow in magnitude and similarly, the round-off error.