E. T. S. I. Caminos, Canales y Puertos1 Lecture 1 Engineering Computation.

Slides:



Advertisements
Similar presentations
Chapter 0 Review of Algebra.
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.
E. T. S. I. Caminos, Canales y Puertos1 Engineering Computation Lecture 4.
E. T. S. I. Caminos, Canales y Puertos1 Engineering Computation Lecture 6.
E. T. S. I. Caminos, Canales y Puertos1 Engineering Computation Lecture 5.
Engineering Computation
E. T. S. I. Caminos, Canales y Puertos1 Engineering Computation Lecture 7.
E. T. S. I. Caminos, Canales y Puertos1 Lecture 2 Engineering Computation.
Roundoff and truncation errors
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
Topics covered: Floating point arithmetic CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Engineering Computation
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Approximations and Errors
Round-Off and Truncation Errors
Lecture 2: Numerical Differentiation. Derivative as a gradient
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.
Representation and Conversion of Numeric Types 4 We have seen multiple data types that C provides for numbers: int and double 4 What differences are there.
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.
Ch 8.1 Numerical Methods: The Euler or Tangent Line Method
Introduction and Analysis of Error Pertemuan 1
Simple Data Type Representation and conversion of numbers
Numerical Computations in Linear Algebra. Mathematically posed problems that are to be solved, or whose solution is to be confirmed on a digital computer.
Information Representation (Level ISA3) Floating point numbers.
Computer Arithmetic Nizamettin AYDIN
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:
Computing Systems Basic arithmetic for computers.
EE 3561_Unit_1(c)Al-Dhaifallah EE 3561 : - Computational Methods in Electrical Engineering Unit 1: Introduction to Computational Methods and Taylor.
Lecture Overview Introduction Positional Numbering System
Floating Point. Agenda  History  Basic Terms  General representation of floating point  Constructing a simple floating point representation  Floating.
ME 142 Engineering Computation I Computer Precision & Round-Off Error.
Round-off Errors.
Chapter 8 Curve Fitting.
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
Problems with Floating-Point Representations Douglas Wilhelm Harder Department of Electrical and Computer Engineering University of Waterloo Copyright.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Introduction Course Outline.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Modeling Biosystems Mathematical models are tools that biomedical engineers use to predict the behavior of the system. Three different states are modeled.
Scientific Measurement Measurements and their Uncertainty Dr. Yager Chapter 3.1.
Errors in Numerical Methods
ESO 208A/ESO 218 LECTURE 2 JULY 31, ERRORS MODELING OUTPUTS QUANTIFICATION TRUE VALUE APPROXIMATE VALUE.
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Chapter 2 Errors in Numerical Methods and Their Impacts.
Fundamentals of Computer Science
Binary Numbers The arithmetic used by computers differs in some ways from that used by people. Computers perform operations on numbers with finite and.
Part 5 - Chapter
ME 142 Engineering Computation I
Part 5 - Chapter 17.
Chapter 6 Floating Point
Data Structures Mohammed Thajeel To the second year students
Chapter 2 ERROR ANALYSIS
Errors in Numerical Methods
Class Notes 18: Numerical Methods (1/2)
Roundoff and Truncation Errors
Part 5 - Chapter 17.
Errors in Numerical Methods
Approximations and Round-Off Errors Chapter 3
Chapter 3 DataStorage Foundations of Computer Science ã Cengage Learning.
Numerical Analysis Lecture 2.
Chapter 1 / Error in Numerical Method
Roundoff and Truncation Errors
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Presentation transcript:

E. T. S. I. Caminos, Canales y Puertos1 Lecture 1 Engineering Computation

E. T. S. I. Caminos, Canales y Puertos2 Introduction Numerical analysis is a part of mathematics, but it works on questions that are strongly related to the use of computers and to applications from Science and Engineering. Using numerical analysis we will be able, for instance, to handle large systems of equations, non-linearities, complicated geometries and solving engineering problems which have no analytical solution.

E. T. S. I. Caminos, Canales y Puertos3 Introduction Roots of equations : –We will be interested in methods for solving –These methods are very useful in engineering projects, because in many occasions it is not possible to solve the design equations analytically.

E. T. S. I. Caminos, Canales y Puertos4 Introduction Systems of linear equations: –We will study methods for computing the set of values that simultaneously satisfy a system of algebraic equations. –Applications: calculus of structures, electric circuits, supply networks, fit of curves, etc.

E. T. S. I. Caminos, Canales y Puertos5 Introduction Optimization: –Determine the value x 0 leading to the optimal value of f(x). –These problems can be subject to constraints.

E. T. S. I. Caminos, Canales y Puertos6 Introduction Fitting curves. Fitting techniques can be divided into two groups: –Regression. It is used when one has errors in the experimental data. One looks for the curve showing the trend of the data. –Interpolation. It is used to fit tabulated data and predict intermediate values or extrapolated data.

E. T. S. I. Caminos, Canales y Puertos7 Introduction Integration: –Determine the area below a given curve. –It has many applications in engineering. Calculus of centers of gravity. Calculus of areas, volumes, etc. –It can also be used to solve differential equations.

E. T. S. I. Caminos, Canales y Puertos8 Introduction Ordinary differential equations : –They are very important because many problems can be stated in terms of variations and not in terms of magnitudes. –There are two types of problems: Initial value problems, and boundary value problems.

E. T. S. I. Caminos, Canales y Puertos9 Introduction Partial differential equations: –Used for characterizing engineering problems where the behavior of the physical magnitude can be expressed in terms of speed change with respect to two or more variables. –Approximation by finite differences or the finite element method.

E. T. S. I. Caminos, Canales y Puertos10 Mathematical Models A mathematical expression of a given model can be Analytic solution (t=0, v=0): Approximate solution (“Euler method (forward)”):

E. T. S. I. Caminos, Canales y Puertos11 Mathematical Models To solve the problem numerically, one replaces the derivative by a finite difference, thus transforming the problem into a very simple one containing only simple algebraic operations:

E. T. S. I. Caminos, Canales y Puertos12 Numerical Differentiation Forward: Centered:  How big a step size should we select?  One- or two-sided formula: What are the advantages of each?  How is optimal step size affected by: - precision of numerical calculations? - precision with which f is computed? - choice of formula?

E. T. S. I. Caminos, Canales y Puertos13 Numerical Methods Instead of solving for the exact solution we solve math problems with a series of arithmetic operations. analytical solution: ln(b) – ln(a) numerical solution e. g., Trapezoidal Rule Error Analysis (a) identify the possible sources of error (b) estimate the magnitude of the error (c) determine how to minimize and control error Example: dx APPROXIMATION AND ERRORS

E. T. S. I. Caminos, Canales y Puertos14 Mathematical Models Comparing solutions:

E. T. S. I. Caminos, Canales y Puertos15 Approximations and Rounding Errors Unfortunately, computers introduce errors in the calculations. However, since many engineering problems have not analytical solution, we are forced to use numerical methods (approximations). The only option we have is to accept the error and try to reduce it up to a tolerable level. The only way of minimizing the errors is by knowing and understanding why they occur and how we can diminish them. The most frequent errors are: –Rounding errors, due to the fact that computers can work only with a finite representation of numbers. –Truncation errors, due to differences between the exact and the approximate (numeric) formulations of the mathematical problem being dealt with. Before analyzing each one of them, we will see two important concepts on the computer representation of numbers.

E. T. S. I. Caminos, Canales y Puertos16 Approximations and Rounding Errors Significant figures of a number: –The significant figures of a number are those which can be used with confidence. –This concept has two important implications: 1. An approximation is acceptable when it is exact for a given number of significant figures. 2. There are magnitudes or constants that cannot be represented exactly:

E. T. S. I. Caminos, Canales y Puertos17 Accuracy closeness of measured/computed values to the "true" value (vs. inaccuracy or bias) Biassystematic deviation from truth, "general trend" Precisioncloseness of measured/computed values with each other (spread or scatter), relates to the number of significant figures (vs. imprecision or uncertainty) Approximations and Rounding Errors

E. T. S. I. Caminos, Canales y Puertos18 Approximations and Rounding Errors Accuracy and precision: –The errors associated with measurements can be characterized observing their accuracy and precision. –Accuracy refers to how close the value is to the true value. –Precision refers to how close are different measured values using the same method. Numerical methods must be sufficiently exact (without bias) and precise to satisfy the requirements of engineering problems. From now on we will refer to error to refer to the inaccuracy and lack of precision of our predictions.

E. T. S. I. Caminos, Canales y Puertos19 (a) inaccurateimprecise (b) accurateimprecise (c) Inaccurate precise (d) Accurate precise Approximations and Rounding Errors

E. T. S. I. Caminos, Canales y Puertos20 Approximations and Rounding Errors Error definitions: –True value = approximation + absolute error. –Absolute error = true value - approximation. –Relative error = absolute error / true value. –In real cases not always one can know the true value, thus: –In many occasions, the error is calculated as the difference between the previous and the actual approximations.

E. T. S. I. Caminos, Canales y Puertos21 Approximations and Rounding Errors –Thus, the stopping criterium of a numerical method can be: –It is convenient to relate the errors with the number of significant figures.If the following relation holds, one can be sure that at least n significant figures are correct.

E. T. S. I. Caminos, Canales y Puertos22 Approximations and Rounding Errors Numerical systems: –A numerical system is a convention to represent quantities. Since we have 10 fingers in our hands, the most popular numerical system has basis 10. It uses 10 different digits. –However, computers, due to the memory structure, can only store two digits: 0 and 1. Thus, they use the binary system of numeric representation.

E. T. S. I. Caminos, Canales y Puertos23 Background: How are numbers stored in a computer? The fundamental unit, a "word," consists of a string of "bits" (binary digits). Because computers are made up of gates or switches which are either closed or open, we work in binary or base 2 system. A number in base q will be denoted by (a n a n-1...a 1 a 0.b 1 b 2..b k..) q The conversion to base 10 is, by definition (a n a n-1...a 1 a 0.b 1 b 2..b k..) q =a n q n +a n-1 q n a 1 q+a 0 q 0 +b 1 q -1 +b 2 q Example: ( ) 2 =1x2 3 +0x2 2 +1x2+1x2 0 +0x x2 -2 =11.25 Round-off Errors

E. T. S. I. Caminos, Canales y Puertos24 Conversion from base 10 to base q. This is the recipe for conversion: Integer part: we have to divide the integer part by 2 (successively) and to retain the fractional part in each step. Fractional part: we have to multiply by 2 and to retain the integer part in each step. Example: (26.1) 10 =( ) 2 Round-off Errors

E. T. S. I. Caminos, Canales y Puertos25 Example: An 8 bit word representation of the integer "35" is or ± x2 6 1x2 5 0x2 4 0x2 3 0x2 2 1x2 1 1x2 0 = Note: We can only represent a finite # of numbers; for our case: –127 to +127 (127 = 2 7 – 1) or a total of 255 numbers (including 0) Round-off Errors

E. T. S. I. Caminos, Canales y Puertos26 Approximations and Rounding Errors Representation of integer numbers: –To represent base 10 numbers in binary form the signed magnitude method is used. The first digit stores the sign (0, positive and 1, negative). The remaining bits are used to store the number. –A computer working with words of 16 bits can store integer numbers in the range to

E. T. S. I. Caminos, Canales y Puertos27 Approximations and Rounding Errors Floating point representation: –This representation is used for fractional quantities. It has the fraction part, called mantissa, and an integer part, called exponent or characteristic. –The mantissa is usually normalized, so that the value of m is limited (b=2 in binary):

E. T. S. I. Caminos, Canales y Puertos28 Approximations and Rounding Errors IEEE-floating point formats: there are two types of “precision” (simple and double). They differ in the number of digits available for storing the numbers: Simple precision (32 bits): 1 bit for the sign, 8 bits for the exponent, 23 bits for the mantissa. Double precision (64 bits, two words of 32 bits): 1 bit for the sign, 11 bits for the exponent, 52 bits for the mantissa. The number of bits for the exponent and the mantissa determine the “underflow” and “overflow” numbers.

E. T. S. I. Caminos, Canales y Puertos29 Subtractive Cancellation (subtracting numbers of almost equal size) – too few significant figures left. Examples: 1.Use of the “standard” formulas for solving P(x)=0, being P(x) a polynomial of degree 2. 2.Computation of f(x)=(x+1) 1/2 -x 1/2 for large x. 3.Computation of g(x)=(1-cos(x))/x 2. Round-off Error due to Arithmetic Operations