Bisection Method o e e Fer in:tial value, fCa) and f(b) iFe eppesite s)gn C+ and - or - and +) Functienf must be a centdnuous functden on the dnterval [a, b] Bisection Method obteins a solutEon on the interval [a bl [f there ts more one solut]on, depending on the !n!ttal velues, some one w[11 be obtained than Step 1 We wil1 set initial va]ues a and b wh:ch make j(a) and f(b) opposite sign Step 2 Celculeting ci Ca+b)/2 lf convergence cenditien [a- bl < 2s, then ge to Step3, whepe e Ts a small positlve number o lf tfe) =] O, then go to Step3, o lf f(c) enel fCa) are same sbgn, then substitutk the vaiu'e 'pfe for a e lf i(c) an.d f(b) are s'aine sig'n, then substitudi thif valu/e'/of tt fe'r b. Rebeat Step2 Step 3 Let "c'' be a selutioq e Thesolutnn cobtained by the Bbsection Method satisftes lc-z'l
Fundamental idea in Bisection Method For conttnuous function f, tf a and b which make f(a) and f(b) epposite sdgn exist, at least one solutton exFst on the interval (a b) o ]t repeats usEng lntermediate-va[ue theorem and narrowing the range of the sejutton with helf enci he[f 3 -3 a b 5 3S c 4
Example Solve ¢ = 1 2e-= by usi.og, Bise-ction Ms'thed e Let fCgi) ; x - 1 2e-di, create the funcinon f(m) and fts,dat2 .type of the return v'alueemd argument are dbuble data tyPe double func(double x), e ereete the functian which returns the solution by using the Bisection Methed lts arguments are the tnftial velue a, b end e double Blsect.ion(tiouble e, dpuble b, doubls eps), e Le.t the 1n)tial values be a= e, b= 3end E be e =i 10-6
Example a a Use format spedifers "X+ SS" forovtput Olttput of the program is as fo11ows a ! +e QOOOOO, b ! +3 OOOOeO, c ! a ! +a QeOOOO, b ! +1 SaOOOP, c ! a ! +O OeOOOO. b ! +O 750000. c ! a ! +e 37seoc, b = +o 7soooe, c = a = +e ss2soor, b = +o 7soeoo, c = a! +O S62500 b! +O 656250 c= lt a ! +O 6Q937S, b ! +O 656250, o ! a! +O 632S12 b! +O 6S6250 c! ' a ± +e 6S28t2, b ± +O 644531, c = a ± +e 6328t2, b ± +O 638672, c t a ± "e 6S2St2, b = +O 635742, c = a ! +O 634277, b ! +O 635742. c ! a!+O 635010 b!+O 635742 c! tt a = +O,635376, b ± +O 635742, c = a = +O,635559, b = +O 635742, e = a = +O,635559, b = +O 63565i, c = a ! +O 635559, b ! +O 635605. c ! a ! .O e35559, b ! .O 6355S2, c ! a ! +O 635559, b ! +O 635571, c ! a = +O 635559, b = +e 635565, c t a = +O 635562, b = +O 635S6S, c t a = +O 6S5563, b = +e 6355S5. c t ansver !=0 635564 ' +1 +a +a +o +o +o +o +o +o +e +o +o +o +o +o +o +o .o +o +o +o +o sooopet 7soeop ' 3Tsooe 5S250or 6Sth5or 6e93T5 632812 644531 63S672 635742 634277 635010 635376 635559 635G5i 635605 635SS2 6355Vl 635S6S GS5562 da55.63 635564,
Example e Using tAe infinite loep oF repeat,ng Step2 We may use either while loep er for loop ldke the fo11ewing uhile (t) { } ier (, ,){ } e Write convergence conditTon la - bl < 2E like the fo11owing fabs(a " b) < 2 * eps e Use bTeak, fer going to Step3 ]n the algorithm e We can define f(T) = T - 1 2e-= as the fo"owbng functbon double lunc(deuble x){ deuble y, y=x-t 2*exp('xi, return y, } e We can write 10-6 as le-6 (scientific notatron)
Exa mple(clue) #±nc]ude
#±nc]ude (meth h> double imctio-t(double x) { CHIculfftmgfoimulH } double B±seetton(deub]e a, aouUle b, deuble eps) { double fa ; Fu-ctlani O ha tb } O) 1I (tc
Newton's Method e lt's ert iterative method for solving nenl,near equaven i(x) = a e ln meny ceses, the Newton's Method often cenverges on a selutien fasterthan Bisect,on Method, but daes not converge all the time g We need te cempute f(i) end first' cierdvative f'(:) Step1 Step 2 Step 3 We set sn initial value tCO) pn a domain lt is better to set e close v21ue of solution, if you have the idea of a solution We enlculate s.equences a(!),mL2),a{E}, using the foilewbng mpcurrenpp, formtila .ct+" =zti) - ffie. 3}) (t=d,I.2, ・) Weassumef'Ct{'})"O When satbsfYlng some contergen.Qe c..ondb{ion, Let tLetl) ije an aepr,oxtma.te sglut!efi Fe.r ekanip-'e ItzC'+Z) -xCt)1 < b
Geometric ' lnterpretatlon - e A tangent 1ine of f(x) lin r = xCZ) ls y=f'(z(t))(=-m('))+f(x{i}), e Repeettng to cejcuiete x-coordinate polint et dntersection of the tangent hne and x-Exis(y = O) X=x(t)- f(=f')) f'(=(t)) iCel c-
limit on the number of iterations e ln Newton's Method, even lf there ls a solution, it may not converge to a sa]ut]on, depending on the initia] velue Therefere, we set the upper 1/mit at the number of /terat]ons. m case of reaehing 1imitatien, then it ends the iteration oi cs) ,.Co)4 u) o) Let Ji,mx be the max iteretive number ln case of reaching 1im]tation w]thout satisfying convergence condition, it is considered that an appmoximate solut]en was not obtained For example IMAx z20
Creating a program - Solve the equat:on x=12e一七 uslng NewtOn「s Method For 3=12e-2⇔岱一126rm=0 ,we hold fCx)==-12e-x、 ノt(th)=1十12e-= We solve the equatTon using lteratlon 押一・一綜い・一・,…,・
Hints e Computatlon of f(x},f'(x) fCl),f'(x) are f(=)=m-12eJ", f'(=)=1+12eJ'L Far comput]ng the above values, we wbll define fCx), fr(x) as functions We cen define f(3} = m- 1 2e-T ps the following functdon deuble funcCdeuble x){ devble y, y=x't 2*exp(-x), return y, } ' S/mdlarly, we can defbne f'(t) as something like functroin.name2unc-d( )
Hints x{'+1) = rCi) - f(to) fr(T(z)) Ct=O,1,2, } e ln Newton's Method, we set some init;ai value =(O), according to the above formula, eompute the next point in sequence with increesing the value ef 7 e When sat]sfying stoppmg cnterion, it ends computing LEt a obtained value be an approxbmate solutian e Setting ef the initia] ve]ue Deciare e variable c that represents the current po]nt and substitute some value for m e lteration of Newton's Method Use whlle, fot leop
Hint a Fer steppdng iteration, we use the fo11evifing stepptng cnterien ltCv+i)-ab)1
Summary e MetFLods for solving monlineer equatFons e BisectTon Method o Newten's Method