Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)

Slides:



Advertisements
Similar presentations
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
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.
CENG536 Computer Engineering department Çankaya University.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
CSE Differentiation Roger Crawfis. May 19, 2015OSU/CIS 5412 Numerical Differentiation The mathematical definition: Can also be thought of as the.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Introduction to Scientific Computing ICE / ICE 508 Prof. Hyuckjae Lee KAIST- ICC
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Round-Off and Truncation Errors
1 Part 3 Truncation Errors (Supplement). 2 Error Propagation How errors in numbers can propagate through mathematical functions? That is, what's the effect.
Lecture 2: Numerical Differentiation. Derivative as a gradient
Revision.
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 Science 210 Computer Organization Floating Point Representation.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
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
Floating Point Computation
2.2 Errors. Why Study Errors First? Nearly all our modeling is done on digital computers (aside: what would a non-digital analog computer look like?)
Sequences Informally, a sequence is a set of elements written in a row. – This concept is represented in CS using one- dimensional arrays The goal of mathematics.
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
Data Representation – Binary Numbers
Information Representation (Level ISA3) Floating point numbers.
1 Lecture 5 Floating Point Numbers ITEC 1000 “Introduction to Information Technology”
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.
MATH 685/CSI 700 Lecture Notes Lecture 1. Intro to Scientific Computing.
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.
ENGR Introduction to Engineering1 ENGR 107 – Introduction to Engineering Estimation, Accuracy and Precision, and Significant Figures (Lecture #3)
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
Data Representation in Computer Systems
ME 142 Engineering Computation I Computer Precision & Round-Off Error.
5.2 Errrors. Why Study Errors First? Nearly all our modeling is done on digital computers (aside: what would a non-digital analog computer look like?)
Round-off Errors.
Round-off Errors and Computer Arithmetic. The arithmetic performed by a calculator or computer is different from the arithmetic in algebra and calculus.
CSC 221 Computer Organization and Assembly Language
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter.
CSE Differentiation Roger Crawfis Prepaid by:
Copyright © Curt Hill Numerics Representation and Errors.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Significant Figure Rules RulesExamples The following are always significant Non zero digits Zeros between non zero digits Zero to the right of a non zero.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
Numerical Analysis CC413 Propagation of Errors.
Definition Section 4.1: Indefinite Integrals. The process of finding the indefinite integral of f(x) is called integration of f(x) or integrating f(x).
Numerical Analysis CC413 Propagation of Errors. 2 In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate.
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.
Cosc 2150: Computer Organization Chapter 9, Part 3 Floating point numbers.
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
Floating Point Representations
ME 142 Engineering Computation I
Integer Division.
UNIVERSITY OF MASSACHUSETTS Dept
Recall our hypothetical computer Marc-32
Errors in Numerical Methods
Errors in Numerical Methods
Chapter 2: Floating point number systems and Round-off error
Chapter 1 / Error in Numerical Method
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 1 EE, NCKU Tien-Hao Chang (Darby Chang)

In the previous slide Why numerical methods? –differences between human and computer –a very simple numerical method What is algorithm? –definition and components –three problems and three algorithms Convergence –compare rate of convergence 2

In this slide Error (motivation) Floating point number system –difference to real number system –problem of roundoff Introduced/propagated error Focus on numerical methods –three bugs 3

Let’s start from error Numerical methods are generally designed to determine approximation solutions 3 categories of error types –modeling: made when you decide the algorithm –discretization/truncation: conversion from continuous to discrete and/or truncation of an infinite series –roundoff/data: not due to the formulation of a numerical method, caused by the data representation (in computer) 4

Can be analyzed Numerical methods are generally designed to determine approximation solutions 3 categories of error types –modeling: made when you decide the algorithm –discretization/truncation: conversion from continuous to discrete and/or truncation of an infinite series –roundoff/data: not due to the formulation of a numerical method, caused by the data representation (in computer) 5

Should be prevented Numerical methods are generally designed to determine approximation solutions 3 categories of error types –modeling: made when you decide the algorithm –discretization/truncation: conversion from continuous to discrete and/or truncation of an infinite series –roundoff/data: not due to the formulation of a numerical method, caused by the data representation (in computer) 6

1.3 7 Mathematics on the Computer Floating Point Number Systems

8

Restriction of d 1 9 d 1 must not be zero (except when the number being represented is 0 )

Floating point vs. real number Discrete vs. continuous –continuous means that between any two numbers, there are infinitely many other numbers Finite vs. infinite –number of element and range of values –a floating point number system contains its smallest/largest element underflow/overflow 10

Any Questions? 11

Floating point vs. real number Nonuniform vs. uniform –real numbers are uniformly distributed –in a floating point number system, the elements **** *** **** are more closely spaced think about the difference between two adjacent elements while the exponent changes 12 hint

Floating point vs. real number Nonuniform vs. uniform –real numbers are uniformly distributed –in a floating point number system, the elements **** *** **** are more closely spaced think about the difference between two adjacent elements while the exponent changes 13

Floating point vs. real number Nonuniform vs. uniform –real numbers are uniformly distributed –in a floating point number system, the elements near the zero are more closely spaced think about the difference between two adjacent elements while the exponent changes 14

Floating point system is 15 discrete, finite and nonuniform

Roundoff error When the number is outside the system Select an element to represent the number –chop –round A number to its floating point equivalent – y → fl(y) 16

17

18

Roundoff error When the number is outside the system Select an element to represent the number –chop –round A number to its floating point equivalent – y → fl(y) 19

Formal definition 20

An example 21

In general case (chopped) 22

In general case (chopped) 23

Machine precision/epsilon The error bound is independent of the number, y It depends on –base ( β ) –the number of digits ( k ) The bound is a function of the hardware implementation Cause of roundoff error 24

Formal definition 25

Another term about precision 26

27

So far, 28 we talked about floating point number systems in abstract

Then, 29 what systems are we likely to encounter in practice?

Real floating point system 1970s –begun to develop a standard binary floating point numbers to eliminate inconsistencies 1985 –IEEE –Binary Floating Point Arithmetic Standard 754 The IEEE Standard –F(2,24,-125,128), single precision –F(2,53,-1021,1024), double precision 30

IEEE standard single precision 31

Mathematics on the Computer: Floating Point Arithmetic

Motivation Floating point arithmetic stands for the mathematics on the computer, but why should we know that? The IEEE Standard – 5.96 x –seems pretty accurate However, 33

Numerical methods 34 perform a sequence of calculations on computer, where each operation introduces some roundoff error

35 when they are accumulated

Typical arithmetic Three steps –operand → its floating point equivalent –the exact arithmetic –result → its floating point equivalent 36

37

Not associative ( )+23.21= = ( )= =24.88 We should perform the arithmetic in ********* order to obtain the most accurate result 38 question

All 39 intermediate results have been rounded

Any Questions? 40

Not associative ( )+23.21= = ( )= =24.88 We should perform the arithmetic in ********* order to obtain the most accurate result 41

Not associative ( )+23.21= = ( )= =24.88 We should perform the arithmetic in Ascending order to obtain the most accurate result 42

In FP arithmetic, 43 always notice the number of significant digits and the least significant bits

Not distributive 44

45 Accumulation of roundoff error

46

Introduced/propagated error 47

Propagated error 48 can be large even if the introduced error is small

A notation in the analysis 49

In multiplication 50

In division 51

The relative error propagates slowly The absolute error can grow rapidly, when multiplying by a large number or dividing by a small number 52

Propagated error 53 in addition and subtraction

In addition and subtraction 54

Absolute vs. relative error Multiplication and division may result large absolute error Addition and subtraction may result large relative error –more crucial –cancellation error two nearly equal numbers are subtracted Algorithms should avoid the subtraction of nearly equal numbers 55

56 Recall that

Should be prevented Numerical methods are generally designed to determine approximation solutions 3 categories of error types –modeling: made when you decide the algorithm –discretization/truncation: conversion from continuous to discrete and/or truncation of an infinite series –roundoff/data: not due to the formulation of a numerical method, caused by the data representation (in computer) 57

To prevent, 58 we need to know the floating point system

59 Bug 1

60

± 61 be careful

62 In action

In action 63

Analysis The larger root – (actual root: ) –is the floating point equivalent of the actual root The smaller root – 0.15 (actual root: ) –nearly 20% relative error 64

Any Questions? 65

An intuitive question How to solve the quadratic formula problem? Reformulate the calculation of the smaller root 66 hint

67

68

69 Bug 2

70

Multiplier -1/6 71 The world is cruel :p You got

72

73 After one pass of Gaussian elimination

74

The next multiplier 75 fl(-3.333/0.0001)

77

Cascade of effects Cancellation error led to a small pivot element A small pivot led to a large multiplier A large and then led to loss of significant digits 78

4.167 disappeared 79

80 Bug 3

Values of a function Even evaluating a function can prove difficult f(x) = e x – cosx – x, where x → 0 – e x → 0 – cosx → 0 81

82

83

How reformulate 84 When seeing cosx, sinx and e x, Taylor series

Reforming with Taylor series 85

86

More precision These bugs are under F(10,4,-,-) Just add more precision –FORTRAN REAL*8 → REAL*16 –C/C++ float → double Not always work –Introduced by Rump and reconsidered by Aberth, Precise Numerical Methods Using C++,

88

Need at least 37 digits 89

Any Questions? 90

Good, 91 that means we would like to have exercises

Exercise /3/25 9:00am to or hand over in class. You may arbitrarily pick one problem among the first three, which means this exercise contains only five

93

94

95

96

97

98

99