/
Sec:5.2 The Bisection Method Sec:5.2 The Bisection Method

Sec:5.2 The Bisection Method - PowerPoint Presentation

liane-varnes
liane-varnes . @liane-varnes
Follow
581 views
Uploaded On 2018-03-20

Sec:5.2 The Bisection Method - PPT Presentation

Sec52 The Bisection Method The rootfinding problem is a process involves finding a root or solution of an equation of the form for a given function A root of this equation is also called a ID: 658872

iter bisection sec method bisection iter method sec root function sign change err error interval iteration iter2 0000000000 length

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Sec:5.2 The Bisection Method" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Sec:5.2

The Bisection MethodSlide2

Sec:5.2 The Bisection Method

The

root-finding

problem is a process involves finding a root, or solution, of an equation of the form for a given function . A root of this equation is also called a zero of the function .

 

In graph, the root (or zero) of a function is the

x

-intercept

root

Sec(5.2): The

Bisection Method

Sec(6.2): The Newton-Raphson

Method

Two numerical methods for

root-findingSlide3

Sec:5.2 The Bisection Method

Suppose

is a continuous function defined on the interval

with and of opposite sign. The Intermediate Value Theorem implies that a number exists in with

 

This technique is

based on the Intermediate Value Theorem

Show that

has

a root in

[

12, 16

]

 

Example:

12

16

 

 

Sol:Slide4

Sec:5.2 The Bisection Method

Use Bisection method to find the root of the function

in

[12, 16]

 

Example:

12

16

-34.8

17.6

16-12.6

17.6

12

1415

-12.6

1.5

14.5

15

-5.8

1.5

1 14.0000000000

2

15.0000000000

3

14.5000000000

4

14.7500000000

5 14.8750000000 6 14.9375000000 7 14.9062500000 8 14.8906250000 9 14.8984375000 10 14.9023437500 11 14.9003906250 12 14.8994140625 13 14.8999023438 14 14.9001464844 15 14.9000244141 16 14.8999633789

-34.8

Change of signChange of sign17.6Change of sign

-12.6

Change of sign

Iter1

Iter2

Iter3

 

 

 

 

 

 

14

 

 

True root:

 

16

14Slide5

Sec:5.2 The Bisection Method

12

16

-34.817.616-12.617.61214

15-12.6

1.5

14.5

15-5.8

1.5

-

34.8Change of sign

Change of sign

17.6

Change of sign-12.6

Change of sign

Iter1

Iter2

Iter3

14

16

14

Textbook notations

 

 

 

 

 

 

 

 

 

 

 

 

At the n-

th

iteration:

e

ndpoints of the

inteval

 

 

Length of the interval

 Slide6

Sec:5.2 The Bisection Method

Error Estimates for Bisection

At the iter1:

length of the interval 

12

16

-

34.817.6

16

-12.6

17.612

14

15

-12.61.5

-

34.8

Change of sign

Change of sign

17.6

Change of sign

Iter1

Iter2

 

 

 

 

14

16

 

True root live inside this interval

 

At the iter2:

length of the interval

 

 

At the nth iteration:

length of the interval

 

 

 

 

 

the absolute

error in the n-

th

iteration

 

Error Estimates for BisectionSlide7

Sec:5.2 The Bisection Method

If

is the desired error, this equation can be solved for  

 

Error Estimates for Bisection

 

 

 

 

1

14.0000000000 -9.0000000000e-01

2 15.0000000000

1.0000000000e-01

3 14.5000000000 -4.0000000000e-01

4 14.7500000000 -1.5000000000e-01

5 14.8750000000

-

2.5000000000e-02

6 14.9375000000

3.7500000000e-02

7 14.9062500000

6.2500000000e-03

8 14.8906250000 -9.3750000000e-03

9 14.8984375000 -1.5625000000e-03

10

14.9023437500 2.3437500000e-03

11

14.9003906250

3.9062500000e-04

12

14.8994140625 -5.8593750000e-04

13

14.8999023438 -9.7656250000e-05

14

14.9001464844

1.4648437500e-04

15

14.9000244141

2.4414062500e-05

16

14.8999633789 -3.6621093750e-05

 

 

 Slide8

Sec:5.2

The Bisection Method

function

[xr,err,yc,iter,x]=bisect_ver1(f,a,b,es) %Input: f is the function, a, b are endpts % es is the tolerance, imax is max iter%Output: c is the zero, yc= f(c) ya=f(a); yb=f(b); iter =0;if ya*yb > 0,return,endfor k=1:1000

iter = iter +1;

xr=(a+b)/2; yc

=f(xr); x(k)=xr;

if yc==0 a=xr; b=xr

;

elseif yb*yc

>0 b=xr; yb=yc; else a=xr

; ya=yc;

end if b-a < es,

break,endend xr=(a+b

)/2; err=abs(b-a);

yc

=f(

xr

);

function

[

xr,err,yc,iter,x

]=

bisect_ver2(f,a,b,es)

%Input: f is the function, a, b are endpts

% es is the tolerance,

imax is max iter

%Output: c is the zero, yc= f(c)

ya=f(a); yb=f(b); iter =0;if ya*yb > 0,return,endmax1=1+round((log(b-a)-log(es))/log(2));

for k=1:max1 iter = iter +1;

xr=(a+b)/2; yc=f(xr); x(k)=xr; if yc==0 a=xr

; b=xr; elseif

yb*yc>0 b=

xr

;

yb

=

yc

;

else

a=

xr

;

ya

=

yc

;

end

% if b-a <

es

,

iter

=k;

break,end

end

xr

=(

a+b

)/2; err=abs(b-a);

yc

=f(

xr

);

Stopping Criteria

a=12; b=16;

es

=1e-4;

% [

xr,err,yc,iter,x

]=bisect_ver2(

f,a,b,es

);

[

xr,err,yc,iter,x

]=bisect_ver1(f,a,b,es);iteration = [1:iter]';res = [ iteration, x' , x'-14.9]

fprintf(' %d %14.10f %14.10e \n', res');Slide9

Sec:5.2 The Bisection Method