Chapter 5 Roots of Equations: Bracketing Models. Gab-Byung Chae

Similar documents
Numerical Methods School of Mechanical Engineering Chung-Ang University

Q. 의학연구에의하면 4초후에낙하속도가 36 m/s를초과하면척추손상을입을가능성이높다. 항력계수가 kg/m 로주어질때이러한판정기준이초과하는질량을구하시오.

Therefore, the root is in the second interval and the lower guess is redefined as x l = The second iteration is

Bisection and False Position Dr. Marco A. Arocha Aug, 2014

Root Finding: Close Methods. Bisection and False Position Dr. Marco A. Arocha Aug, 2014

CHAPTER 4 ROOTS OF EQUATIONS

Scientific Computing. Roots of Equations

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

Numerical Methods. Roots of Equations

cha1873x_p02.qxd 3/21/05 1:01 PM Page 104 PART TWO

Computational Methods for Engineers Programming in Engineering Problem Solving

MATH 3795 Lecture 12. Numerical Solution of Nonlinear Equations.

Numerical Solution of f(x) = 0

Numerical Methods Lecture 3

Finding the Roots of f(x) = 0. Gerald W. Recktenwald Department of Mechanical Engineering Portland State University

Finding the Roots of f(x) = 0

Math 551 Homework Assignment 3 Page 1 of 6

TWO METHODS FOR OF EQUATIONS

R x n. 2 R We simplify this algebraically, obtaining 2x n x n 1 x n x n

Intro to Scientific Computing: How long does it take to find a needle in a haystack?

Variable. Peter W. White Fall 2018 / Numerical Analysis. Department of Mathematics Tarleton State University

Numerical Methods School of Mechanical Engineering Chung-Ang University

6.1 The function can be set up for fixed-point iteration by solving it for x

COURSE Iterative methods for solving linear systems

CHAPTER-II ROOTS OF EQUATIONS

Figure 1: Graph of y = x cos(x)

What are Numerical Methods? (1/3)

Lecture 7. Root finding I. 1 Introduction. 2 Graphical solution

Curve Fitting. Objectives

Numerical Methods. Root Finding

Finding Roots of Equations

10.3 Steepest Descent Techniques

Numerical Analysis Fall. Roots: Open Methods

INTRODUCTION TO NUMERICAL ANALYSIS

Chapter 2 Solutions of Equations of One Variable

Root finding. Root finding problem. Root finding problem. Root finding problem. Notes. Eugeniy E. Mikhailov. Lecture 05. Notes

Solution of Algebric & Transcendental Equations

VCE. VCE Maths Methods 1 and 2 Pocket Study Guide

Math 4329: Numerical Analysis Chapter 03: Newton s Method. Natasha S. Sharma, PhD

Lecture 8. Root finding II

Root finding. Eugeniy E. Mikhailov. Lecture 05. The College of William & Mary. Eugeniy Mikhailov (W&M) Practical Computing Lecture 05 1 / 10

Goals for This Lecture:

Root Finding Convergence Analysis

Numerical Integration and Numerical Differentiation. Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Determining the Roots of Non-Linear Equations Part I

CE 205 Numerical Methods. Some of the analysis methods you have used so far.. Algebra Calculus Differential Equations etc.

PART I Lecture Notes on Numerical Solution of Root Finding Problems MATH 435

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD

Root finding. Eugeniy E. Mikhailov. Lecture 06. The College of William & Mary. Eugeniy Mikhailov (W&M) Practical Computing Lecture 06 1 / 10

Homework 2 - Solutions MA/CS 375, Fall 2005

SKMM 3023 Applied Numerical Methods

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

x and y, called the coordinates of the point.

January 18, 2008 Steve Gu. Reference: Eta Kappa Nu, UCLA Iota Gamma Chapter, Introduction to MATLAB,

Solving Non-Linear Equations (Root Finding)

Lecture 44. Better and successive approximations x2, x3,, xn to the root are obtained from

SME 3023 Applied Numerical Methods

Chapter 4. Solution of Non-linear Equation. Module No. 1. Newton s Method to Solve Transcendental Equation

Scientific Computing: An Introductory Survey

GENG2140, S2, 2012 Week 7: Curve fitting

Math 471. Numerical methods Root-finding algorithms for nonlinear equations

Outline. Math Numerical Analysis. Intermediate Value Theorem. Lecture Notes Zeros and Roots. Joseph M. Mahaffy,

Unit 2: Solving Scalar Equations. Notes prepared by: Amos Ron, Yunpeng Li, Mark Cowlishaw, Steve Wright Instructor: Steve Wright

Solution of Nonlinear Equations: Graphical and Incremental Sea

BHASVIC MαTHS. (a) The table shows the number of eggs a bird lays per brood cycle. The mean number of eggs is 1.5. Find the value of p

ROOT FINDING REVIEW MICHELLE FENG

Midterm Review. Igor Yanovsky (Math 151A TA)

We consider the problem of finding a polynomial that interpolates a given set of values:

Applied Numerical Methods With MATLAB for Engineers and Scientists

Relation of Pure Minimum Cost Flow Model to Linear Programming

Numerical Methods I Solving Nonlinear Equations

NUMERICAL AND STATISTICAL COMPUTING (MCA-202-CR)

Chapter 5 - Integration

Computational Methods CMSC/AMSC/MAPL 460. Solving nonlinear equations and zero finding. Finding zeroes of functions

Nonlinear Equations. Not guaranteed to have any real solutions, but generally do for astrophysical problems.

CS 221 Lecture 9. Tuesday, 1 November 2011

4.1 Areas and Distances. The Area Problem: GOAL: Find the area of the region S that lies under the curve y = f(x) from a to b.

Introductory Numerical Analysis

Math 2413 General Review for Calculus Last Updated 02/23/2016

Math Numerical Analysis

CHAPTER Order points and then develop a divided difference table:

5 Finding roots of equations

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations

The Islamic University of Gaza Faculty of Engineering Civil Engineering Department. Numerical Analysis ECIV Chapter 5. Bracketing Methods

CHAPTER 1 INTRODUCTION TO NUMERICAL METHOD

Nonlinearity Root-finding Bisection Fixed Point Iteration Newton s Method Secant Method Conclusion. Nonlinear Systems

SOLVING EQUATIONS OF ONE VARIABLE

3.1 Introduction. Solve non-linear real equation f(x) = 0 for real root or zero x. E.g. x x 1.5 =0, tan x x =0.

NATIONAL BOARD FOR HIGHER MATHEMATICS. M. A. and M.Sc. Scholarship Test. September 22, Time Allowed: 150 Minutes Maximum Marks: 30

Chapter 3: Root Finding. September 26, 2005

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations

BHASVIC MαTHS. Convert the below into the form ax m + bx n : (b) (c) (e) (f)

FIXED POINT ITERATION

Numerical Methods Dr. Sanjeev Kumar Department of Mathematics Indian Institute of Technology Roorkee Lecture No 7 Regula Falsi and Secant Methods

1.1: The bisection method. September 2017

AQA Level 2 Certificate in FURTHER MATHEMATICS (8365/2)

R1: Sets A set is a collection of objects sets are written using set brackets each object in onset is called an element or member

Numerical solutions of nonlinear systems of equations

Math 2142 Homework 5 Part 1 Solutions

Two hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45

Transcription:

Chapter 5 Roots of Equations: Bracketing Models Gab-Byung Chae 2008 4 17

2 Chapter Objectives Studying Bracketing Methods Understanding what roots problems are and where they occur in engineering and science. Knowing how to determine a root graphically. Understanding the incremental search method and its shortcoming. Knowing how to solve a roots problem with the bisection method. Knowing how to estimate the error of bisection Understanding false position and how it differs from bisection. You ve got a problem A bungee jumper s chances of sustaining a significant vertebrae injury increase significantly if the free-fall velocity exceeds 36m/s after 4 s of free fall. ( ) gm gcd v(t) = tanh m t Can you solve this equation when c d = 0.25kg/m for the mass? c d An alternative way of looking at the problem involves subtracting v(t) from both sides to give a new function: gm f(m) = c d (1) ( ) gcd tanh m t v(t) (2) Now we can see that the answer to the problem is the value of m that makes the function equal to zero. Hence we call this a roots problem. 5.1 INTRODUCTION AND BACKGROUND 5.1.1 What Are Roots? Quadratic formula x = b ± b 2 4ac 2a (3)

3 to solve f(x) = ax 2 + bx + c = 0 (4) 5.1.2 Roots of Equations and Engineering Practice Eq.(1) can be used to predict the jumper s velocity. Such computations can be performed directly because v is expressed explicitly as a function of the model parameters. Suppose we had to determine the mass for a jumper with a given drag coefficient to attain a prescribed velocity in a set time period. Eq.(1) cannot be solved explicitly for mass. In such cases, m is said to be implicit. The solution to the implicit equations is provided by numerical methods for roots of equations as in Eq.(2) 5.2 GRAPHICAL METHODS Example 0.1 The Graphical Approach Use the graphical approach to determine the mass of the bungee jumper with a drag coefficient of 0.25kg/m to have a velocity of 36m/s after 4 s of free fall. The acceleration of gravity is 9.81m/s 2. Solution >> cd = 0.25; g = 9.81; v = 36; t = 4; >> mp = linspace(50,200);

4 >> fp = sqrt(g*mp/cd).*tanh(sqrt(g*cd./mp)*t)-v; >> plot(mp,fp),grid The function crosses the m axis between 140 and 150kg. The validity of the graphical estimate can be checked by substituting it into Eq.(2) to yield >> sqrt(g*145/cd).*tanh(sqrt(g*cd./145)*t) ans = 36.0456 which is close to the desired fall velocity of 36m/s. Graphical methods can be utilized to obtain rough estimates of roots. These estimates can be employed as starting guesses for numerical methods discussed in this chapter. Figure 5.1 shows a number of ways in which roots can occur (or absent ) in an interval. 5.3 BRACKETING METHODS AND INITIAL GUESSES Trial and Error : You should repeatedly make guesses until the function is sufficiently close to zero.

5

6 The two major classes of methods available are distinguished by the type of initial guess. Bracketing methods. As the name implies, these are based on two initial guesses that bracket the root-that is, are on either side of the root. Open methods. These methods can involve one or more initial guesses, but there is no need for them to bracket the root. The bracketing methods work but converge slowly. The open methods do not always work, but when they do they usually converge quicker. In both cases, initial guesses are required. How to make a good initial guess? The following section describes one such approach, the incremental search. 5.3.1 Incremental Search You observed that f(x) changed sign on opposite sides of the root. In general, f(x) is real and continuous in the interval from x l to x u and f(x l ) and f(x u ) have opposite signs, that is, f(x l )f(x u ) < 0 then there is at least one real root between x l and x u. Incremental search methods capitalize on this observation by locating an interval where the function changes sign. An M-file can be developed that implements an incremental search to locate the roots of a function func within the range from xmin to xmax. ns : the number of intervals within the range. (default is 50) function xb = incsearch(func, xmin, xmax,ns ) % incsearch(func, xmin, xmax,ns ): % find brackets of x that contain sign changes of % a function on an interval % input: % func = name of function

7 % xmin, xmax = endpoints of interval % ns = (optional) number of subintervals along x % used to search for brackets %output: % xb(k,1) is the lower bound of the kth sign change % xb(k,2) is the upper bound of the kth sign change % If no brackets found, xb = []. if nargin < 4, ns = 50 ; end % if ns blank set to 50 % Incremental search x = linspace(xmin,xmax,ns); f = feval(func,x); nb = 0; xb=[ ]; %xb is null unless sign change detected for k =1 : length(x) -1 if sign(f(k)) ~= sign(f(k+1)) % check for sign change nb = nb + 1; xb(nb,1) = x(k); xb(nb,2) = x(k+1); end end if isempty(xb) % display that no brackets were found disp( no brackets found ) disp( check interval or increase ns ) else disp( number of brackets: ) % display number of brackets disp(nb) end Example 0.2 Use the M-file incsearch to identify brackets within the inter-

8 val [3, 6] for the function: f(x) = sin(10x) + cos(3x) Solution >> incsearch( inline( sin(10*x) +cos(3*x) ),3,6) number of brackets: 5 ans = 3.2449 3.3061 3.3061 3.3673 3.7347 3.7959 4.6531 4.7143 5.6327 5.6939 >> incsearch( inline( sin(10*x) +cos(3*x) ),3,6,100) number of brackets:

9 9 ans = 3.2424 3.2727 3.3636 3.3939 3.7273 3.7576 4.2121 4.2424 4.2424 4.2727 4.6970 4.7273 5.1515 5.1818 5.1818 5.2121 5.6667 5.6970 5.4 BISECTION The bisection method is a variation of the incremental search method in which the interval in the ith iteration is always divided in half in (i + 1)th iteration.

10 Example 0.3 The Bisection Method Use bisection to solve the same problem approached graphically in Example 5.1 Solution From the graphical solution in Example 5.1, we can see that the function changes sign between values of 50 and 200(Let s assume). Therefore, the initial estimate of the root x r lies at the midpoint of the interval x r = 50 + 200 2 = 125 Next we compute the product of the function value at the lower bound and at the midpoint : f(50)f(125) = 4.579( 0.409) = 1.871 > 0 which means that the root must be located in the upper interval between 125 and 200. The new interval extends from x l = 125 to x u = 200. x r = 125 + 200 2 = 162.5 And f(125)f(162.5) = 0.409(0.359) = 0.147 < 0

11 Therefore, the root is now in the lower interval between 125 and 162.5. The upper bound is redefined as 162.5 and the root estimate for the third iteration is calculated as x r = 125 + 162.5 2 = 143.75 which represent a percent relative error of ε t = 142.7376 143.75 142.7376 100% = 0.709% The method can be repeated until the result is accurate enough to satisfy your needs. But how? We do not know the true value!! So we use an approximate percent relative error as in Eq.(4.5) ε a = where x new r previous iteration. Example 0.4 x new r x old r x new r is the root for the present iteration and x old r Error Estimate for Bisection 100% (5) is the root from the Continue Example 5.3 until the approximate error falls below a stopping criterion of ε s = 0.5%. Use Eq.(5) to compute the errors. Solution The results for the first two iterations for Example 5.3 were 125 and 162.5. By Eq.(5) ε a = 162.5 125 162.5 100% = 23.08% After eight iterations ε a finally falls below ε s = 0.5%, and the computation can be terminated. The Fig.5.6 exhibits the extremely attractive characteristic that ε a is always greater than ε t (generally this is true for bisection, Why?). Thus, when ε a falls

12 below ε s, the computation could be terminated with confidence that the root is known to be at least as accurate as the prespecified acceptable level. This is the one benefit of the bisection. Another benefit of the bisection : The number of iterations required to attain an absolute error can be computed a priori. 5.4.1 MATLAB M-file : bisection function root = bisection(func, xl, xu, es, maxit ) % bisection(func, xl, xu, es, maxit ): % use bisection method to find the root of a function % input: % func = name of function % xl, xu = lower and upper guesses % es = (optional) stopping criterion (%) % maxit = (optional) maximum allowable iterations %output: % rooot = real root if func(xl)*func(xu) >0 error( no bracket ) %if guesses do not bracket a sign %change, display an error message

13 end return %and terminate %if necessary, assign default values if nargin < 5, maxit = 50 ; end %if maxit blank set to 50 if nargin < 4, es = 0.001; end %if es blank set to 0.001 % bisection iter =0; xr = xl; while (1) xrold = xr; xr = (xl + xu)/2; iter = iter + 1 ; if xr~= 0, ea = abs((xr - xrold)/xr)* 100; end test = func(xl)*func(xr); if test < 0 xu = xr ; elseif test > 0 xl = xr; else ea = 0 ; end if ea <= es iter >= maxit, break, end end root = xr; 5.5 FALSE POSITION False position(also called the linear interpolation method) is another wellknown bracketing method. It uses a different strategy to come up with its new root estimate.

14 It locates the root by joining f(x l ) and f(x u ) with a straight line(see Figure). The intersection of this line with the x axis represents an improved estimate of the root. Using similar triangles, we have f(x l ) : f(x u ) = (x r x l ) : (x u x r ) or Therefore x r = f(x l)x u f(x u )x l f(x l ) f(x u ) x r = x u f(x u)(x l x u ) f(x l ) f(x u ) This is the false-position formula. The value of x r computed with Eq.(6) then replaces whichever of the two initial guesses, x l or x u, yields a function value with the same sign as f(x r ). (HOMEWORK : implement false-position method using MATLAB) Example 0.5 The False-Position Method Use false position to solve the same problem approached graphically and with bisection in Example 5.1 and 5.3. Solution (6)

15 With initial guesses x l = 50 and x u = 200 First iteration : x r = 200 which has a true relative error of 23.5%. Second iteration : x l = 50 f(x l ) = 4.579387 x u = 200 f(x u ) = 0.860291 0.860291(50 200) 4.579387 0.860291 = 176.2773 f(x l )f(x r ) = 2.592732 Therefore, the root lies in the first subinterval, and x r becomes the upper limit for the next iteration, x u = 176.2773 x r = 176.2773 x l = 50 f(x l ) = 4.579387 x u = 176.2773 f(x u ) = 0.566174 0.566174(50 176.2773) 4.579387 0.566174 = 162.3828 which has a true and approximate relative errors of 13.76% and 8.56%, respectively. False position method often performs better than bisection, but not always. Example 0.6 A Case Where Bisection Is Preferable to False Position f(x) = x 10 1 between x = 0 and 1.3. Bisection : False position: See Figure 5.9

16