1 M 277 (60 h) Mathematics for Computer Sciences Bibliography  Discrete Mathematics and its applications, Kenneth H. Rosen  Numerical Analysis, Richard.

Slides:



Advertisements
Similar presentations
3- 1 Chapter 3 Introduction to Numerical Methods Second-order polynomial equation: analytical solution (closed-form solution): For many types of problems,
Advertisements

Lecture 5 Newton-Raphson Method
Roundoff and truncation errors
2009 Spring Errors & Source of Errors SpringBIL108E Errors in Computing Several causes for malfunction in computer systems. –Hardware fails –Critical.
CSE 330: Numerical Methods
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Chapter 4 Roots of Equations
Approximations and Errors
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 3 Approximations and Errors.
Revision.
Lectures on Numerical Methods 1 Numerical Methods Charudatt Kadolkar Copyright 2000 © Charudatt Kadolkar.
1 Error Analysis Part 1 The Basics. 2 Key Concepts Analytical vs. numerical Methods Representation of floating-point numbers Concept of significant digits.
Dr. Marco A. Arocha Aug,  “Roots” problems occur when some function f can be written in terms of one or more dependent variables x, where the.
Fin500J: Mathematical Foundations in Finance Topic 3: Numerical Methods for Solving Non-linear Equations Philip H. Dybvig Reference: Numerical Methods.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
Numerical Analysis 1 EE, NCKU Tien-Hao Chang (Darby Chang)
MATH 175: NUMERICAL ANALYSIS II Lecturer: Jomar Fajardo Rabajante IMSP, UPLB 2 nd Semester AY
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 31.
Solving Non-Linear Equations (Root Finding)
Computer Arithmetic Nizamettin AYDIN
MMJ 1113 Computational Methods for Engineers Mohsin Mohd Sies Fakulti Kejuruteraan Mekanikal, Universiti Teknologi Malaysia.
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:
MECN 3500 Inter - Bayamon Lecture 3 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Numerical Methods for Engineering MECN 3500
Numerical Methods.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter 3.
Lecture 4 - Numerical Errors CVEN 302 June 10, 2002.
Newton’s Method, Root Finding with MATLAB and Excel
linear  2.3 Newton’s Method ( Newton-Raphson Method ) 1/12 Chapter 2 Solutions of Equations in One Variable – Newton’s Method Idea: Linearize a nonlinear.
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
Solving Non-Linear Equations (Root Finding)
Solution of Nonlinear Equations Topic: Bisection method
Numerical Methods Solution of Equation.
Numerical Analysis CC413 Propagation of Errors.
NUMERICAL ANALYSIS Numerical analysis involves the study of methods of computing numerical data. The study actually involves the design, analysis, and.
A Different Solution  alternatively we can use the following algorithm: 1. if n == 0 done, otherwise I. print the string once II. print the string (n.
Numerical Analysis CC413 Propagation of Errors. 2 In numerical methods, the calculations are not made with exact numbers. How do these inaccuracies propagate.
Lecture 1 Introduction Dr. Hakikur Rahman Thanks to Dr. S. M. Lutful Kabir for Slides CSE 330: Numerical Methods.
Module 2.2 Errors 03/08/2011. Sources of errors Data errors Modeling Implementation errors Absolute and relative errors Round off errors Overflow and.
CSE 330: Numerical Methods. What is true error? True error is the difference between the true value (also called the exact value) and the approximate.
Numerical Methods and Optimization C o u r s e 1 By Bharat R Chaudhari.
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.
Machine arithmetic and associated errors Introduction to error analysis Class II.
Solution of Nonlinear Equations ( Root Finding Problems )
Solution of Nonlinear Equations (Root finding Problems
Numerical Methods and Analysis
Secant Method.
Data Structures Mohammed Thajeel To the second year students
Chapter 2 ERROR ANALYSIS
Read Chapters 5 and 6 of the textbook
Class Notes 18: Numerical Methods (1/2)
Roundoff and Truncation Errors
MATH 2140 Numerical Methods
Approximations and Round-Off Errors Chapter 3
Intermediate Value Theorem
SOLUTION OF NONLINEAR EQUATIONS
Intermediate Value Theorem
Numerical Analysis Lecture 2.
Copyright © Cengage Learning. All rights reserved.
FP1: Chapter 2 Numerical Solutions of Equations
Sec:5.2 The Bisection Method.
Roundoff and Truncation Errors
1 Newton’s Method.
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Solutions for Nonlinear Equations
Presentation transcript:

1 M 277 (60 h) Mathematics for Computer Sciences Bibliography  Discrete Mathematics and its applications, Kenneth H. Rosen  Numerical Analysis, Richard L. Burden, J. Douglas Faires, Albert C. Reynolds. Prindle, Weber & Schmidt Boston, Massachusetts.  Applied Numerical Analysis, Curtis F. Gerald, Patrick O. Wheatley. Addison-wesley publishing company.

2 Introduction Numerical analysis is a way to higher mathematics problems on a computer, a technique widely used by scientists and engineers to solve their problems. A major advantage for numerical analysis is that a numerical answer can be obtained even when a problem has no “analytical” solution. Actually, evaluating an analytical result to get the numerical answer (approximation) for a specific application is subject to same errors.

3 Contents Algorithms: Introduction, Complexity, Recursive definitions, Recursive algorithms, program correctness Solve for the roots of a nonlinear equation. Solve large systems of linear equations (Direct Methods, Iterative Methods). Interpolate to find intermediate values within a table of data. Integrate any function even when known only as a table of values. Solve ordinary differential equations when given initial values for the variables. Cubic Spline interpolation

4 Four general steps 1)State the problem clearly, including any simplifying assumptions. 2)Develop a mathematical statement of the problem in a form that can be solved for a numerical answer. 3)Solve the equation(s) that result from step 2. 4)Interpret the numerical result to arrive at a decision. This will require experience and an understanding of the situation…

5 Computer arithmetic and Errors Truncation Error: The term truncation error refers to those errors caused by the method itself. We may approximate e x by the cubic We see that approximating e x with the cubic gives an inexact answer. The error is due to truncating the series.

6 Compute the cos(1) ? Error <10 -9

7 Round-Off Error: All computing devices represent numbers, except for integers, with some imprecision. Digital computers will nearly always use floating- point numbers of fixed word length. The true values are not expressed exactly by such representations. We call the error due to this computer imperfection the round-off-error. Computer represent their floating-point numbers in the general form: N B = ±.d 1 d 2 d 3 …d p *B e Where the d i ’s are digits or bits with value from zero to B-1 B: The number base that is used (2, 16, 10) P: The number of significand bits (precision) e: an integer exponent, ranging from E min to E max with the values going from from negative E min to positive E max

8 Compute =.137* *10 -1 Errors Converting Values: The numbers that are input to a computer are ordinarily base-10 values. Thus the input must be converted to the computer’s internal number base (base 2). (0.3) 10 = ( …) 2

9 Examples

10 Overflow and underflow: ( ) and - ( ) format: 2Bytes =16bits Error Original Data : Real-word problem, in which an existing or proposed physical problem situation is modeled by mathematical equation, will nearly always have coefficients that are imperfectly known.

11 Absolute error = true value – approximate value A more formal definition of significant digits follows, 1. Let the true value digits d 1 d 2 …d n d n+1 …d p 2. Let the approximate value have d 1 d 2 …d n e n+1 …e p Where d 1 ≠ 0 and with the first difference in the digits occurring at the (n+1)st digit. We then say (1) and (2) agree to n significant digits if |d n+1 – e n+1 |<5. Otherwise, we say they agree to n-1 significant digits

12 Let the true = 10/3 and the approximate value = The absolute error is …= 1/3000 The relative error is (1/3000)/(10/3) = 1/ The number of significant digits is 4.

13 Solving Nonlinear Equations Finding values of x to satisfy f(x) = 0. Such values are called the roots of the equation and also are known as the zero of f(x). Bisection method

14

15 Finding a root of f(x) = x 3 + x x - 3 starting with a =1, b=2, and tolerance of root = =sqrt(3)

16 Bisection Algorithm To find a solution to f(x) = 0 Given the continuous f on the interval [a, b] where f(a) and f(b) have opposite signs: Input endpoints a, b; tolerance TOL maximum number of iterations N 0 Output approximate solution p or message of failure Step 1: Set i=1. Step 2: While i< N 0 do Steps 3-6 Step 3: Set P = a + (b-a)/2 Step 4: If f(p)=0 OR (b-a)/2 < TOL Then Output(p); STOP Step 5: Set i=i+1 Step 6: If f(a).f(b)>0 then Set a = P else set b = P Step 7: Output(‘Method failed after N 0 iterations’) STOP

17 Newton’s Method To determine a root of f(x) = 0, Given a value x 0 reasonably close to the root, and f’(x 0 ) ≠ 0 Compute f(x 0 ), f’(x 0 ). Set x 1 = x 0 If (f(x 0 ) ≠ 0) and (f’(x 0 ) ≠ 0) repeat Set x 0 = x 1 Set x 1 = x 0 –f(x 0 )/f’(x 0 ). Until (|x 0 -x 1 |)< tolerance value 1) OR (|f(x 1 )| < tolerance value 2) Note: The method may converge to a root different from the expected one or diverge if the starting value is not close enough to the root.

18 Newton Method

19 Fixed point method: x = g(x) Method We rearrange f(x) into an equivalent form x = g(x). Observe that if f(r) = 0 → r = g(r) where r is a root of f(r). The iteration form x n+1 = g(x n ) n = 0,1,2,3,.. Converge to the fixed point r, a root of f(x).

20

21 Another rearrangement of f(x) is

22 To determine a root of f(x)=0, given a value x 1 reasonably close to the root, rearrange the equation to an equivalent form x =g(x) Set x 2 = x 1 REPEAT Set x 1 = x 2 Set x 2 = g(x 1 ) UNTIL |x 1 -x 2 |< tolerance value Note: The method may converge to a root different from the expected one, or it may diverge. Different rearrangements will converge at different rates.

23 If g(x) and g’(x) are continuous on an interval about a root r of the equation x = g(x), and if |g’(x)| < 1 for all x in the interval, then x n+1 = g(x n ), n = 0,1,2,…, will converge to the root x = r, provided that x 1 is chosen in the interval.

24

25