NA 4
description
Transcript of NA 4
-
December 18, 2014
Pa
ge8
5.2 Continued5.2 Continued5.2 Continued5.2 Continued find only one zero < 0 "# = %&'() %&*+,%&'() =
%- %+%- + %+ Dont stop until "# < "2 "# = %- %+ = % "#' = %2 < "2 6 = log8 9%
"2 :
Bisection Algorithm Pseudo code FUNCTION Bisectxl, xu, es, imax, xr, iter, ea iter = 0 DO
xrold = xr xr = xl + xu/2 iter = iter + 1 IF xr 0 THEN
ea = ABSxr xrold/xr*100 END IF test = fxl * fxr IF test < 0 THEN
xu = xr ELSE IF test > 0 THEN
xl = xr ELSE
ea = 0 END IF IF ea < es OR iter imax, EXIT
END DO Bisect = xr END Bisect
b a
input output
-
December 18, 2014
Pa
ge9
Flow chart
iter = 0
xrold = xr
xl = xr xu = xr
test < 0 ?
test = fxl * fxr
ea = Uxrold xrxr U 100
xr 0 ?
iter = iter + 1
xr = xl + xu/2
ea = 0
exit
test > 0 ?
ea > es or iter imax
NO
YES
NO
NO
NO
YES
YES
YES
-
December 18, 2014
Pa
ge1
0
EX 1 Determine the real root of % = 4%X 6%8 + 7% 2.3 using Bisection to locate the root. Let %+ = 0, %- = 1, and iterate until the estimated error "# falls below a level of "2 = 10%.
n %+ %- %+ %& = %+ + %-2 %& "# =%- %+%- + %+ 0 0 1 2.3 1/2 0.2 1 0 1/2 2.3 1/4 0.8625 100 % 2 1/4 1/2 0.8625 3/8 0.3078 33.33 % 3 3/8 1/2 0.3078 7/16 0.0510 14.29 % 4 7/16 1/2 0.0510 15/32 0.07488 6.67 % %& 15 32 = 0.46875
5.3 The False 5.3 The False 5.3 The False 5.3 The False Position MethPosition MethPosition MethPosition Method Regula Falsiod Regula Falsiod Regula Falsiod Regula Falsi
b %- = %- %+%- %+ % %+
b = 0 %& = %- %-%- %+%- %+ EX 1b use False Position to locate %&
n %+ %- %+ %& = %- %-%- %+%- %+ %& "# = %&
'() %&*+,%+'() 0 0 1 2.3 0.46 0.039744 1 0 0.46 2.3 0.45219 0.0083076 1.73 % %& 0.45219
b a %+ , c%+
%-, c%- %&