2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’...

8
2.1 The Bisection Method 1

Transcript of 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’...

Page 1: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

2.1 The Bisection Method

1

Page 2: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

Basic Idea

β€’ Suppose function 𝑓(π‘₯) is continuous on [π‘Ž, 𝑏], and 𝑓(π‘Ž), 𝑓(𝑏) have opposite signs.

β€’ By the Intermediate Value Theorem (IVT), there must exist an 𝑝 in (π‘Ž, 𝑏) with 𝑓 𝑝 = 0.

β€’ Bisect (sub)intervals and apply IVT repeatedly.

2

Page 3: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

β€’ The sequence of intervals {(π‘Žπ‘– , 𝑏𝑖)}𝑖=1∞ contains

the desired root. 3

Page 4: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

β€’ Intervals containing the root: π‘Ž1, 𝑏1 βŠƒπ‘Ž2, 𝑏2 βŠƒ π‘Ž3, 𝑏3 βŠƒ π‘Ž4, 𝑏4 …

β€’ After 𝑛 steps, the interval π‘Žπ‘›, 𝑏𝑛 has the length:

𝑏𝑛 βˆ’ π‘Žπ‘› = 12

π‘›βˆ’1(𝑏 βˆ’ π‘Ž)

β€’ Let 𝑝𝑛 =𝑏𝑛+π‘Žπ‘›

2 be the mid-point of π‘Žπ‘›, 𝑏𝑛 . The

limit of sequence {𝑝𝑛}𝑛=1∞ is the root.

4

Page 5: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

The Algorithm

5

INPUT a,b; tolerance TOL; maximum number of iterations N0.

OUTPUT solution p or message of failure.

STEP1 Set i = 1;

FA = f(a);

STEP2 While i ≀ N0 do STEPs 3-6.

STEP3 Set p = a + (b-a)/2; // a good way of computing middle point

FP = f(p).

STEP4 IF FP = 0 or (b-a) < TOL then

OUTPUT (p);

STOP.

STEP5 Set i = i +1.

STEP6 If FPβˆ™FA > 0 then

Set a = p;

FA = FP.

else

set b = p;

STEP7 OUTPUT(β€œMethod failed after N0 iterations”);

STOP.

Page 6: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

Matlab Code

function p=bisection(f,a,b,tol) while 1 p=(a+b)/2; if p-a<tol, break; end if f(a)*f(p)>0 a=p; else b=p; end end %while 1

6

Page 7: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

Stopping Criteria

β€’ Method 1: 𝑝𝑛 βˆ’ π‘π‘›βˆ’1 < πœ€

β€’ Method 2:

|π‘π‘›βˆ’π‘π‘›βˆ’1|

|𝑝𝑛|< πœ€, 𝑝𝑛 β‰  0 or

𝑓 𝑝𝑛 < πœ€

β€’ None is perfect. Use a combination in real applications.

7

Page 8: 2.1 The Bisection Method - University of Notre Damezxu2/acms40390F13/Lec-2.1.pdfΒ Β· Convergence β€’ Theorem Suppose function 𝑓(π‘₯) is continuous on [ , ], and 𝑓 βˆ™π‘“

Convergence

β€’ Theorem

Suppose function 𝑓(π‘₯) is continuous on [π‘Ž, 𝑏], and 𝑓 π‘Ž βˆ™ 𝑓 𝑏 < 0. The Bisection method generates a sequence {𝑝𝑛}𝑛=1

∞ approximating a zero 𝑝 of 𝑓(π‘₯) with

𝑝𝑛 βˆ’ 𝑝 = 12

𝑛𝑏 βˆ’ π‘Ž , when 𝑛 β‰₯ 1

β€’ Convergence rate

The sequence {𝑝𝑛}𝑛=1∞ converges to 𝑝 with the

rate of convergence 𝑂( 12

𝑛):

𝑝𝑛 = 𝑝 + 𝑂( 12

𝑛)

8