PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Similar documents
PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Chapter 1: Introduction and mathematical preliminaries

Notes for Chapter 1 of. Scientific Computing with Case Studies

Arithmetic and Error. How does error arise? How does error arise? Notes for Part 1 of CMSC 460

Lecture 7. Floating point arithmetic and stability

ECS 231 Computer Arithmetic 1 / 27

Jim Lambers MAT 610 Summer Session Lecture 2 Notes

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Errors. Intensive Computation. Annalisa Massini 2017/2018

Introduction CSE 541

Elements of Floating-point Arithmetic

Chapter 1 Mathematical Preliminaries and Error Analysis

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

ECE257 Numerical Methods and Scientific Computing. Ordinary Differential Equations

Chapter 1 Error Analysis

Math 471. Numerical methods Introduction

Mathematical preliminaries and error analysis

2.29 Numerical Fluid Mechanics Fall 2011 Lecture 2

Computer Arithmetic. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Computer Arithmetic

Chapter 1 Mathematical Preliminaries and Error Analysis

How do computers represent numbers?

Elements of Floating-point Arithmetic

Floating Point Number Systems. Simon Fraser University Surrey Campus MACM 316 Spring 2005 Instructor: Ha Le

Introduction and mathematical preliminaries

Numerical Methods - Preliminaries

Chapter 1 Computer Arithmetic

ESO 208A: Computational Methods in Engineering. Saumyen Guha

Numerical Methods. King Saud University

Math 411 Preliminaries

1 Floating point arithmetic

FLOATING POINT ARITHMETHIC - ERROR ANALYSIS

MAT 460: Numerical Analysis I. James V. Lambers

Number Representation and Waveform Quantization

Numerical Analysis and Computing

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Chapter 1: Preliminaries and Error Analysis

Lecture 28 The Main Sources of Error

FLOATING POINT ARITHMETHIC - ERROR ANALYSIS

Numerics and Error Analysis

Midterm Review. Igor Yanovsky (Math 151A TA)

Numerical Algorithms. IE 496 Lecture 20

Introduction to Finite Di erence Methods

Binary floating point

Numerical Methods - Lecture 2. Numerical Methods. Lecture 2. Analysis of errors in numerical methods

ACM 106a: Lecture 1 Agenda

Numerical Methods in Physics and Astrophysics

Notes on floating point number, numerical computations and pitfalls

Numerical Mathematical Analysis

Program 1 Foundations of Computational Math 1 Fall 2018

Chap. 20: Initial-Value Problems

What Every Programmer Should Know About Floating-Point Arithmetic DRAFT. Last updated: November 3, Abstract

Numerical Analysis. Yutian LI. 2018/19 Term 1 CUHKSZ. Yutian LI (CUHKSZ) Numerical Analysis 2018/19 1 / 41

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Introductory Numerical Analysis

Numerical Derivatives in Scilab

Taylor and Maclaurin Series. Copyright Cengage Learning. All rights reserved.

CHAPTER 3. Iterative Methods

Math 128A: Homework 2 Solutions

1 Backward and Forward Error

Tu: 9/3/13 Math 471, Fall 2013, Section 001 Lecture 1

One-Sided Difference Formula for the First Derivative

1.1 COMPUTER REPRESENTATION OF NUM- BERS, REPRESENTATION ERRORS

An Introduction to Differential Algebra

Numbering Systems. Contents: Binary & Decimal. Converting From: B D, D B. Arithmetic operation on Binary.

Lecture Notes 7, Math/Comp 128, Math 250

CS412: Introduction to Numerical Methods

Chapter 1. Numerical Errors. Module No. 1. Errors in Numerical Computations

11.11 Applications of Taylor Polynomials. Copyright Cengage Learning. All rights reserved.

A Brief Introduction to Numerical Methods for Differential Equations

BACHELOR OF COMPUTER APPLICATIONS (BCA) (Revised) Term-End Examination December, 2015 BCS-054 : COMPUTER ORIENTED NUMERICAL TECHNIQUES

Accurate polynomial evaluation in floating point arithmetic

Sequences and Series. Copyright Cengage Learning. All rights reserved.

Homework and Computer Problems for Math*2130 (W17).

Chapter 4 Mathematics of Cryptography

1 ERROR ANALYSIS IN COMPUTATION

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

Fall 2014 MAT 375 Numerical Methods. Numerical Differentiation (Chapter 9)

Introduction to Scientific Computing Languages

Applied Mathematics 205. Unit 0: Overview of Scientific Computing. Lecturer: Dr. David Knezevic

INTRODUCTION TO COMPUTATIONAL MATHEMATICS

CHAPTER 11. A Revision. 1. The Computers and Numbers therein

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Mathematics for Engineers. Numerical mathematics

Numerical Derivatives in Scilab

Introduction to Scientific Computing Languages

CME 302: NUMERICAL LINEAR ALGEBRA FALL 2005/06 LECTURE 5. Ax = b.

General Linear Least-Squares and Nonlinear Regression

Chapter 4 Number Representations

Parallel Circuits. Chapter

An Introduction to Numerical Analysis

Euler s Method, cont d

Infinite Series. Copyright Cengage Learning. All rights reserved.

Chapter 9 Mathematics of Cryptography Part III: Primes and Related Congruence Equations

Applied Numerical Analysis (AE2220-I) R. Klees and R.P. Dwight

Errors Intensive Computation

Floating-point Computation

Transcription:

Part 1 Chapter 4 Roundoff and Truncation Errors PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Chapter Objectives Understanding the distinction between accuracy and precision. i Learning how to quantify error. Learning how error estimates can be used to decide when to terminate an iterative calculation. Understanding di how roundoff errors occur because digital computers have a limited ability to represent numbers. Understanding why floating-point numbers have limits on their range and precision.

Objectives (cont) Recognizing that truncation errors occur when exact mathematical ti formulations are represented by approximations. Knowing how to use the Taylor series to estimate t truncation errors. Understanding how to write forward, backward, and centered finite-difference approximations of the first and second derivatives. Recognizing that efforts to minimize truncation errors can sometimes increase roundoff errors.

Accuracy and Precision Accuracy refers to how closely a computed or measured value agrees with the true value, while precision refers to how closely individual computed or measured values agree with each other. a) inaccurate and imprecise b) accurate and imprecise c) inaccurate and precise d) accurate and precise

Error Definitions True error (E t ): the difference between the true value and the approximation. Absolute error ( E t ): the absolute difference between the true value and the approximation. True fractional relative error: the true error divided by the true value. Relative error (ε t ): the true fractional relative error expressed as a percentage.

Error Definitions (cont) The previous definitions of error relied on knowing a true value. If that is not the case, approximations can be made to the error. The approximate percent relative error can be given as the approximate error divided by the approximation, expressed as a percentage - though this presents the challenge of finding the approximate error! For iterative processes, the error can be approximated as the difference in values between sucessive iterations.

Using Error Estimates Often, when performing calculations, we may not be concerned with the sign of the error but are interested in whether the absolute value of the percent relative error is lower than a prespecified tolerance ε s. For such cases, the computation is repeated until ε a < ε s This relationship is referred to as a stopping criterion.

Roundoff Errors Roundoff errors arise because digital computers cannot represent some quantities exactly. There are two major facets of roundoff errors involved in numerical calculations: Digital computers have size and precision limits on their ability to represent numbers. Certain numerical manipulations are highly sensitive to roundoff errors.

Computer Number Representation By default, MATLAB has adopted the IEEE double- precision i format in which h eight bytes (64 bits) are used to represent floating-point numbers: n=±(1+f) x2 e The sign is determined by a sign bit The mantissa f is determined by a 52-bit binary number The exponent e is determined by an 11-bit binary number, from which 1023 is subtracted to get e

Floating Point Ranges Values of -1023 and +1024 for e are reserved for special meanings, so the exponent range is -1022 to 1023. The largest possible number MATLAB can store has f of all 1 s, giving a significand of 2-2 -52, or approximately 2 e of 11111111110 2, giving an exponent of 2046-1023=1023 This yields approximately 2 1024 =1.7997 x 10 308 The smallest possible number MATLAB can store with full precision has f of all 0 s 0s, giving a significand of 1 e of 00000000001 2, giving an exponent of 1-1023=-1022 This yields 2-1022 =2.2251x 10-308

Floating Point Precision The 52 bits for the mantissa f correspond to about 15 to 16 base-10 digits. The machine epsilon - the maximum relative error between a number and MATLAB s representation of that number, is thus 2-52 =2.2204 x 10-16

Roundoff Errors with Arithmetic Manipulations Roundoff error can happen in several circumstances other than just storing numbers - for example: Large computations -if a process performs a large number of computations, roundoff errors may build up to become significant Adding a Large and a Small Number - Since the small number s mantissa is shifted to the right to be the same scale as the large number, digits are lost Smearing - Smearing occurs whenever the individual terms in a summation are larger than the summation itself. (x+10-20 )-x = 10-20 mathematically, ti but x=1; (x+1e-20)-x gives a 0 in MATLAB!

Truncation Errors Truncation errors are those that result from using an approximation in place of an exact mathematical procedure. Example 1: approximation to a derivative using a finite-difference equation: dv dt Δv Δt = v(t i+1) v(t i ) t i+1 t i Example 2: The Taylor Series

The Taylor Theorem and Series The Taylor theorem states that any smooth function can be approximated as a polynomial. The Taylor series provides a means to express this idea mathematically.

f( x i+1 )= f( x i )+ f ' x i The Taylor Series ( )h + f '' ( ) 2! x i h 2 + f (3) ( ) 3! x i h 3 + + f (n ) ( ) n! x i h n + R n

Truncation Error In general, the nth order Taylor series expansion will be exact for an nth order polynomial. In other cases, the remainder term R n is of the order of h n+1, meaning: The more terms are used, the smaller the error, and The smaller the spacing, the smaller the error for a given number of terms.

Numerical Differentiation The first order Taylor series can be used to calculate approximations to derivatives: Given: f (x i+1 ) = f (x i ) + f ' (x i )h + O(h 2 ) Then: f ' (x i ) = f (x i+1) f (x i ) h + O(h) This is termed a forward difference because it utilizes data at i and i+1 to estimate the derivative.

Differentiation (cont) There are also backward difference and centered difference approximations, depending on the points used: Forward: 1 ) f ' (x i ) = f (x i+1) f (x i ) h + O(h) Backward: f ' (x i ) = f (x i) f (x i 1 ) h + O(h) Centered: f ' (x i ) = f (x i+1) f (x i 1 ) 2h + O(h 2 )

Total Numerical Error The total numerical error is the summation of the truncation ti and roundoff errors. The 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.

Other Errors Blunders - errors caused by malfunctions of the computer or human imperfection. Model errors - errors resulting from incomplete mathematical models. Data uncertainty - errors resulting from the accuracy and/or precision of the data.