bisection and newton-raphson methods

21
Outlines Bisection and Newton-Raphson Methods Mike Renfro September 7, 2004 Mike Renfro Bisection and Newton-Raphson Methods

Upload: others

Post on 25-Oct-2021

32 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Bisection and Newton-Raphson Methods

Outlines

Bisection and Newton-Raphson Methods

Mike Renfro

September 7, 2004

Mike Renfro Bisection and Newton-Raphson Methods

Page 2: Bisection and Newton-Raphson Methods

OutlinesPart I: Review of Previous LecturePart II: Bisection and Newton-Raphson Methods

Review of Previous Lecture

Mike Renfro Bisection and Newton-Raphson Methods

Page 3: Bisection and Newton-Raphson Methods

OutlinesPart I: Review of Previous LecturePart II: Bisection and Newton-Raphson Methods

Bisection and Newton-Raphson Methods

Bisection MethodProblem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Newton-Raphson MethodProblem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Homework

Mike Renfro Bisection and Newton-Raphson Methods

Page 4: Bisection and Newton-Raphson Methods

Part I

Review of Previous Lecture

Mike Renfro Bisection and Newton-Raphson Methods

Page 5: Bisection and Newton-Raphson Methods

Review of Previous Lecture

Sample problems solved with numerical methods

Natural frequencies of a vibrating barStatic analysis of a scaffoldingCritical loads for buckling a columnRealistic Design Properties of Materials

Solution of nonlinear equations

IntroductionExample: fluid mechanicsIncremental search method

Mike Renfro Bisection and Newton-Raphson Methods

Page 6: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Part II

Bisection and Newton-Raphson Methods

Mike Renfro Bisection and Newton-Raphson Methods

Page 7: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method

One problem with the incremental search method is its lack ofefficiency in finding a root. If a root is expected on the interval0 < x < 1, it will require between 1 and 10 loops through themethod to bracket the root with 0.1 uncertainty:

Calculate f (0.0),

Calculate f (0.1),

...

Calculate f (1.0)

You may get lucky and only have to perform two functionevaluations. You may be unlucky and have to perform 11evaluations. In general, you’ll probably have to perform 6-7evaluations to find the solution. There has to be a more efficientway to find a solution.

Mike Renfro Bisection and Newton-Raphson Methods

Page 8: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Problem Setup

Start with a function f (x) andtwo values of x (a and b) suchthat f (a) and f (b) have oppositesigns. These values of a and bmay be the final interval of anincremental search method witha relatively large step size.

Mike Renfro Bisection and Newton-Raphson Methods

Page 9: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method Procedure

Evaluate f (x) at themidpoint of the interval, atxmid = a+b

2 .

If f (xmid) 6= 0, then the signof f (xmid) will match thesign of f (a) or the sign off (b).

If f (xmid) matches thesign of f (a), then seta = xmid and repeat.If f (xmid) matches thesign of f (b), then setb = xmid and repeat.

Mike Renfro Bisection and Newton-Raphson Methods

Page 10: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method Procedure

Eventually, this method will limitthe root of f (x) to a sufficientlysmall interval, or |f (xmid)| ≤ ε,where ε is the error tolerance forthe problem.

Mike Renfro Bisection and Newton-Raphson Methods

Page 11: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method Advantages

Since the bisection method discards 50% of the current interval ateach step, it brackets the root much more quickly than theincremental search method does.To compare:

On average, assuming a root is somewhere on the intervalbetween 0 and 1, it takes 6–7 function evaluations to estimatethe root to within 0.1 accuracy.

Those same 6–7 function evaluations using bisection estimatesthe root to within 1

24 = 0.625 to 125 = 0.031 accuracy.

Mike Renfro Bisection and Newton-Raphson Methods

Page 12: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method Disadvantages

Like incremental search, the bisection method only finds rootswhere the function crosses the x axis. It cannot find rootswhere the function is tangent to the x axis.

Like incremental search, the bisection method can be fooledby singularities in the function.

Like incremental search, the bisection method cannot findcomplex roots of polynomials.

Mike Renfro Bisection and Newton-Raphson Methods

Page 13: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupBisection Method ProcedureBisection Method Advantages and DisadvantagesBisection Method Example

Bisection Method Example

Find the root of f (x) = x3 − 2 on the interval where a = 1 andb = 2, and ε = 0.05:

f (1) = 13 − 2 = −1, f (2) = 23 − 2 = 6,f (1.5) = 1.53 − 2 = 1.375. Since 1.375 and 6 have the samesign, the root must be between 1 and 1.5.

f (1) = −1, f (1.5) = 1.375, f (1.25) = −0.047. Since| − 0.047| < ε, the root is assumed to be at x = 1.25.

If we used incremental search to find the same root, we wouldhave required 4 function evaluations using a step size of 0.1,followed by 6 function evaluations using a step size of 0.01.

Mike Renfro Bisection and Newton-Raphson Methods

Page 14: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Problem Setup

Given: a function f (x), itsderivative f ′(x), a starting pointx1, and an error tolerance ε.We assume that both the heightof the function f (x) and its slopecan help us make a moreeducated guess of the root x∗.

Mike Renfro Bisection and Newton-Raphson Methods

Page 15: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Procedure

Draw a line tangent to thefunction at the point (x1, f (x1)).The point where the tangent linecrosses the x axis should be abetter estimate of the root thanx1. Call that point x2.Calculate f (x2), and draw a linetangent to the function at thepoint (x2, f (x2)). The pointwhere the new tangent linecrosses the x axis should be abetter estimate of the root thanx2. Call that point x3.Repeat until |f (x)| < ε.

Mike Renfro Bisection and Newton-Raphson Methods

Page 16: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Advantages

Unlike the incremental search and bisection methods, theNewton-Raphson method isn’t fooled by singularities.

Also, it can identify repeated roots, since it does not look forchanges in the sign of f (x) explicitly.

It can find complex roots of polynomials, assuming you startout with a complex value for x1.

For many problems, Newton-Raphson converges quicker thaneither bisection or incremental search.

Mike Renfro Bisection and Newton-Raphson Methods

Page 17: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Disadvantages

The Newton-Raphson method only works if you have a functionalrepresentation of f ′(x). Some functions may be difficult toimpossible to differentiate. You may be able to work around thisby approximating the derivative f ′(x) ≈ f (x+∆x)−f (x)

∆x .

Mike Renfro Bisection and Newton-Raphson Methods

Page 18: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Disadvantages

The Newton-Raphson method isnot guaranteed to find a root.For example, if the starting pointx1 is sufficiently far away fromthe root for the functionf (x) = tan−1 x , the function’ssmall slope tends to drive the xguesses further and further awayfrom the root.

Mike Renfro Bisection and Newton-Raphson Methods

Page 19: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Disadvantages

If the derivative of the functionat any tested point xi issufficiently close to zero, the nextpoint xi+1 will be very far away.You may still find the root, butyou will be delayed.

Mike Renfro Bisection and Newton-Raphson Methods

Page 20: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Problem SetupNewton-Raphson Method ProcedureNewton-Raphson Method Advantages and Disadvantages

Newton-Raphson Method Disadvantages

If the derivative of the functionchanges sign near a tested point,the Newton-Raphson methodmay oscillate around a pointnowhere near the nearest root.

Mike Renfro Bisection and Newton-Raphson Methods

Page 21: Bisection and Newton-Raphson Methods

Bisection MethodNewton-Raphson Method

Homework

Homework

Find the solution of f (x) = x2 − 10 = 0 using the followingmethods and starting points:

Bisection method, with a = 1, b = 3, and ε = 0.01.

Newton-Raphson method, with x0 = 0 and ε = 0.01.

Will both of these problem statements yield a solution? If not,what can you do to change the problem setup to allow you to finda solution?

Mike Renfro Bisection and Newton-Raphson Methods