Today’s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 1 Prof. Jinbo Bi CSE, UConn.

Slides:



Advertisements
Similar presentations
Roundoff and truncation errors
Advertisements

CSE 330: Numerical Methods
Roots: Bracketing Methods
ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.
Bisection Method (Midpoint Method for Equations).
Numerical Computation
Today’s class Romberg integration Gauss quadrature Numerical Methods
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
Unit-I Roots of Equation
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 7 Roots of Equations Bracketing Methods.
Chapter 4 Roots of Equations
Second Term 05/061 Roots of Equations Bracketing Methods.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 6 Roots of Equations Bracketing Methods.
Roots of Equations Bracketing Methods.
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.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
NUMERICAL METHODS WITH C++ PROGRAMMING
Bracketing Methods Chapter 5 The Islamic University of Gaza
FP1: Chapter 2 Numerical Solutions of Equations
Fin500J: Mathematical Foundations in Finance Topic 3: Numerical Methods for Solving Non-linear Equations Philip H. Dybvig Reference: Numerical Methods.
- + Suppose f(x) is a continuous function of x within interval [a, b]. f(a) = - ive and f(b) = + ive There exist at least a number p in [a, b] with f(p)
Roots of Equations Chapter 3. Roots of Equations Also called “zeroes” of the equation –A value x such that f(x) = 0 Extremely important in applications.
I. Finding Roots II. Integrating Functions
Integrals 5.
Today’s class Numerical Integration Newton-Cotes Numerical Methods
Chapter 14: Numerical Methods
Solving Non-Linear Equations (Root Finding)
CMPSC 200 Spring 2013 Lecture 38 November 18 or 20, 2013 (depending on section)
Continuity ( Section 1.8) Alex Karassev. Definition A function f is continuous at a number a if Thus, we can use direct substitution to compute the limit.
Chapter 6 Finding the Roots of Equations
Introduction This chapter gives you several methods which can be used to solve complicated equations to given levels of accuracy These are similar to.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Review Taylor Series and Error Analysis Roots of Equations
Part 2 Chapter 5 Roots: Bracketing Methods PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Lecture 3 Numerical Analysis. Solution of Non-Linear Equations Chapter 2.
Lecture 6 Numerical Analysis. Solution of Non-Linear Equations Chapter 2.
1 Solution of Nonlinear Equation Dr. Asaf Varol
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.
Today’s class Numerical Differentiation Finite Difference Methods Numerical Methods Lecture 14 Prof. Jinbo Bi CSE, UConn 1.
Today’s class Roots of equation Finish up incremental search
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 5 Bracketing Methods.
Solving Non-Linear Equations (Root Finding)
Solution of Nonlinear Equations Topic: Bisection method
Numerical Methods Solution of Equation.
Exam 1 Oct 3, closed book Place ITE 119, Time:12:30-1:45pm
1/29/ Bisection Method Computer Engineering Majors Authors: Autar Kaw, Jai Paul
Recursive Methods for Finding Roots of Functions Bisection & Newton’s Method.
SOLVING NONLINEAR EQUATIONS. SECANT METHOD MATH-415 Numerical Analysis 1.
Today’s class Ordinary Differential Equations Runge-Kutta Methods
Exam 1 Oct 3, closed book Place ITE 119, Time:12:30-1:45pm One double-sided cheat sheet (8.5in x 11in) allowed Bring your calculator to the exam Chapters.
3/7/ Bisection Method Electrical Engineering Majors Authors: Autar Kaw, Jai Paul
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.
MATH342: Numerical Analysis Sunjae Kim.
CMPSC 200 Fall 2013 Lecture 37 November 18, 2013.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
NUMERICAL DIFFERENTIATION Forward Difference Formula
Bracketing Methods (Bisection Method)
Today’s class Multiple Variable Linear Regression
Chapter 1: False-Position Method of Solving a Nonlinear Equation
Intermediate Value Theorem
Intermediate Value Theorem
Roots: Bracketing Methods
Roots: Bracketing Methods
Presentation transcript:

Today’s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 1 Prof. Jinbo Bi CSE, UConn

Finite divided difference First forward difference First backward difference Numerical Differentiation Numerical Methods, Lecture 4 2 Prof. Jinbo Bi CSE, UConn

Centered difference approximation Subtract the two equations Numerical Differentiation Numerical Methods, Lecture 3 3 Prof. Jinbo Bi CSE, UConn

First forward difference Numerical Differentiation Numerical Methods, Lecture 4 4 Prof. Jinbo Bi CSE, UConn

First backward difference Numerical Differentiation Numerical Methods, Lecture 4 5 Prof. Jinbo Bi CSE, UConn

Centered difference Numerical Differentiation Numerical Methods, Lecture 4 6 Prof. Jinbo Bi CSE, UConn

What is the effect of error in one calculation propagating to subsequent calculations? Example: Multiplying sin x with cos x Single variable functions Error Propagation Numerical Methods, Lecture 4 7 Prof. Jinbo Bi CSE, UConn

Use Taylor series Error Propagation Numerical Methods, Lecture 4 8 Prof. Jinbo Bi CSE, UConn

Error Propagation Numerical Methods, Lecture 4 9 Prof. Jinbo Bi CSE, UConn

Multivariable functions Error Propagation Numerical Methods, Lecture 4 10 Prof. Jinbo Bi CSE, UConn

Condition of a problem is a measure of its sensitivity to changes in input values The condition number is defined as the ratio of the relative function error to the relative value error Numerical stability Numerical Methods, Lecture 4 11 Prof. Jinbo Bi CSE, UConn

Condition number < 1 indicates a well- conditioned function – i.e. changes in the input are attenuated Condition number > 1 indicates a ill- conditioned function – i.e. changes in the input are amplified Numerical stability Numerical Methods, Lecture 4 12 Prof. Jinbo Bi CSE, UConn

Roots of equation Given a function f(x), the roots are those values of x that satisfy the relation f(x) = 0 Example From the quadratic formula, the roots are: Numerical Methods, Lecture 4 13 Prof. Jinbo Bi CSE, UConn

Roots of Equations The need to solve for roots show up in many engineering problems Also, can be used to find solutions to implicit variables Numerical Methods, Lecture 4 14 Prof. Jinbo Bi CSE, UConn

Find a value of R such that current is 5A at t = 1s Example Numerical Methods, Lecture 4 15 Prof. Jinbo Bi CSE, UConn

Example It is not possible to isolate R to the left side and thus solve for R R is know as an implicit variable Rewrite the function as a function of R set to 0 Numerical Methods, Lecture 4 16 Prof. Jinbo Bi CSE, UConn

Still need a method to solve for this root Other examples of difficult to solve roots Roots of equations Numerical Methods, Lecture 4 17 Prof. Jinbo Bi CSE, UConn

Non-computer methods Graphical methods Roots of equations Numerical Methods, Lecture 4 18 Prof. Jinbo Bi CSE, UConn

Not exact Can give you a rough estimate of the root, Can give you insights on the number of roots and shape of the curve Can use the rough estimate in more precise numerical methods Graphical methods Numerical Methods, Lecture 4 19 Prof. Jinbo Bi CSE, UConn

Use to get an initial estimate of the root and also to find out how many roots there are Graphical methods Numerical Methods, Lecture 4 20 Prof. Jinbo Bi CSE, UConn

Graphical methods Numerical Methods, Lecture 4 21 Prof. Jinbo Bi CSE, UConn

Graphical methods Numerical Methods, Lecture 4 22 Prof. Jinbo Bi CSE, UConn

Graphical methods Numerical Methods, Lecture 4 23 Prof. Jinbo Bi CSE, UConn

Non-computer/numerical method Exhaustive search method To find the root in the interval [a,b], start at x=a and check if f(a) = 0, then try f(a+Δ), f(a+2Δ), and so on, until we get f(x) sufficiently close to 0 If the step value Δ is sufficiently small we can obtain an accurate result but this could take an extremely long time. For example, if the interval is [0,10] and the step size is Δ = 0.001, it will take on average 10,000 guesses In addition to the inefficiency of this approach, if f(x) is a steep function, this approach may not produce an accurate results Roots of equation Numerical Methods, Lecture 4 24 Prof. Jinbo Bi CSE, UConn

Example Find the root of the function Actual root is at x= With an interval of [0.9, 1.1] and a step size of Δ = The exhaustive search method will test f(1.000) = and f(1.001) = 0.086, neither of which are that close to f(x) = 0 Exhaustive search Numerical Methods, Lecture 4 25 Prof. Jinbo Bi CSE, UConn

More systematic methods are required Bracketing methods Open methods Roots of equations Numerical Methods, Lecture 4 26 Prof. Jinbo Bi CSE, UConn

Locate an interval where sign changes Divide interval into smaller subintervals which are then searched for sign changes Keep repeating until root is found with sufficient confidence Incremental search methods Numerical Methods, Lecture 4 27 Prof. Jinbo Bi CSE, UConn

Also called: Binary chopping Interval halving An incremental search method where the interval is cut in half Bisection method Numerical Methods, Lecture 4 28 Prof. Jinbo Bi CSE, UConn

Step 1: Choose lower x l and upper x u such that the function changes sign over that range – i.e. f(x l ) and f(x u ) are different signs – or f(x l ) f(x u ) < 0 Step 2: Estimate root to be x r =(x l +x u )/2 Bisection method Numerical Methods, Lecture 4 29 Prof. Jinbo Bi CSE, UConn

Step 3: Determine in which subinterval the root lies If f(x r )  0 is within acceptable tolerance, stop and root equals x r If f(x l ) f(x r ) < 0, then root is in lower subinterval. Set x u = x r, and return to step 2 If f(x l ) f(x r ) > 0, then root is in upper subinterval. Set x l = x r, and return to step 2 Bisection method Numerical Methods, Lecture 4 30 Prof. Jinbo Bi CSE, UConn

Termination criteria Use approximate relative error calculation to determine when to stop In general,  a is larger than  t Bisection method Numerical Methods, Lecture 4 31 Prof. Jinbo Bi CSE, UConn

Example: Use range of [202:204] Root is in upper subinterval Bisection method Numerical Methods, Lecture 4 32 Prof. Jinbo Bi CSE, UConn

Bisection method Use range of [203:204] Root is in lower subinterval – Numerical Methods, Lecture 4 33 Prof. Jinbo Bi CSE, UConn

Use range of [203:203.5] Root is in upper subinterval Bisection method Numerical Methods, Lecture 4 34 Prof. Jinbo Bi CSE, UConn

The approximate error is upper bound estimate of the true error When the root is near one of the ends of the interval, the approximate error is fairly close to the actual true error Error is fairly well-contained Error estimates Numerical Methods, Lecture 4 35 Prof. Jinbo Bi CSE, UConn

You always know that the true root is within Δx/2 of your estimate Error estimates Numerical Methods, Lecture 4 36 Prof. Jinbo Bi CSE, UConn

Bisection method Numerical Methods, Lecture 4 37 Prof. Jinbo Bi CSE, UConn

You can calculate an error estimate based just on the initial guesses You can also make estimates on the error on future iterations Superscripts indicates the iteration number Bisection method Numerical Methods, Lecture 4 38 Prof. Jinbo Bi CSE, UConn

Each subsequent iteration cuts the approximate error in half This, allows to determine a priori exactly how many iterations are needed to arrive at the desired error Bisection method Numerical Methods, Lecture 4 39 Prof. Jinbo Bi CSE, UConn

The false position method works in a similar fashion to the bisection method Start with an initial interval [a,b] where f(a) and f(b) have opposite signs, which is the same as the bisection Instead of choosing the initial guess x r as the midpoint of the interval, we join the point {a,f(a)} and {b,f(b)} with a straight line and choose x r as the point where that straight line crosses the x-axis. False Position Method Numerical Methods, Lecture 4 40 Prof. Jinbo Bi CSE, UConn

False Position Method Numerical Methods, Lecture 4 41 Prof. Jinbo Bi CSE, UConn

Algorithm is the same as bisection method with the same three steps False Position Method Numerical Methods, Lecture 4 42 Prof. Jinbo Bi CSE, UConn

Step 1: Choose lower x l and upper x u such that the function changes sign over that range - i.e. f(x l ) and f(x u ) are different signs - or f(x l ) f(x u ) < 0 Step 2: Estimate new root to be False Position Method Numerical Methods, Lecture 4 43 Prof. Jinbo Bi CSE, UConn

Step 3: Determine in which subinterval the root lies If f(x r )  0 is within acceptable tolerance, stop and root equals x r If f(x l ) f(x r ) < 0, then root is in lower subinterval. Set x u = x r, and return to step 2 If f(x l ) f(x r ) > 0, then root is in upper subinterval. Set x l = x r, and return to step 2 False Position Method Numerical Methods, Lecture 4 44 Prof. Jinbo Bi CSE, UConn

Roots of equations Open methods Read chapters 5 and 6 HW2, due 9/17 Chapra & Canale 6 th edition 3.5, 3.7, 3.13, 4.5, 4.6, 4.12 (b) and (d), and 4.16 Next class Numerical Methods, Lecture 4 45 Prof. Jinbo Bi CSE, UConn