Download presentation
Presentation is loading. Please wait.
1
Sec:5.2 The Bisection Method
2
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 π π₯ = 0 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 Two numerical methods for root-finding Sec(5.2): The Bisection Method root Sec(6.2): The Newton-Raphson Method
3
Sec:5.2 The Bisection Method
This technique is based on the Intermediate Value Theorem Example: 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 π ( π) = 0. Show that π (π₯) = 10 π₯ 6 β149 π₯ 5 +10π₯β149 10( π₯ 4 +1) has a root in [12, 16] Sol: 12 16 π(ππ)=βππ.π π(ππ)=ππ.π
4
Sec:5.2 The Bisection Method
Example: Use Bisection method to find the root of the function π (π₯) = 10 π₯ 6 β149 π₯ 5 +10π₯β149 10( π₯ 4 +1) in [12, 16] 12 16 Change of sign -34.8 17.6 π π = True root: π₯ π β =14.9 12 14 Change of sign 16 Iter1 π π π -34.8 -12.6 17.6 π π = 14 15 16 Iter2 Change of sign -12.6 1.5 17.6 π π = Change of sign 14.5 14 15 Iter3 -5.8 1.5 -12.6
5
Sec:5.2 The Bisection Method
Textbook notations π π π π π π 12 16 Change of sign β π π = π π π β π π π At the n-th iteration: -34.8 17.6 endpoints of the inteval π π π π π π 12 14 Change of sign 16 [ π π π , π π π ] Iter1 β π π = π π π β π π π -34.8 -12.6 17.6 Length of the interval π π π π π π 14 15 16 β π π = π π π β π π π Iter2 Change of sign β π π = π π π β π π π -12.6 1.5 17.6 = β π π π π π π π π π π Change of sign 14.5 14 15 Iter3 β π π = π π π β π π π -5.8 1.5 -12.6
6
Sec:5.2 The Bisection Method
Error Estimates for Bisection 12 16 Change of sign -34.8 17.6 π π β At the iter1: π π = True root live inside this interval π π β π π β < length of the interval 12 14 Change of sign 16 π π β π π β <β π π = β π π π Iter1 -34.8 -12.6 17.6 π π At the iter2: = 14 15 16 π π β π π β < length of the interval Iter2 Change of sign π π β π π β <β π π = β π π π π -12.6 1.5 17.6 At the nth iteration: π π β π π β < πβπ π π Error Estimates for Bisection π π β π π β < length of the interval π¬ π π < πβπ π π the absolute error in the n-th iteration < πβπ π π π π β π π β <β π π = β π π π π = πβπ π π
7
Sec:5.2 The Bisection Method
Error Estimates for Bisection π¬ π π < πβπ π π π π π π¬ π π e-01 e-01 e-01 e-01 e-02 e-02 e-03 e-03 e-03 e-03 e-04 e-04 e-05 e-04 e-05 e-05 If πΈπ,π =10 β4 is the desired error, this equation can be solved for π π¬ π π < ππβππ π π < ππ βπ π π > π ππ βπ π π >πΓ ππ π π> πππ πΓ ππ π πππ π =ππ.π
8
Stopping Criteria 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,end for 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,end 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,end max1=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 xr=(a+b)/2; err=abs(b-a); yc=f(xr); 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');
9
Sec:5.2 The Bisection Method
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.