Lecture 03 Approximations, Errors and Their Analysis

Similar documents
Section 1.4 Mathematics on the Computer: Floating Point Arithmetic

Roundoff Errors and Computer Arithmetic

fractional quantities are typically represented in computers using floating point format this approach is very much similar to scientific notation

Scientific Computing. Error Analysis

Lecture Objectives. Structured Programming & an Introduction to Error. Review the basic good habits of programming

Mathematical preliminaries and error analysis

1.2 Round-off Errors and Computer Arithmetic

CS321. Introduction to Numerical Methods

Errors in Computation

Truncation Errors. Applied Numerical Methods with MATLAB for Engineers and Scientists, 2nd ed., Steven C. Chapra, McGraw Hill, 2008, Ch. 4.

2 Computation with Floating-Point Numbers

Floating-point representation

2 Computation with Floating-Point Numbers

Computational Methods. Sources of Errors

ME 261: Numerical Analysis. ME 261: Numerical Analysis

Review of Calculus, cont d

Computer Arithmetic Floating Point

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Floating Point Arithmetic

Chapter 3. Errors and numerical stability

Approximations and Errors

1.3 Floating Point Form

Numerical Methods for Eng [ENGR 391] [Lyes KADEM 2007]

Finite arithmetic and error analysis

MAT128A: Numerical Analysis Lecture Two: Finite Precision Arithmetic

Floating-Point Numbers in Digital Computers

Chapter Three. Arithmetic

Floating-Point Numbers in Digital Computers

Floating-Point Arithmetic

Floating Point Representation in Computers


Computing Basics. 1 Sources of Error LECTURE NOTES ECO 613/614 FALL 2007 KAREN A. KOPECKY

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

Computational Economics and Finance

Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)

Floating-Point Arithmetic

CHAPTER 2 SENSITIVITY OF LINEAR SYSTEMS; EFFECTS OF ROUNDOFF ERRORS

Numerical computing. How computers store real numbers and the problems that result

Scientific Computing: An Introductory Survey

Floating-point representations

Floating-point representations

EE878 Special Topics in VLSI. Computer Arithmetic for Digital Signal Processing

Floating Point January 24, 2008

UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering. Digital Computer Arithmetic ECE 666

CS101 Lecture 04: Binary Arithmetic

Introduction to Computers and Programming. Numeric Values

Basics of Computation. PHY 604:Computational Methods in Physics and Astrophysics II

Objectives. look at floating point representation in its basic form expose errors of a different form: rounding error highlight IEEE-754 standard

15213 Recitation 2: Floating Point

Computational Economics and Finance

Math 340 Fall 2014, Victor Matveev. Binary system, round-off errors, loss of significance, and double precision accuracy.

Introduction to Computer Programming with MATLAB Calculation and Programming Errors. Selis Önel, PhD

2.1.1 Fixed-Point (or Integer) Arithmetic

unused unused unused unused unused unused

Numerical Computing: An Introduction

Computer Organisation CS303

MATH 353 Engineering mathematics III

Review Questions 26 CHAPTER 1. SCIENTIFIC COMPUTING

CS321 Introduction To Numerical Methods

Representing and Manipulating Floating Points. Jo, Heeseung

Numerical Solutions of Differential Equations (1)

Representing and Manipulating Floating Points

Divide: Paper & Pencil

Most nonzero floating-point numbers are normalized. This means they can be expressed as. x = ±(1 + f) 2 e. 0 f < 1

Number Systems. Binary Numbers. Appendix. Decimal notation represents numbers as powers of 10, for example

Class 5. Data Representation and Introduction to Visualization

Module 2: Computer Arithmetic

Floating Point Arithmetic

Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Data Representation and Introduction to Visualization

Chapter 3: Arithmetic for Computers

Representing and Manipulating Floating Points. Computer Systems Laboratory Sungkyunkwan University

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

Floating Point Numbers

Floating Point Numbers

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Number Systems. Both numbers are positive

Data Representation Floating Point

CHAPTER V NUMBER SYSTEMS AND ARITHMETIC

What we need to know about error: Class Outline. Computational Methods CMSC/AMSC/MAPL 460. Errors in data and computation

Numeric Precision 101

Computational Mathematics: Models, Methods and Analysis. Zhilin Li

Floating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754

3.1 DATA REPRESENTATION (PART C)

Numerical Methods 5633

Data Representation Floating Point

MACHINE LEVEL REPRESENTATION OF DATA

Computational Methods CMSC/AMSC/MAPL 460. Representing numbers in floating point and associated issues. Ramani Duraiswami, Dept. of Computer Science

Computer Numbers and their Precision, I Number Storage

ECE232: Hardware Organization and Design

Representing and Manipulating Floating Points

Floating Point Puzzles The course that gives CMU its Zip! Floating Point Jan 22, IEEE Floating Point. Fractional Binary Numbers.

What Every Programmer Should Know About Floating-Point Arithmetic

Foundations of Computer Systems

Chapter 1. Numeric Artifacts. 1.1 Introduction

CMPSCI 145 MIDTERM #2 Solution Key SPRING 2018 April 13, 2018 Professor William T. Verts

COMP Overview of Tutorial #2

Chapter 2. Positional number systems. 2.1 Signed number representations Signed magnitude

18-642: Floating Point Blues

Scientific Computing: An Introductory Survey

Transcription:

AM702 Applied Computational Methods c ecture 03 Approximations, rrors and heir Analysis

Approximations and rrors c Approximation is unavoidable in mathematical modeling the real world phenomena Approximation leads to errors stimating the errors in computation is necessary for reliability of computed results 2

Accuracy and Precision c Accuracy : t refers to how closely the measured or computed value matches with the true value. Precision: t refers to how closely the computed or measured values agree with each other in repeated computation or measurement. Consider fig. 4.1 from Chapra, as shown here (a) inaccurate and imprecise, (b) accurate and imprecise, (c) inaccurate and precise, (d) accurate and precise.

rrors in Computations rror: he deviation from an expected or true value. rue value may not be known always!.g. Area of a rectangle A= xb=12x10=120 cm 2 But by measurement m xb m =11.9x10.1 he computed value A c = 120.19 cm 2 rror, = A- A c =0.19. his error is known as Absolute rror. When it is compared with the actual value or true value, it is known as relative error, r = A- A c /A=0.19/120. his is expressed in percentage as r = A- A c /A*100=0.19/120*100 = 0.15%. 4

Floating Points and Machine Accuracy Floating Point Representation hese numbers are represented by a sign bit s, an exact integer exponent ε, an exact positive integer mantissa, M. (B base, bias) Machine Accuracy, ε m t refers to the smallest floating point number which added to the floating point number 1.0 produces a floating point result different from 1.0. A typical 32 bit computer with base 2, has ε m = 3x10-8 5

Machine Representation 6 Representing Real numbers on digital computers Computers have finite amount of memory. Consider representing π= 3.141592653589793. Or the repeating fraction 1/3 = 0.333333333333333 Any such number x R needs infinite digits for accurate representation. x = ±( 1. d1d 2d3d 4... d1) 2 Where d i are binary digits having values 0 or 1 and e is an integer exponent. he mantissa can be expressed as d1 d2 d3 d4 1. d 1d 2d3d 4... = 1+ + + +... 2 3 4 2 2 2 2.g. he binary number x is represented as: 1 1 1 1 x = ( 1.11010...) 2 = (1. + + 0 +...) 2 = 3.625 2 4 16 e 10

Floating Point Representation 7 Floating point representation requires finite digits Corresponding to a real number x its digital counterpart will be fl(x) with some k bits fl( x) = ± (1. d1d 2d 3d 4... d1) 2 Now storing this in memory will require k bits which is an approximation for storing x with infinite bits. t is interesting to know the accuracy of such a representation. Alternatively we wish to determine the fl( x) x relative error as: x he standard gives the confidence by estimating 1 k this error to be η = 2 where k is the number of 2 digits (bits) used in the representation e

Floating Point and Machine Precision he standard gives the confidence by estimating 1 k this error to be η = 2 where k is the number of 2 digits (bits) used in the representation. his η is known as machine precision or rounding unit. he floating point word in common double precison systems like MAAB is by default, has 64 bits. Out of them, 52 bits are used for the mantissa (or fraction) while the rest store the sign and the exponent. herefore the machine precision for MAAB is η = 2 53 2.2 10 16. (here k=52) Check eps = 2.2204 10 16 in MAAB 8

Floating point ranges he exponent range is -1022 to 1023. (11 bits including 1 bit for sign) he largest possible number MAAB can store has +1.111111 111 X 2 1023 = (2-2 -52 )X 2 1023 his yields approximately 2 1024 = 1.7997 X 10 308 he smallest possible number MAAB can store with full precision has +1.00000 00000 X 2-1022 his yields 2-1022 = 2.2251 X 10-308

Real Vs Floating point numbers Comparing floating point numbers to real numbers. Property Real numbers Floating point numbers Range nfinite Finite. Precision nfinite Finite xistence Real Subset of real numbers 10

Roundoff rrors Finite-precision causes roundoff errors in numerical computation Roundoff errors accumulate slowly Subtracting nearly equal numbers leads to severe loss of precision. A similar loss of precision occurs when two numbers separated by large differences in magnitude are added. Roundoff errors are unavoidable, good algorithms can minimize their effect

runcation rrors

otal Numerical rror he total numerical error is the sum of the truncation and roundoff errors. he truncation error generally increases as the step size increases, while the roundoff error decreases as the step size increases - this leads to a point of diminishing returns for step size.